::author vim
::QQ 82996821
::filename Windows2008R2_safe_auto_set.bat
:start
@echo off
color 0a
@echo 请选择要服务操作类型:
@echo 1.更改远程端口,重启后生效
@echo 2.目录权限优化
@echo 3.系统服务优化
@echo 4.网络安全优化[修改注册表]
@echo 5.禁用所有IPV6组件,除IPV6环回接口
@echo 6.删除系统默认共享
@echo 7.卸载ASP漏洞wshom.ocx,shell32.dll组件
@echo 8.组策略优化
@echo 9.关闭防火墙
@echo 0.退出
set/p a=请选择服务操作类型:
goto start%a%
:start1
echo 请输入要修改的远程端口号:
set /p var=
echo 开始修改
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /t REG_DWORD /d %var% /f
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d %var% /f
echo 修改成功,下面是添加防火墙规则
netsh advfirewall firewall add rule name="remote_"%var% protocol=TCP dir=in localport=%var% action=allow
@pause
cls
goto :start
:start2
echo 目录权限优化
echo ==========================================================
::echo 降低C盘权限
::cacls C:\ /e /r "CREATOR OWNER" "Users" >>log.log
echo windows系统文件夹权限设置
takeown /F C:\Windows\System32
takeown /F C:\Windows\System32\config
cacls C:\Windows\System32 /e /r "CREATOR OWNER">>log.log
cacls C:\Windows\System32\config /e /r "CREATOR OWNER">>log.log
echo 程序文件权限设置
takeown /F "C:\Program Files\Windows NT\Accessories"
takeown /F "C:\Program Files\Internet Explorer\iexplore.exe"
takeown /F "C:\Program Files\Common Files"
cacls "C:\Program Files\Windows NT\Accessories" /e /r "CREATOR OWNER" "Users" >>log.log
cacls "C:\Program Files\Internet Explorer\iexplore.exe" /e /r system users >>log.log
cacls "C:\Program Files\Common Files" /e /r "CREATOR OWNER" "Users" >>log.log
echo 用户配置信息的文件夹权限设置
takeown /F "C:\ProgramData\Documents"
takeown /F "C:\ProgramData\Application Data\Microsoft"
takeown /F "C:\ProgramData\Application Data"
takeown /F "C:\ProgramData\「开始」菜单"
takeown /F "C:\Documents and Settings"
cacls "C:\ProgramData\Documents" /e /r everyone >>log.log
cacls "C:\ProgramData\Application Data\Microsoft" /e /r everyone >>log.log
cacls "C:\ProgramData\Application Data" /e /r everyone >>log.log
cacls "C:\ProgramData\「开始」菜单" /e /r everyone >>log.log
cacls "C:\Documents and Settings" /e /r everyone >>log.log
echo iis下的ASP,ASPX网站相关的EXE和DLL
takeown /F C:\Windows\System32\wscript.exe
takeown /F C:\Windows\System32\wshom.ocx
cacls C:\Windows\System32\wscript.exe /e /r users >>log.log
cacls C:\Windows\System32\wshom.ocx /e /r users >>log.log
echo windows系统文件夹下的关键二进制文件
takeown /f C:\Windows\System32\zipfldr.dll
takeown /f C:\Windows\System32\xcopy.exe
takeown /f C:\Windows\System32\wshext.dll
takeown /f C:\Windows\System32\where.exe
takeown /f C:\Windows\System32\tracert.exe
takeown /f C:\Windows\System32\syskey.exe
takeown /f C:\Windows\System32\shutdown.exe
takeown /f C:\Windows\System32\shadow.exe
takeown /f C:\Windows\System32\setx.exe
takeown /f C:\Windows\System32\sethc.exe
takeown /f C:\Windows\System32\secedit.exe
takeown /f C:\Windows\System32\sc.exe
takeown /f C:\Windows\System32\runonce.exe
takeown /f C:\Windows\System32\runas.exe
takeown /f C:\Windows\System32\route.exe
takeown /f C:\Windows\System32\replace.exe
takeown /f C:\Windows\System32\regsvr32.exe
takeown /f C:\Windows\System32\regedt32.exe
takeown /f C:\Windows\System32\reg.exe
takeown /f C:\Windows\System32\print.exe
takeown /f C:\Windows\System32\powercfg.exe
takeown /f C:\Windows\System32\ping.exe
takeown /f C:\Windows\System32\nslookup.exe
takeown /f C:\Windows\System32\notepad.exe
takeown /f C:\Windows\System32\netstat.exe
takeown /f C:\Windows\System32\netsh.exe
takeown /f C:\Windows\System32\net1.exe
takeown /f C:\Windows\System32\net.exe
takeown /f C:\Windows\System32\mstsc.exe
takeown /f C:\Windows\System32\mshta.exe
takeown /f C:\Windows\System32\mountvol.exe
takeown /f C:\Windows\System32\logoff.exe
takeown /f C:\Windows\System32\ipconfig.exe
takeown /f C:\Windows\System32\help.exe
takeown /f C:\Windows\System32\gpupdate.exe
takeown /f C:\Windows\System32\ftp.exe
takeown /f C:\Windows\System32\format.com
takeown /f C:\Windows\System32\finger.exe
takeown /f C:\Windows\System32\find.exe
takeown /f C:\Windows\System32\doskey.exe
takeown /f C:\Windows\System32\cscript.exe
takeown /f C:\Windows\System32\cmd.exe
takeown /f C:\Windows\System32\cacls.exe
takeown /f C:\Windows\System32\attrib.exe
takeown /f C:\Windows\System32\at.exe
takeown /f C:\Windows\System32\arp.exe
cacls C:\Windows\System32\zipfldr.dll /e /r users >>log.log
cacls C:\Windows\System32\xcopy.exe /e /r users >>log.log
cacls C:\Windows\System32\wshext.dll /e /r users >>log.log
cacls C:\Windows\System32\where.exe /e /r users >>log.log
cacls C:\Windows\System32\tracert.exe /e /r users >>log.log
cacls C:\Windows\System32\syskey.exe /e /r users >>log.log
cacls C:\Windows\System32\shutdown.exe /e /r users >>log.log
cacls C:\Windows\System32\shadow.exe /e /r users >>log.log
cacls C:\Windows\System32\setx.exe /e /r users >>log.log
cacls C:\Windows\System32\sethc.exe /e /r users >>log.log
cacls C:\Windows\System32\secedit.exe /e /r users >>log.log
cacls C:\Windows\System32\sc.exe /e /r users >>log.log
cacls C:\Windows\System32\runonce.exe /e /r users >>log.log
cacls C:\Windows\System32\runas.exe /e /r users >>log.log
cacls C:\Windows\System32\route.exe /e /r users >>log.log
cacls C:\Windows\System32\replace.exe /e /r users >>log.log
cacls C:\Windows\System32\regsvr32.exe /e /r users >>log.log
cacls C:\Windows\System32\regedt32.exe /e /r users >>log.log
cacls C:\Windows\System32\reg.exe /e /r users >>log.log
cacls C:\Windows\System32\print.exe /e /r users >>log.log
cacls C:\Windows\System32\powercfg.exe /e /r users >>log.log
cacls C:\Windows\System32\ping.exe /e /r users >>log.log
cacls C:\Windows\System32\nslookup.exe /e /r users >>log.log
cacls C:\Windows\System32\notepad.exe /e /r users >>log.log
cacls C:\Windows\System32\netstat.exe /e /r users >>log.log
cacls C:\Windows\System32\netsh.exe /e /r users >>log.log
cacls C:\Windows\System32\net1.exe /e /r users >>log.log
cacls C:\Windows\System32\net.exe /e /r users >>log.log
cacls C:\Windows\System32\mstsc.exe /e /r users >>log.log
cacls C:\Windows\System32\mshta.exe /e /r users >>log.log
cacls C:\Windows\System32\mountvol.exe /e /r users >>log.log
cacls C:\Windows\System32\logoff.exe /e /r users >>log.log
cacls C:\Windows\System32\ipconfig.exe /e /r users >>log.log
cacls C:\Windows\System32\help.exe /e /r users >>log.log
cacls C:\Windows\System32\gpupdate.exe /e /r users >>log.log
cacls C:\Windows\System32\ftp.exe /e /r users >>log.log
cacls C:\Windows\System32\format.com /e /r users >>log.log
cacls C:\Windows\System32\finger.exe /e /r users >>log.log
cacls C:\Windows\System32\find.exe /e /r users >>log.log
cacls C:\Windows\System32\doskey.exe /e /r users >>log.log
cacls C:\Windows\System32\cscript.exe /e /r users >>log.log
cacls C:\Windows\System32\cmd.exe /e /r users >>log.log
cacls C:\Windows\System32\cacls.exe /e /r users >>log.log
cacls C:\Windows\System32\attrib.exe /e /r users >>log.log
cacls C:\Windows\System32\at.exe /e /r users >>log.log
cacls C:\Windows\System32\arp.exe /e /r users >>log.log
@pause
cls
goto :start
:start3
echo 系统服务优化
echo ==========================================================
echo Background Intelligent Transfer Service 使用空闲网络带宽在后台传送文件。
sc config BITS start= disabled >>log.log
echo 关闭TCP/IP NetBIOS Helper 提供 TCP/IP (NetBT) 服务上的 NetBIOS 和网络上客户端的 NetBIOS 名称解析的支持
sc config lmhosts start= disabled >>log.log
echo 关闭Network Location Awareness网络访问保护(NAP)代理服务
sc config NlaSvc start= disabled >>log.log
echo 关闭Remote Registry 远程修改注册表
sc config RemoteRegistry start= disabled >>log.log
echo 关闭Print Spooler 将文件加载到内存供稍后打印
sc config Spooler start= disabled >>log.log
echo 关闭Distributed Link linktracking client 用于局域网更新连接信息
sc config TrkWks start= disabled >>log.log
echo 关闭Shell Hardware Detection 为自动播放硬件事件提供通知。
sc config ShellHWDetection start= disabled >>log.log
echo 关闭Windows Update 启用检测、下载和安装 Windows 和其他程序的更新。
sc config wuauserv start= disabled >>log.log
echo 关闭支持此计算机通过网络的文件、打印、和命名管道共享。
sc config LanmanServer start= disabled >>log.log
@pause
cls
goto :start
:start4
echo 网络安全优化[修改注册表]
echo ==============备份注册表在当前目录=====================
reg export hklm hklm.reg
reg export hkcu hkcu.reg
reg export hkcr hkcr.reg
reg export hku hku.reg
reg export hkcc hkcc.reg
echo ===================优化注册表=========================
echo 135端口主要用于使用远程过程调用,服务器上一般不建议开启
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole" /v EnableDCOM /t REG_SZ /d N /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc" /v "DCOM Protocols" /t REG_MULTI_SZ /f
reg add "HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys" /v Flags /t REG_SZ /d 506 /f
echo 445端口控制在局域网中轻松访问各种共享文件夹或共享打印机,服务器上一般不建议开启
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\NetBT\Parameters" /v SMBDeviceEnabled /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v SMBDeviceEnabled /t REG_DWORD /d 0 /f
echo IPC空连接可以使连接者与目标主机建立一个空的连接而无需用户名与密码,存在风险建议关闭
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa" /v restrictanonymous /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v restrictanonymous /t REG_DWORD /d 1 /f
echo 配置Backlog,提高网络并发性及网络的处理能力
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\AFD\Parameters" /v EnableDynamicBacklog /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\AFD\Parameters" /v MinimumDynamicBacklog /t REG_DWORD /d 20 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\AFD\Parameters" /v MaximumDynamicBacklog /t REG_DWORD /d 20000 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\AFD\Parameters" /v EnableDynamicBacklog /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\AFD\Parameters" /v MinimumDynamicBacklog /t REG_DWORD /d 20 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\AFD\Parameters" /v MaximumDynamicBacklog /t REG_DWORD /d 20000 /f
echo 通过优化该选项可提高系统防御SYN攻击的能力,建议优化
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services" /v SynAttackProtect /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services" /v EnableDeadGWDetect /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v SynAttackProtect /t REG_DWORD /d 2 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v TCPMaxPortsExhausted /t REG_DWORD /d 5 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v SynAttackProtect /t REG_DWORD /d 2 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v TCPMaxPortsExhausted /t REG_DWORD /d 5 /f
echo 通过优化设置SYN-ACK等待时间,可提高系统的网络性能
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v TcpMaxConnectResponseRetransmissions /t REG_DWORD /d 2 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v TcpMaxConnectResponseRetransmissions /t REG_DWORD /d 2 /f
echo 抵御SNMP攻击,检查无效网关,以便优化网络
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v EnableDeadGWDetect /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v EnableDeadGWDetect /t REG_DWORD /d 0 /f
echo 抵御ICMP攻击,检查有可能用以攻击的ICMP重定向报文
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v EnableICMPRedirects /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v EnableICMPRedirects /t REG_DWORD /d 0 /f
echo 检查TCPIP协议栈IGMP堆栈溢出本地拒绝服务攻击
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v IGMPLevel /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v IGMPLevel /t REG_DWORD /d 0 /f
echo 检查是否禁止IP源路由,建议丢弃所有接受的源路由包
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v DisableIPSourceRouting /t REG_DWORD /d 2 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v DisableIPSourceRouting /t REG_DWORD /d 2 /f
echo 禁止路由发现功能,ICMP路由通告报文可以被用来增加路由表纪录,可以导致攻击
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v PerformRouterDiscovery /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters\Interfaces" /v PerformRouterDiscovery /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v PerformRouterDiscovery /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces" /v PerformRouterDiscovery /t REG_DWORD /d 0 /f
echo 更改ping命令返回的默认TTL值。黑客可通过些值判断操作系统类型
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v DefaultTTL /t REG_DWORD /d 240 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces" /v DefaultTTL /t REG_DWORD /d 240 /f
echo 优化计算机在收到名称释放请求时是否释放其NETBIOS名称,使计算机受恶意的名称释放攻击
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\NetBT\Parameters" /v NoNameReleaseOnDemand /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v NoNameReleaseOnDemand /t REG_DWORD /d 1 /f
echo 优化TCP闲置链接检查时间,提升网络性能
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v KeepAliveTime /t REG_DWORD /d 300000 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v KeepAliveTime /t REG_DWORD /d 300000 /f
echo 禁止进行最大包长度路径检测。如开启该功能,攻击者可能将数据包强制分段,这公使堆栈不堪重负
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v EnablePMTUDiscovery /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v EnablePMTUDiscovery /t REG_DWORD /d 0 /f
echo 优化TCP半连接相关参数值,提升网络性能
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v TcpMaxHalfOpen /t REG_DWORD /d 500 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v TcpMaxHalfOpenRetried /t REG_DWORD /d 400 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v TcpMaxHalfOpen /t REG_DWORD /d 500 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v TcpMaxHalfOpenRetried /t REG_DWORD /d 400 /f
echo 设置TCP重传单个数据段的次数。缺少项值为5,缺省这一过程消耗时间240秒。微软站点安全推荐为3
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v TcpMaxDataRetransmissions /t REG_DWORD /d 2 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v TcpMaxDataRetransmissions /t REG_DWORD /d 2 /f
echo 禁止转发IP多播数据包。多播数据包可能被多台主机响应,从而导致响应淹没网络
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v EnableMulticastForwarding /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v EnableMulticastForwarding /t REG_DWORD /d 0 /f
echo 屏蔽网络拓扑结构细节,防止攻击者利用主机响应来了解内部网络情况
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v EnableAddrMaskReply /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v EnableAddrMaskReply /t REG_DWORD /d 0 /f
@pause
cls
goto :start
:start5
echo 禁用所有IPV6组件,除IPV6环回接口
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters" /v DisabledComponents /t REG_DWORD /d 0xffffffff /f
echo 禁用所有IPV6组件,除IPV6环回接口完毕
@pause
cls
goto :start
:start6
echo 删除系统默认共享
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\parameters" /v AutoShareServer /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\parameters" /v AutoShareWks /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v RestrictAnonymous /t REG_DWORD /d 1 /f
echo 删除系统默认共享完毕
@pause
cls
goto :start
:start7
echo 卸载ASP漏洞wshom.ocx,shell32.dll组件
regsvr32/u wshom.ocx >>log.log
regsvr32 /u shell32.dll >>log.log
echo 卸载ASP漏洞wshom.ocx,shell32.dll组件完毕
@pause
cls
goto :start
:start8
echo 组策略优化
echo ================备份组策略到当前目录====================
secedit /export /cfg ./gpedit_bak.inf
echo ================恢复组策略优化后文件====================
secedit /configure /db temp.sdb /cfg ./gpedit_setup.inf
@pause
cls
goto :start
:start9
echo 关闭防火墙
netsh advfirewall set allprofiles state off
@pause
cls
goto :start
:start0
goto end
:end
##########windows_2008_R2_优化内容详细#################
echo 目录权限优化
echo ==========================================================
echo windows系统文件夹权限设置
C:\Windows\System32
C:\Windows\System32\config
echo 程序文件权限设置
"C:\Program Files\Windows NT\Accessories"
"C:\Program Files\Internet Explorer\iexplore.exe"
"C:\Program Files\Common Files"
echo 用户配置信息的文件夹权限设置
"C:\ProgramData\Documents"
"C:\ProgramData\Application Data\Microsoft"
"C:\ProgramData\Application Data"
"C:\ProgramData\「开始」菜单"
"C:\Documents and Settings"
echo iis下的ASP,ASPX网站相关的EXE和DLL
C:\Windows\System32\wscript.exe
C:\Windows\System32\wshom.ocx
echo windows系统文件夹下的关键二进制文件
C:\Windows\System32\zipfldr.dll
C:\Windows\System32\xcopy.exe
C:\Windows\System32\wshext.dll
C:\Windows\System32\where.exe
C:\Windows\System32\tracert.exe
C:\Windows\System32\syskey.exe
C:\Windows\System32\shutdown.exe
C:\Windows\System32\shadow.exe
C:\Windows\System32\setx.exe
C:\Windows\System32\sethc.exe
C:\Windows\System32\secedit.exe
C:\Windows\System32\sc.exe
C:\Windows\System32\runonce.exe
C:\Windows\System32\runas.exe
C:\Windows\System32\route.exe
C:\Windows\System32\replace.exe
C:\Windows\System32\regsvr32.exe
C:\Windows\System32\regedt32.exe
C:\Windows\System32\reg.exe
C:\Windows\System32\print.exe
C:\Windows\System32\powercfg.exe
C:\Windows\System32\ping.exe
C:\Windows\System32\nslookup.exe
C:\Windows\System32\notepad.exe
C:\Windows\System32\netstat.exe
C:\Windows\System32\netsh.exe
C:\Windows\System32\net1.exe
C:\Windows\System32\net.exe
C:\Windows\System32\mstsc.exe
C:\Windows\System32\mshta.exe
C:\Windows\System32\mountvol.exe
C:\Windows\System32\logoff.exe
C:\Windows\System32\ipconfig.exe
C:\Windows\System32\help.exe
C:\Windows\System32\gpupdate.exe
C:\Windows\System32\ftp.exe
C:\Windows\System32\format.com
C:\Windows\System32\finger.exe
C:\Windows\System32\find.exe
C:\Windows\System32\doskey.exe
C:\Windows\System32\cscript.exe
C:\Windows\System32\cmd.exe
C:\Windows\System32\cacls.exe
C:\Windows\System32\attrib.exe
C:\Windows\System32\at.exe
C:\Windows\System32\arp.exe
########################################################################################
echo 系统服务优化
echo ==========================================================
echo Background Intelligent Transfer Service 使用空闲网络带宽在后台传送文件。
echo 关闭TCP/IP NetBIOS Helper 提供 TCP/IP (NetBT) 服务上的 NetBIOS 和网络上客户端的 NetBIOS 名称解析的支持
echo 关闭Network Location Awareness网络访问保护(NAP)代理服务
echo 关闭Remote Registry 远程修改注册表
echo 关闭Print Spooler 将文件加载到内存供稍后打印
echo 关闭Distributed Link linktracking client 用于局域网更新连接信息
echo 关闭Shell Hardware Detection 为自动播放硬件事件提供通知。
echo 关闭Windows Update 启用检测、下载和安装 Windows 和其他程序的更新。
########################################################################################
echo 网络安全优化[修改注册表]
#网络安全优化[修改注册表]
135端口主要用于使用远程过程调用,服务器上一般不建议开启
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole]
"EnableDCOM"="Y"
"EnableDCOM"="N"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc]
"DCOM Protocols"=hex(7):6e,00,63,00,61,00,63,00,6e,00,5f,00,69,00,70,00,5f,00,\
74,00,63,00,70,00,00,00,00,00
"DCOM Protocols"=hex(7):
[HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys]
"Flags"="510"
"Flags"="506"
445端口控制在局域网中轻松访问各种共享文件夹或共享打印机,服务器上一般不建议开启
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\NetBT\Parameters]
"SMBDeviceEnabled"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters]
"SMBDeviceEnabled"=dword:00000000
IPC空连接可以使连接者与目标主机建立一个空的连接而无需用户名与密码,存在风险建议关闭
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa]
"restrictanonymous"=dword:00000000
"restrictanonymous"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"restrictanonymous"=dword:00000000
"restrictanonymous"=dword:00000001
配置Backlog,提高网络并发性及网络的处理能力
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\AFD\Parameters]
"EnableDynamicBacklog"=dword:00000001
"MinimumDynamicBacklog"=dword:00000014
"MaximumDynamicBacklog"=dword:00004e20
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\AFD\Parameters]
"EnableDynamicBacklog"=dword:00000001
"MinimumDynamicBacklog"=dword:00000014
"MaximumDynamicBacklog"=dword:00004e20
通过优化该选项可提高系统防御SYN攻击的能力,建议优化
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services]
"SynAttackProtect"=dword:00000001
"EnableDeadGWDetect"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"SynAttackProtect"=dword:00000002
"TCPMaxPortsExhausted"=dword:00000005
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services]
"SynAttackProtect"=dword:00000001
"EnableDeadGWDetect"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"SynAttackProtect"=dword:00000002
"TCPMaxPortsExhausted"=dword:00000005
通过优化设置SYN-ACK等待时间,可提高系统的网络性能
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"TcpMaxConnectResponseRetransmissions"=dword:00000002
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"TcpMaxConnectResponseRetransmissions"=dword:00000002
抵御SNMP攻击,检查无效网关,以便优化网络
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"EnableDeadGWDetect"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"EnableDeadGWDetect"=dword:00000000
抵御ICMP攻击,检查有可能用以攻击的ICMP重定向报文
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"EnableICMPRedirects"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"EnableICMPRedirects"=dword:00000000
检查TCPIP协议栈IGMP堆栈溢出本地拒绝服务攻击
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"IGMPLevel"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"IGMPLevel"=dword:00000000
检查是否禁止IP源路由,建议丢弃所有接受的源路由包
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"DisableIPSourceRouting"=dword:00000002
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"DisableIPSourceRouting"=dword:00000002
禁止路由发现功能,ICMP路由通告报文可以被用来增加路由表纪录,可以导致攻击
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"PerformRouterDiscovery"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters\Interfaces]
"PerformRouterDiscovery"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"PerformRouterDiscovery"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces]
"PerformRouterDiscovery"=dword:00000000
更改ping命令返回的默认TTL值。黑客可通过些值判断操作系统类型
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"DefaultTTL"=dword:000000f0
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"DefaultTTL"=dword:000000f0
优化计算机在收到名称释放请求时是否释放其NETBIOS名称,使计算机受恶意的名称释放攻击
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\NetBT\Parameters]
"NoNameReleaseOnDemand"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters]
"NoNameReleaseOnDemand"=dword:00000001
优化TCP闲置链接检查时间,提升网络性能
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"KeepAliveTime"=dword:000493e0
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"KeepAliveTime"=dword:000493e0
禁止进行最大包长度路径检测。如开启该功能,攻击者可能将数据包强制分段,这公使堆栈不堪重负
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"EnablePMTUDiscovery"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"EnablePMTUDiscovery"=dword:00000000
优化TCP半连接相关参数值,提升网络性能
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"TcpMaxHalfOpen"=dword:000001f4
"TcpMaxHalfOpenRetried"=dword:00000190
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"TcpMaxHalfOpen"=dword:000001f4
"TcpMaxHalfOpenRetried"=dword:00000190
设置TCP重传单个数据段的次数。缺少项值为5,缺省这一过程消耗时间240秒。微软站点安全推荐为3
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"TcpMaxDataRetransmissions"=dword:00000002
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"TcpMaxDataRetransmissions"=dword:00000002
禁止转发IP多播数据包。多播数据包可能被多台主机响应,从而导致响应淹没网络
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"EnableMulticastForwarding"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"EnableMulticastForwarding"=dword:00000000
屏蔽网络拓扑结构细节,防止攻击者利用主机响应来了解内部网络情况
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters]
"EnableAddrMaskReply"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"EnableAddrMaskReply"=dword:00000000
########################################################################################
echo 禁用所有IPV6组件,除IPV6环回接口
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters" /v DisabledComponents /t REG_DWORD /d 0xffffffff /f
########################################################################################
echo 删除系统默认共享
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\parameters" /v AutoShareServer /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\parameters" /v AutoShareWks /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v RestrictAnonymous /t REG_DWORD /d 1 /f
########################################################################################
echo 卸载regsvr32.dll组件
regsvr32 /u shell32.dll >>log.log
echo 卸载regsvr32.dll组件完毕
########################################################################################
echo 组策略优化
echo ================备份组策略到当前目录====================
secedit /export /cfg ./gpedit_bak.inf
echo ================恢复组策略优化后文件====================
secedit /configure /db temp.sdb /cfg ./gpedit_setup.inf
########################################################################################
echo 关闭防火墙
netsh advfirewall set allprofiles state off
#########################################################################################
echo 组策略优化内容
本地策略——>安全选项
计算机配置-->Windows设置-->安全设置-->本地策略-->安全选项
交互式登陆:不显示最后的用户名 启用
网络访问:不允许SAM帐户的匿名枚举 启用 已经启用
网络访问:不允许SAM帐户和共享的匿名枚举 启用
网络访问:不允许储存网络身份验证的凭据 启用
网络访问:可匿名访问的共享 内容全部删除
网络访问:可匿名访问的命名管道 内容全部删除
网络访问:可远程访问的注册表路径 内容全部删除
网络访问:可远程访问的注册表路径和子路径 内容全部删除
帐户:重命名来宾帐户 这里可以更改guest帐号
帐户:重命名系统管理员帐户 这里可以更改Administrator帐号
=================================================================
安全设置-->账户策略-->账户锁定策略
在运行中输入gpedit.msc回车,打开组策略编辑器,选择计算机配置-->Windows设置-->安全设置-->账户策略-->账户锁定策略,将账户锁定阈值设为“三次登陆无效”,“锁定时间为30分钟”,“复位锁定计数设为30分钟”。
=================================================================
计算机配置-->Windows设置-->安全设置-->本地策略-->用户权限分配
关闭系统:只有Administrators组、其它全部删除。
通过终端服务拒绝登陆:加入Guests组、NETWORK SERVICE
通过终端服务允许登陆:加入Administrators、Remote Desktop Users组,其他全部删除
########################其它可以手动操作的设置###########################
1、安装安全防护软件,比如安全狗。
2、新系统一定要先打上补丁
3、开启防水墙
4、安装杀毒软件
5、防火墙禁PING
6、修改administrator,guest 用户名称
7、密码用数字、大小写字母、符号组成,并且密码长度在14位以上。
8、guest用户设置复杂密码
|