查看端口命令查看所有端口
查看所有端口 netstat -a -n
netstat -a -n|findstr "135"
netstat -a -n|findstr "139"
netstat -a -n|findstr "445"
端口简介
135端口
借助IEen工具能够借助135端口轻松连接到Internet上的其他工作站,并远程控制该工作站的IE浏览器。IEen可以监控到在浏览器中执行的任何操作,包括浏览页面内容、输入帐号密码、输入搜索关键字等,甚至包括在网上银行中输入的各种密码信息。除了可以对远程工作站上的IE浏览器进行操作、控制外,IEen工具通过135端口几乎可以对所有的借助DCOM开发技术设计出来的应用程序进行远程控制,例如IEen工具也能轻松进入到正在运行Excel的计算机中,直接对Excel进行各种编辑操作。
怎么样?135端口对外开放是不是很危险呀?当然,这种危险毕竟是理论上的,要想真正地通过135端口入侵其他系统,还必须提前知道对方计算机的IP地址、系统登录名和密码等。只要你严格保密好这些信息,你的计算机被IEen工具攻击的可能性几乎不存在。
由于该工具采用了一种DCOM技术,所以它可以直接对其他工作站的DCOM程序进行远程控制。DCOM技术与对方计算机进行通信时,会调用目标主机中的RPC服务,而RPC服务将会自动询问目标主机中的135端口,查出当前有哪些端口可以被用来通信。如此一来,目标主机就会提供一个可用的服务端口作为数据传输通道使用。在这一通信过程中,135端口的作用其实就是为RPC通信提供一种服务端口的映射功能。不过现在135基本上已经绝迹了,大家不要担心。
139端口
139端口在你通过网上邻居访问局域网中的共享文件或共享打印机时就能发挥作用。
139端口一旦被Internet上的某个攻击者利用的话,就能成为一个危害极大的漏洞之门哦。黑客要是与目标主机的139端口建立连接的话,就很有可能浏览到指定网段内所有工作站中的所有共享信息,甚至可以对目标主机中的共享文件夹进行各种复制、删除等操作,倘若攻击者还知道目标主机的IP地址和登录帐号的话,甚至能轻松地查看到目标主机中的隐藏共享信息。
445端口
445端口在Windows 2000 Server或Windows Server 2003系统中发挥的作用与139端口是完全相同的。它提供局域网中文件或打印机共享服务。不过该端口是基于CIFS协议(通用因特网文件系统协议)工作的,而139端口是基于SMB协议(服务器协议族)对外提供共享服务。虽然2个端口服务不同,但是攻击者与445端口建立请求连接,也能获得指定局域网内的各种共享信息。
关闭139端口
选中网上邻居->右键->本地连接->Internet协议(TCP/IP)->属性->高级->WINS,选择“禁止TCP/IP上的NetBIOS”,并且不选中“启用LMHOSTS查询”,因为它是NETBIOS准备的,重启
关闭445端口
a) 单击始——运行输入regedit单击确定按钮打注册表
b) 找注册表项HKEY_LOCAL_MACHINE\System\Controlset\Services\NetBT\Parameters
c) 选择Parameters项右键单击选择新建——DWORD值orQWORD值(32位系统选择DWORD值64位系统选择QWORD值)
d) DWORD值命名SMBDeviceEnabled
e) 右键单击SMBDeviceEnabled值选择修改
f) 现编辑DWORD值框数值数据输入0单击确定按钮完设置
修改完重启机器CMD运行netstat -an发现445端口已经再Listening
关闭135端口
一共4步骤:禁用RPC依赖服务、禁用DCOM、配置RPC、修补RPC服务器1,禁用RPC依赖服务
我的电脑->右键属性-->服务
关闭和禁用下面服务
SSDP Discovery Service
Windows Time
Messenger
Remote Registry
System Event Notification
Remote Desktop Help Session Manager
Distributed Transaction Coordinator
Task Scheduler service
COM+ Event System
COM+ System Application
2,禁用DCOM
第一种方式
a, Run "Dcomcnfg.exe" from the Start menu "Run." item.
b,Select the following: Component Services -> Computers -> My Computer
c,Right Click and select the Properties menu item
d,Select the Default Properties tab
Uncheck "Enable Distributed COM on this computer" option.
e,Select the Default Protocols tab
Remove "Connection-oriented TCP/IP" from the list of DCOM protocols.
第二种方法通过修改注册表
a:Run "regedt32.exe" from the Start menu "Run." item.
b:Select the key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole"
Set the value "EnableDCOM" to "N".
c:Select the key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc"
Edit the value "DCOM Protocols". This may contain a number of strings.
Delete the string "ncacn_ip_tcp"
3:配置RPC
需要windows Server 2003 Resource Kit tools中rpccfg.exe
下载 rktools.exe 并安装
The idea is to get RPC to only bind to the loopback address.
From the DOS command prompt type: rpccfg -l
This will list the available interfaces. Make a note of the number next to the subnet 127.0.0.0, which will probably 1.
Now type: rpccfg -a 1 (or the number you noted before).
Now type: rpccfg -q and only the loopback address should be listed.
To complete the configuration the following setting needs to be added to the Registry:
Run "regedt32.exe" from the Start menu "Run." item.
Select the key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RpcSs"Add the string value "ListenOnInternet" and set it to "N".
操作完成后重启机器,查看135端口是否关闭,如果没有关闭再执行下面操作4:修补RPC服务器
So you will first have to disable it, re-boot, patch it, re-enable it and reboot again.
Make a copy of the file rpcss.dll, as a backup.Copy the file from \windows\system32\rpcss.dll into one of your own directories, using Windows Explorer.
From the Start menu select Run.
Enter "regedt32" and click on OK.
Expand the tree and select the key:HKLM\System\CurrentControlSet\Services\RpcSs
Rename the value "ImagePath" to "xImagePath"
Exit regedt32 and re-boot the machine. The machine may take longer than normal to start up and some functionality will no longer be available. The Start bar may longer be visible to it is a good idea to have a short cut to a DOS BOX on the desktop. This will be re-enabled later.
Run your hex editor and open the file "from \windows\system32\rpcss.dll" //对于64位操作系统,如果编辑器找不到rpcss.dll文件需要 启动系统 -》 把rpcss.dll复制到c:\ -》 010editor修改 -》改注册表 -》msconfig诊断模式 -》重启 -》打开cmd执行 move c:\rpcss.dll "c:\windows\system32\" 并确认 -》还原注册表 -》msconfig正常启动-》重启
Search for the byte sequence "31 00 33 00 35" or the Unicode text "135".
Over-write this byte sequence to "30 00 30 00 30". This changes the port from 135 to 000, which DCOM will not be able to open.
Save the file in the hex editor. //备注使用这个软件打开HxD.exe 如果无法编辑rpcss.dll,需要执行:开始-->运行-->msconfig,选择诊断启动。修改完成后在执行msconfig,选择正常启动;
From the Start menu select Run.
Enter "regedt32" and click on OK.
Expand the tree and select the key:HKLM\System\CurrentControlSet\Services\ RpcSs
Rename the value "xImagePath" to "ImagePath"
Exit regedt32 and re-boot the machine.
The DCOM server should no longer bind to port 135 and KFSensor should be listening to this port.
以下是相关操作文件链接
https://blog.51cto.com/jafy00/621874 通过IP策略关闭端口
https://liuqiang5151.iteye.com/blog/1141050
http://m.850500.com/news/70171.html