注册表杀木马,2000、XP、2003下木马、病毒防范之注册表权限设置法

2000、XP、2003下木马、病毒防范之注册表权限设置法 - 注册表 - 电脑教程网

2000、XP、2003下木马、病毒防范之注册表权限设置法

日期:2007-06-08   荐:
 一、引

    前不久,没事到http://www.sometips.com/闲逛,看完《文件权限和注册表权限的另类使用》大受启发。于是就有了本文的产生。

  二、问题的提出

  大部分的木马及部分的病毒是通过注册表的自启动项或文件关联或通过系统服务实现自启动的,详见《Windows的自启动方式》,那是否有一种方法可以防止木马或病毒修改注册表项及增加服务呢?

  三、问题的解决

  windows2000/XP/2003的注册表是可以设置权限的,只是我们比较少用到。设置以下注册表键的权限:

  1、设置注册表自启动项为everyone只读(Run、RunOnce、RunService),防止木马、病毒通过自启动项目启动
  2、设置.txt、.com、.exe、.inf、.ini、.bat等等文件关联为everyone只读,防止木马、病毒通过文件关联启动
  3、设置注册表HKLM\SYSTEM\CurrentControlSet\Services为everyone只读,防止木马、病毒以"服务"方式启动

  注册表键的权限设置可以通过以下方式实现:

  1、如果在域环境里,可能通过活动目录的组策略实现的

  2、本地计算机的组策略来(命令行用secedit)

  3、本文通过setacl这个程序加批处理实现,可以在http://www.helge.mynetcologne.de/setacl/下载

  4、手工操作可以通过regedt32(windows2000系统,在菜单“安全”下的“权限”)或regedit(windows2003/xp,在“编辑”菜单下的“权限”)

  批处理代码在后面给出。

  如果只有users组权限,以上键值默认是只读的,就可以不用这么麻烦了。

  四、适用人群

  1)、对电脑不是很熟悉,不经常安装/卸载软件的人

  2)、喜欢在网上下载软件安装的朋友

  3)、每台电脑的操作人员都有管理员权限,这些人的电脑水平又参差不齐的企业

  五、还存在的问题

  1)、安装杀毒软件,打补丁的时候都可能对那些注册表进行操作,这样就得先恢复权限设置,再安装,安装完成后重新设置。不方便

  2)、防不住3721,不知是不是3721的权限太高了(听说3721是通过驱动程序启动的,有ring 0级权限)

  3)、只适合windows2000/xp/2003,其他的就没办法了

  4)、只能对付那些简单的病毒和木马

  六、其他

  大家看完本文看,可能禁不住大骂:神经病,两三句话就说完的事,非得搞得像论文,写这么一大堆,浪费我时间。如果真的是这样,那真的是对不起了。只因为公司在实施ISO,我也觉得ISO里提倡的东西蛮好的,为了规范化我的文档,我就多做些练习了。

  七、批处理源代码

@goto start
==============================================================
名称:反特洛伊木马
功能:

     1、禁用自启动项目(run runonce runservices)
     2、禁止修改.txt、.com、.exe、.inf、.ini、.bat等等文件关联
     3、禁止修改"服务"信息

原理:设置注册表权限为只读

版本修订情况

版本号     修订日期    修订人  修订内容
1.0        2004-12-22  netu0  创建本脚本            

[1] [2] [3] [4]  

==============================================================
:start
@SETLOCAL
@rem 活动代码页设为中文
@chcp 936>nul 2>nul
@echo.
@echo ************************************************************
@echo #
@echo #         欢迎使用反特洛伊木马程序
@echo #
@echo #
@echo ************************************************************

:chkOS
@echo.
@verfind "2000" > nul 2>nul
@if "%ERRORLEVEL%"=="0" goto :2000
@verfind "Microsoft Windows [版本 5" > nul 2>nul
@if "%ERRORLEVEL%"=="0" goto :2003
@verfind "XP" > nul 2>nul
@if "%ERRORLEVEL%"=="0" goto :XP
@echo.
@echo #您的操作系统不是windows 2000/XP/2003中的一种,无法使用。
@goto quit

@rem 在下面语句插不同系统的不同命令
:2000
@set UpdatePolicy=secedit /refreshpolicy machine_policy>nul 2>nul
@goto Selection

:XP
@set UpdatePolicy=GPUpdate /Force>nul 2>nul
@goto Selection

:2003
@set UpdatePolicy=GPUpdate /Force>nul 2>nul
@goto Selection

:Selection
@rem User Choice
@echo.
@echo 请输入以下选项前面的数字
@echo.
@echo 1: 安装反特洛伊木马保护
@echo 2: 删除反特洛伊木马保护(恢复默认设置)
@echo 3: 查看技术信息
@echo 4: 退出
@echo.
@set /p UserSelection=输入您的选择(1、2、3、4)
@if "%UserSelection%"=="1" goto install
@if "%UserSelection%"=="2" goto uninstall
@if "%UserSelection%"=="3" goto information
@if "%UserSelection%"=="4" goto quit
@rem 输入其他字符
@cls
@goto Selection

:information
@cls
@echo ==============================================================
@echo #
@echo #         欢迎使用反特洛伊木马程序
@echo #
@echo #功能:
@echo #
@echo #   1、设置注册表自启动项为只读(Run、RunOnce、RunService),
@echo #      防止木马、病毒通过自启动项目启动
@echo #   2、设置.txt、.com、.exe、.inf、.ini、.bat等等文件关联为只读,
@echo #      防止木马、病毒通过文件关联启动
@echo #   3、设置注册表HKLM\SYSTEM\CurrentControlSet\Services为只读
@echo #      防止木马、病毒以"服务"方式启动
@echo #      
@echo #注意事项:  
@echo #    某些安装程序也会用到以上注册表键,请在安装前运行本程序,
@echo #    然后选择2,恢复默认设置。安装完成后,重新运行本程序,
@echo #    然后选择1,实施反特洛伊木马保护
@echo ==============================================================
@echo.
@echo 按任意键,返回选择
@pause>nul 2>nul
@cls
@goto Selection
:install
@set OP=/grant everyone /read  /p:no_dont_copy
@goto Doit
:uninstall
@set OP=/revoke everyone /read  /p:yes
@goto Doit

:Doit
@echo.
@echo 正在执行操作...
@rem HKLM
@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /registry %OP%>nul 2>nul

 [1] [2] [3] [4]  

@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /registry %OP%>nul 2>nul
@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices /registry %OP%>nul 2>nul
@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\RunEX /registry %OP%>nul 2>nul
@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEX /registry %OP%>nul 2>nul
@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesEx /registry %OP%>nul 2>nul

@rem HKCU
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /registry %OP%>nul 2>nul
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /registry %OP%>nul 2>nul
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices /registry %OP%>nul 2>nul
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunEX /registry %OP%>nul 2>nul
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEX /registry %OP%>nul 2>nul
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesEx /registry %OP%>nul 2>nul
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesOnce /registry %OP%>nul 2>nul

@rem USERS
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /registry %OP%>nul 2>nul
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /registry %OP%>nul 2>nul
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices /registry %OP%>nul 2>nul
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunEX /registry %OP%>nul 2>nul
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEX /registry %OP%>nul 2>nul
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesEx /registry %OP%>nul 2>nul
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesOnce /registry %OP%>nul 2>nul

@rem Services
@setacl MACHINE\SYSTEM\CurrentControlSet\Services /registry %OP%>nul 2>nul

@rem CLASSES_ROOT
@setacl CLASSES_ROOT\exefile\shell\open\command /registry %OP%>nul 2>nul
@setacl CLASSES_ROOT\inifile\shell\open\command /registry %OP%>nul 2>nul
@setacl CLASSES_ROOT\txtfile\shell\open\command /registry %OP%>nul 2>nul
@setacl CLASSES_ROOT\comfile\shell\open\command /registry %OP%>nul 2>nul
@setacl CLASSES_ROOT\batfile\shell\open\command /registry %OP%>nul 2>nul
@setacl CLASSES_ROOT\inffile\shell\open\command /registry %OP%>nul 2>nul

@echo 正在更新帐户策略、审核策略......
@REM [刷新本地安全策略]
@%UpdatePolicy%>nul 2>nul
@echo 帐户策略、审核策略更新完成

:complete
@echo 操作完成
@echo.
@echo.
@echo 请按任意键退出。
@pause>nul 2>nul

:quit
@rem Clear
@del %systemroot%\system32\setacl.exe>nul 2>nul
@del %systemroot%\system32\AntiTrojanhorse.bat>nul 2>nul

@ENDLOCAL

 [1] [2] [3] [4]  

right">(出处:http://www.sheup.com)


 [1] [2] [3] [4] 

@echo 正在更新帐户策略、审核策略......@REM [刷新本地安全策略]@%UpdatePolicy%>nul 2>nul@echo 帐户策略、审核策略更新完成

:complete@echo 操作完成@echo.@echo.@echo 请按任意键退出。@pause>nul 2>nul

:quit@rem Clear@del %systemroot%\system32\setacl.exe>nul 2>nul@del %systemroot%\system32\AntiTrojanhorse.bat>nul 2>nul

@ENDLOCAL

(出处:http://www.sheup.com/)


 [1] [2] [3] [4] [5] 

标签: