副问题[/!--empirenews.page--]
许多小搭档在发明可能判定出注入的时辰,大大都选择就是直接上sqlmap,功效每每也不尽人意,于是就有设法来写写 sqlmap 从执行到判定注入,到底产生了什么?
本文就用我们看的见的角度来说明,看看sqlmap到底发送了什么payload,这些payload是怎么出来的,不深入代码层面。
测试情形:
- sqlmap(1.3.6.58#dev)
- Burp Suite
- http://attack.com?1.php?id=1
测试方法
操作 sqlmap 的 proxy 参数,我们将署理配置为 8080 端口用 burpsuite 举办抓包。
- sqlmap.py -u "http://attack.com?1.php?id=1" --proxy="http://127.0.0.1:8080"
(测试了好久仿佛当地搭建的情形无法抓包,以是就找了有注入点的网站,裂痕已上报给裂痕平台)
抓取到的包如下 :

sqlmap 的筹备事变
我们也调查到,sqlmap 默认发送的 User-Agent 是这样的。
- User-Agent: sqlmap/1.3.6.58#dev (http://sqlmap.org)
所觉得了停止被 waf 可能日记内里记录,我们一样平常可以添加一个 --random-agent 参数在后头。
起首我们的 sqlmap 会持续发送出很大都据包来检测方针网站是否不变:
- GET /xxxx.php?id=1 HTTP/1.1
- Host: www.xxxx.xxx
- Accept: */*
- User-Agent: sqlmap/1.3.6.58#dev (http://sqlmap.org)
- Connection: close
- Cache-Control: no-cache
-
- [INFO] testing connection to the target URL
- [INFO] testing if the target URL content is stable
- [INFO] target URL content is stable
接下来会检测是否为 dynamic,和上面的哀求包对比,sqlmap 修改了 id 后头的值。
- GET /xxxx.php?id=2324 HTTP/1.1
- Host: www.xxx.xxx
- Accept: */*
- User-Agent: sqlmap/1.3.6.58#dev (http://sqlmap.org)
- Connection: close
- Cache-Control: no-cache
-
- [INFO] testing if GET parameter 'id' is dynamic
看不懂这是什么骚操纵,我们来看看源码内里怎么说 (sqlmaplibcontrollerchecks.py)。
- def checkDynParam(place, parameter, value):
- """
- This function checks if the URL parameter is dynamic. If it is
- dynamic, the content of the page differs, otherwise the
- dynamicity might depend on another parameter.
- """
按照输出语句的要害词查找,我追踪到了这个 checkDynParam 函数,或许的浸染就是修改我们此刻获取到的参数值,看修改前后的页面返回是否沟通(有的时辰注入有多个参数,那么有些无关紧急的参数修改后页面是没有变革的),如有变革(可能嗣魅这个参数是真实有用的),sqlmap 才会走到下一步。
下一步的数据包和成果如下:
- GET /xxxx.php?id=1%27.%29%2C%2C.%28.%29%22 HTTP/1.1
- Host: www.xxx.xxx
- Accept: */*
- User-Agent: sqlmap/1.3.6.58#dev (http://sqlmap.org)
- Connection: close
- Cache-Control: no-cache
-
- [INFO] heuristic (basic) test shows that GET parameter 'id' might be injectable (possible DBMS: 'MySQL')
我们将上面的 url 编码解码:
- /xxxx.php?id=1%27.%29%2C%2C.%28.%29%22
- /xxxx.php?id=1'.),,.(.)"
这几个字符串就能判定是 MySQL 数据库?又是什么骚操纵,再看看源码吧 (sqlmaplibcontrollerckecks.py):
- infoMsg += " (possible DBMS: '%s')" % Format.getErrorParsedDBMSes()
找到了一条语句,跟踪这个 getErrorParsedDBMSes() 函数。
- def getErrorParsedDBMSes():
- """
- Parses the knowledge base htmlFp list and return its values
- formatted as a human readable string.
-
- @return: list of possible back-end DBMS based upon error messages
- parsing.
- @rtype: C{str}
- """
(编辑:湖南网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|