M.R*_*aei 1 security linux apache-2.2
扫描服务器端口时如何在linux上隐藏Web服务器名称和openssh版本?
当我从外部使用nmap'ed( nmap -A -T4 192.168.40.12 ) ip 服务器时,显示:
Starting Nmap 4.62 ( http://nmap.org ) at 2009-11-05 14:11 IRST
LUA INTERPRETER in nse_init.cc:763: /usr/share/nmap/scripts/robots.nse:4: module 'http' not found:
no field package.preload['http']
no file '/usr/share/nmap/nselib/http.lua'
no file './http.lua'
no file '/usr/local/share/lua/5.1/http.lua'
no file '/usr/local/share/lua/5.1/http/init.lua'
no file '/usr/local/lib/lua/5.1/http.lua'
no file '/usr/local/lib/lua/5.1/http/init.lua'
no file '/usr/lib/nmap/nselib-bin/http.so'
no file './http.so'
no file '/usr/local/lib/lua/5.1/http.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
SCRIPT ENGINE: Aborting script scan.
Interesting ports on 192.168.40.12:
Not shown: 1710 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh **OpenSSH 3.9p1** (protocol 1.99)
53/tcp open domain dnsmasq 2.47
80/tcp open http **Apache httpd**
222/tcp open ssh **OpenSSH 3.9p1** (protocol 1.99)
8081/tcp open http CherryPy httpd 2.3.0
MAC Address: 00:10:F3:0F:59:B7 (Nexcom International Co.)
Device type: firewall
Running: IPCop Linux 2.4.X
OS details: IPCop firewall 1.4.10 - 1.4.15 (Linux 2.4.31 - 2.4.34)
Network Distance: 1 hop
OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 8.032 seconds
Run Code Online (Sandbox Code Playgroud)
我修改了 httpd.conf 并更改了两行
ServerSignature Off
ServerTokens Prod
Run Code Online (Sandbox Code Playgroud)
并重新启动 apache 服务器,但它仍然显示我的 apache 名称
任何人都可以帮我解决这个问题!
对于 OpenSSH,请尝试以下操作:
me@lappy:~# ncat 192.168.0.222 22
SSH-2.0-OpenSSH_5.1p1 Debian-3ubuntu1
Run Code Online (Sandbox Code Playgroud)
酷没有漏洞或任何东西,但让我们编辑它只是为了好玩。首先让我们制作一份 sshd 的副本来使用。
root@mohsen-desktop:~# mkdir tmp
root@mohsen-desktop:~# cd tmp
root@mohsen-desktop:~/tmp# cp /usr/sbin/sshd .
Run Code Online (Sandbox Code Playgroud)
现在让我们修改它。
root@mohsen-desktop:~/tmp# hexedit sshd
Run Code Online (Sandbox Code Playgroud)
好的,应该会弹出一个蓝色窗口,现在查看底部并注意命令。我们想使用搜索,所以按 control+w 确保“搜索文本字符串”是白色的。现在输入“OpenSSH”按回车键,您将被定向到您需要修改的确切部分。
它看起来像这样,只需将红色的所有内容更改为 0,您就会得到我下面的内容。如果您想输入其他内容,请按 TAB 并在 ascii 部分输入您想要的内容,请记住没有退格。
00053FE0 6E 64 2D 6C 69 6E 65 00 4F 70 65 6E 53 53 48 5F nd-line.OpenSSH_
00053FF0 35 2E 31 70 31 20 44 65 62 69 61 6E 2D 33 75 62 5.1p1 Debian-3ub
00054000 75 6E 74 75 31 00 25 73 2C 20 25 73 0A 00 4B 52 untu1.%s, %s..KR
Run Code Online (Sandbox Code Playgroud)
它现在应该是这样的。
00053FE0 6E 64 2D 6C 69 6E 65 00 4F 70 65 6E 53 53 48 00 nd-line.OpenSSH.
00053FF0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00054000 00 00 00 00 00 00 25 73 2C 20 25 73 0A 00 4B 52 ......%s, %s..KR
Run Code Online (Sandbox Code Playgroud)
当您完成点击 control+x 以保存它并启动它时,请记住它需要确切的路径。
root@mohsen-desktop:~/tmp# /root/tmp/sshd
root@mohsen-desktop:~/tmp# ncat localhost 22
SSH-2.0-OpenSSH
Run Code Online (Sandbox Code Playgroud)
只要确保您可以连接到它并且一切顺利。
killall sshd
rm /usr/sbin/sshd
mv /root/tmp/sshd /usr/sbin/
Run Code Online (Sandbox Code Playgroud)
要隐藏 Web 服务器名称,您应该编译源 apache 并在其中编辑 conf 文件。
我不相信您可以从 NMap 隐藏服务器类型,因为它足够聪明,可以通过握手协商、故障处理等检测软件类型。至于 OpenSSH,来自常见问题解答:
2.14 - 为什么 OpenSSH 向客户端报告其版本?
OpenSSH 与大多数 SSH 实现一样,在客户端连接时向客户端报告其名称和版本,例如
SSH-2.0-OpenSSH_3.9
客户端和服务器使用此信息来启用协议兼容性调整,以解决他们正在与之交谈的实现中已更改、错误或缺失的功能。由于 SSH 协议尚未作为 RFC 发布,并且在此之前可能会进行更多不兼容的更改,因此目前仍需要进行此协议特性检查。
如果你真的想修补 SSH 以防止版本显示,这里是如何做(个人未经测试),这里是对你心态的描述(通过默默无闻的安全性,优点和缺点),这就是为什么我认为它不好以及为什么Bruce Schneier有时认为它是好的,而其余时间则认为它是坏的。
| 归档时间: |
|
| 查看次数: |
17936 次 |
| 最近记录: |