文档介绍:SQL注入之字符型注入
主要内容
如何寻找和判断注入点
如何利用注入点
寻找SQL注入点
识别SQL注入漏洞有一种简单的规则:
通过发送异常数据来触发异常。
规则含义:
识别web应用上所有的数据输入
了解哪种类型的请求回触发异常。
检测服务器响应中的异常
字符型参数判断
HTTP://?p=YY'(附加一个单引号),
此时SQL语句:select * from 表名 where 字段='YY'',;
HTTP://?p=YY and '1'='1, ,而且与HTTP://?p=YY运行结果相同;
此时SQL语句如下: select * from 表名 where 字段=YY and '1'='1
HTTP://?p=YY and '1'='2, ;
此时SQL语句如下: select * from 表名 where 字段=YY and '1'='1
如果以上三步全面满足,。
dvwa为例
正常访问:/?id=1&Submit=Submit#
DVWA为例
非正常访问:/?id=1%27&Submit=Submit#
DVWA为例
使用”id=1' and 1='1”和”id=1' and 1='2”进一步判断
服务器执行的SQL语句
select first_name,last_name from users where user_id = '1';
select first_name,last_name from users where user_id = '1'';
select first_name,last_name from users where user_id = '1' and 1='1';
select first_name,last_name from users where user_id = '1' and 1='2';
为什么可以通过以上几步确定SQL注入
SQL注入的利用一般步骤
根据环境,寻找注入点,并判断数据库类型
注入SQL语句,猜解表名、列名
注入SQL语句,得到字段内容