跳至正文

Windows 2003 防木马、硬盘安全设置功略

特别提示:在win2000下面那套权限设置方案,在win2003并不适用,也就是为什么以前有那么多写关于2000下面权限设置,而我这里要在2003重新提出来的原因

作者:MaxGO QQ:80539280
前言,我们院作了一个web服务器是专门给大学各个社团所开,前些日子服务器上几乎所有的网站首页都被修改,同学中有人惊呼,哇噻!谁干的真牛叉,我晕~~~在我看来这是迟早要发生的事,而且入侵过程及其简单,没看服务器之前就想过只有两种可能性,一是有人把服务器密码泄露出去了;二是,通过网站本身的漏洞(呵呵,服务器是我配置的)但我没有进行iis具体权限的设置。我N年前就给老师反映过了,社团的那帮菜安全意识极差,只会用现成的东东,这样下去迟早会出问题,老师当时没听进去,我也就没管那么多了。[separator]出问题后,我仔细研究了日志文件和所上传文件的日期,发现有个海洋顶端2006在3月份就已经传至服务器,不过没有做任何改动,汗一个~~~大概是这位大哥忘了,前些日子又费劲心思找了半天的网站漏洞,我看了看,这位四川XX大学的仁兄喜欢夜间作业,而且是连夜,真是有hacker精神。好了,不废话了,先从他的入侵经过讲起:该仁兄是从放置在服务器上的其中的一个社团网站进入的,该网站采用的是动易的3.X版本,据我所了解,没有打补丁,上传也是打开的,我没猜错的话他就是通过动易的漏洞上传了木马(呵呵,他这里上传的是桂林老兵的站长助手),然后通站长助手找到了其他的网站目录,从而该服务器上的社团网站们进行修改。
事后,老师说将FSO禁用掉就万事大吉,我看不然,更何况有许多站点没有FSO的支持就无法运行。
那么,怎么做才能防止asp木马在您服务器上的恶意破坏?我查阅了n多资料后,总结了一个比较完善的解决方法。在这里,我以海洋顶端2006为例,来简单介绍一下怎样设置才能严防asp木马。
我装了一台Windows2003企业版,未打sp1补丁。
如下图所示:
采用默认设置,将海洋顶端2006放至web目录下,运行海洋顶端木马如图可以看出,在系统默认设置下,所有的操作都可用,也就是只要入侵者通过某种途径取得了webshell,那么采用海洋顶端木马就可以修改和删除web服务器的里面的绝大部分文件,甚至提升权限。
我们来看看海洋顶端都有一些什么操作,大家看第6,7,8,9项,通过他们就可以运行服务器上的程序和修改文件。FSO我们先不管,我们先来卸载WScript.Shell, Shell.application
这两个组件。
选开始—–运行
regsvr32 /u WSHom.Ocx
regsvr32 /u shell32.dll
也可以设置为禁止guests用户组访问,然后将访问web目录的默认账户设为guests组
cacls %systemroot%system32shell32.dll /e /d guests
如果提示无法删除文件正在使用,请先停用iis删除相关进程,然后再进行删除
当然还可以将这些组建改名,但要记得需要改两个地方。
1.WScript.Shell组件修改方法
HKEY_CLASSES_ROOTWScript.Shell

HKEY_CLASSES_ROOTWScript.Shell.1
改名为其它的名字,如:改为WScript.Shell_ChangeName或WScript.Shell.1_ChangeName
自己以后调用的时候使用这个就可以正常调用此组件了
也要将clsid值也改一下
HKEY_CLASSES_ROOTWScript.ShellCLSID项目的值
HKEY_CLASSES_ROOTWScript.Shell.1CLSID项目的值
2.
Shell.Application组件修改方法
HKEY_CLASSES_ROOTShell.Application

HKEY_CLASSES_ROOTShell.Application.1
改名为其它的名字,如:改为Shell.Application_ChangeName或Shell.Application.1_ChangeName
自己以后调用的时候使用这个就可以正常调用此组件了
也要将clsid值也改一下
HKEY_CLASSES_ROOTShell.ApplicationCLSID项目的值
HKEY_CLASSES_ROOTShell.ApplicationCLSID项目的值
这样,就可以防止木马文件调用这些组建了。
为了进一步的安全,我们还可以把 %systemroot%system32 下的net.exe,cmd.exe,ftp.exe,tftp.exe,telnet.exe 等设为只允许administrator访问。
磁盘权限
提示:如果权限设置出错,可以采用微软的secedit 工具来恢复默认
首先,将所有磁盘上的everyone用户去掉。系统盘其他用户保持默认,其他盘就留system和administrator就可以了,装有服务软件的文件夹具体权限还需另外设置。
然后,给每个web站点一个默认匿名访问账户,同时给与其相对应的虚拟目录文件夹相应的权限。
网上关于这方面的设置比较多,暂时借用天之骄子的。他的是在2000下设置的,这方面2003大体相同,但在,文件夹权限方面是不同的,切记切记~~~运行asp的默认权限,我会在附录中给出。
我们给用户建一个本地目录,也就是用户的网站的根目录我们就建到F:8660.net

到控制面版—-管理工具—服务器管理–本地用户或组—用户—-新增USER_8660.net的用户

{
return imgzoom(this);
}” onmouseover=”function anonymous()
{
if(this.resized) this.style.cursor=’hand’;
}” onclick=”function anonymous()
{
if(!this.resized) {return true;} else {window.open(‘http://www.8660.net/blog/attachments/month_0506/@9zc_20056258439.jpg’);}
}” src=”http://www.8660.net/blog/attachments/month_0506/@9zc_20056258439.jpg” onload=”function anonymous()
{
if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new windownCTRL+Mouse wheel to zoom in/out’;}
}” border=”0″ />
选择USER_8660.net用户–属性—修改隶属于改成gusets组
{
return imgzoom(this);
}” onmouseover=”function anonymous()
{
if(this.resized) this.style.cursor=’hand’;
}” onclick=”function anonymous()
{
if(!this.resized) {return true;} else {window.open(‘http://www.8660.net/blog/attachments/month_0506/jg_m_20056258439.jpg’);}
}” src=”http://www.8660.net/blog/attachments/month_0506/jg_m_20056258439.jpg” onload=”function anonymous()
{
if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new windownCTRL+Mouse wheel to zoom in/out’;}
}” border=”0″ />
给用户的文件夹F:8660.net分配权限(USER_8660.NET是控制改用户的来宾帐号 ASPNET 由于服务器上支持。NET所以也要把ASPNET帐户的权限给他,否则执行ASP。NET将权限不够)。
{
return imgzoom(this);
}” onmouseover=”function anonymous()
{
if(this.resized) this.style.cursor=’hand’;
}” onclick=”function anonymous()
{
if(!this.resized) {return true;} else {window.open(‘http://www.8660.net/blog/attachments/month_0506/2yp6_20056258439.jpg’);}
}” src=”http://www.8660.net/blog/attachments/month_0506/2yp6_20056258439.jpg” onload=”function anonymous()
{
if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new windownCTRL+Mouse wheel to zoom in/out’;}
}” border=”0″ />
把USER_8660.NET 和ASPNET的帐号的权限都设置成如下(记住一定不要把完全控制的权限分配给用户)

{
return imgzoom(this);
}” onmouseover=”function anonymous()
{
if(this.resized) this.style.cursor=’hand’;
}” onclick=”function anonymous()
{
if(!this.resized) {return true;} else {window.open(‘http://www.8660.net/blog/attachments/month_0506/@9zb_20056258439.jpg’);}
}” src=”http://www.8660.net/blog/attachments/month_0506/@9zb_20056258439.jpg” onload=”function anonymous()
{
if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new windownCTRL+Mouse wheel to zoom in/out’;}
}” border=”0″ />
然后我们建立IIS指向到该用户的目录
打开IIS—新建 WEB站点—
{
return imgzoom(this);
}” onmouseover=”function anonymous()
{
if(this.resized) this.style.cursor=’hand’;
}” onclick=”function anonymous()
{
if(!this.resized) {return true;} else {window.open(‘http://www.8660.net/blog/attachments/month_0506/li!o_20056258439.jpg’);}
}” src=”http://www.8660.net/blog/attachments/month_0506/li!o_20056258439.jpg” onload=”function anonymous()
{
if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new windownCTRL+Mouse wheel to zoom in/out’;}
}” border=”0″ />
[img] {
return imgzoom(this);
}” onmouseover=”function anonymous()
{
if(this.resized) this.style.cursor=’hand’;
}” onclick=”function anonymous()
{
if(!this.resized) {return true;} else {window.open(‘http://www.8660.net/blog/attachments/month_0506/da6h_20056258439.jpg’);}
}” src=”http://www.8660.net/blog/attachments/month_0506/da6h_20056258439.jpg” onload=”function anonymous()
{
if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new windownCTRL+Mouse wheel to zoom in/out’;}
}” border=”0″ />[/img]
选择WEB服务器(8660.NET)–属性— 目录安全性
{
return imgzoom(this);
}” onmouseover=”function anonymous()
{
if(this.resized) this.style.cursor=’hand’;
}” onclick=”function anonymous()
{
if(!this.resized) {return true;} else {window.open(‘http://www.8660.net/blog/attachments/month_0506/li!o_20056258439.jpg’);}
}” src=”http://www.8660.net/blog/attachments/month_0506/li!o_20056258439.jpg” onload=”function anonymous()
{
if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new windownCTRL+Mouse wheel to zoom in/out’;}
}” border=”0″ />
—-匿名访问和验证控制—编辑
{
return imgzoom(this);
}” onmouseover=”function anonymous()
{
if(this.resized) this.style.cursor=’hand’;
}” onclick=”function anonymous()
{
if(!this.resized) {return true;} else {window.open(‘http://www.8660.net/blog/attachments/month_0506/jg_m_20056258439.jpg’);}
}” src=”http://www.8660.net/blog/attachments/month_0506/jg_m_20056258439.jpg” onload=”function anonymous()
{
if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new windownCTRL+Mouse wheel to zoom in/out’;}
}” border=”0″ />
匿名访问—编辑
{
return imgzoom(this);
}” onmouseover=”function anonymous()
{
if(this.resized) this.style.cursor=’hand’;
}” onclick=”function anonymous()
{
if(!this.resized) {return true;} else {window.open(‘http://www.8660.net/blog/attachments/month_0506/3zr7_20056258439.jpg’);}
}” src=”http://www.8660.net/blog/attachments/month_0506/3zr7_20056258439.jpg” onload=”function anonymous()
{
if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new windownCTRL+Mouse wheel to zoom in/out’;}
}” border=”0″ />
选择USER_8660.NET用户名作为访问此站点的用户帐号

至此,即使有人取得了一个网站的webshell,也只能对该网站进行修改(活该,谁叫你有洞),并不能造成跨站攻击了,呵呵~~~

附录一:
我们安装软件的权限设置:
c:Program FilesLIWEIWENSOFT
Everyone 读取和运行,列出文件夹目录,读取
administrators 全部
IIS_WPG 读取和运行,列出文件夹目录,读取

c:Program FilesDimac(如果有这个目录)
Everyone 读取和运行,列出文件夹目录,读取
administrators 全部

c:Program FilesComPlus Applications (如果有)
administrators 全部

c:Program FilesGflSDK (如果有)
administrators 全部
Creator owner
不是继承的
只有子文件夹及文件
完全
Power Users
修改,读取和运行,列出文件夹目录,读取,写入
system 全部
TERMINAL SERVER Users
修改,读取和运行,列出文件夹目录,读取,写入
Users 读取和运行,列出文件夹目录,读取
Everyone 读取和运行,列出文件夹目录,读取

c:Program FilesInstallShield Installation Information (如果有)
c:Program FilesInternet Explorer (如果有)
c:Program FilesNetMeeting (如果有)
administrators 全部

附录二:
IIS 6.0所需要的默认权限
NTFS permissions
Directory UsersGroups Permissions
%windir%helpiishelpcommon Administrators Full control
%windir%helpiishelpcommon System Full control
%windir%helpiishelpcommon IIS_WPG Read
%windir%helpiishelpcommon Users (See Note 1.) Read, execute
%windir%IIS Temporary Compressed Files Administrators Full control
%windir%IIS Temporary Compressed Files System Full control
%windir%IIS Temporary Compressed Files IIS_WPG List, read, write
%windir%IIS Temporary Compressed Files Creator owner Full control
%windir%system32inetsrv Administrators Full control
%windir%system32inetsrv System Full control
%windir%system32inetsrv Users Read, execute
%windir%system32inetsrv*.vbs Administrators Full control
%windir%system32inetsrvASP compiled templates Administrators Full control
%windir%system32inetsrvASP compiled templates IIS_WPG Read
%windir%system32inetsrvHistory Administrators Full control
%windir%system32inetsrvHistory System Full control
%windir%system32Logfiles Administrators Full control
%windir%system32inetsrvmetaback Administrators Full control
%windir%system32inetsrvmetaback System Full control
InetpubAdminscripts Administrators Full control
Inetpubwwwroot (or content directories) Administrators Full control
Inetpubwwwroot (or content directories) System Full control
Inetpubwwwroot (or content directories) IIS_WPG Read, execute
Inetpubwwwroot (or content directories) IUSR_MachineName Read, execute
Inetpubwwwroot (or content directories) ASPNET (See Note 2.) Read, execute

Note 1 You must have permissions to this directory when you use Basic authentication or Integrated authentication and when custom errors are configured. For example, when error 401.1 occurs, the logged-on user sees the expected detailed custom error only if permissions to read the 4011.htm file have been granted to that user.

Note 2 By default, ASP.NET is used as the ASP.NET process identity in IIS 5.0 isolation mode. If ASP.NET is switched to IIS 5.0 isolation mode, ASP.NET must have access to the content areas. ASP.NET process isolation is detailed in IIS Help. For additional information, visit the following Microsoft Web site:

ASP.NET process isolation
http://www.microsoft.com/technet … technet/prodtechnol
/windowsserver2003/proddocs/standard/aaconruntimeprocessisolation.asp

Registry permissions
Location UsersGroups Permissions
HKLMSystemCurrentControlSetServiceASP Administrators Full control
HKLMSystemCurrentControlSetServiceASP System Full control
HKLMSystemCurrentControlSetServiceASP IIS_WPG Read
HKLMSystemCurrentControlSetServiceHTTP Administrators Full control
HKLMSystemCurrentControlSetServiceHTTP System Full control
HKLMSystemCurrentControlSetServiceHTTP IIS_WPG Read
HKLMSystemCurrentControlSetServiceIISAdmin Administrators Full control
HKLMSystemCurrentControlSetServiceIISAdmin System Full control
HKLMSystemCurrentControlSetServiceIISAdmin IIS_WPG Read
HKLMSystemCurrentControlSetServicew3svc Administrators Full control
HKLMSystemCurrentControlSetServicew3svc System Full control
HKLMSystemCurrentControlSetServicew3svc IIS_WPG Rea
]]>

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据