Linux漏洞修复:禁用外来的ICMP timestamp和禁止Traceroute探测【测试成功】

艺帆风顺 发布于 2025-04-03 21 次阅读


一、问题背景

    漏洞安全扫描结果如下,并需要进行修复:

二、漏洞修复

1、安装iptables服务

下载安装包,下载地址 http://mirrors.163.com/centos/7/os/x86_64/Packages/
然后使用 rpm 命令安装 

    sudo rpm -Uvh iptables-1.4.21-24.el7.x86_64.rpm sudo rpm -Uvh iptables-services-1.4.21-24.el7.x86_64.rpm

    2、重启iptables服务

    sudo service iptables restart

    3、输入如下命令

    禁用外来的ICMP timestamp和禁止Traceroute探测

      sudo iptables -A INPUT -p ICMP --icmp-type timestamp-request -j DROPsudo iptables -A INPUT -p ICMP --icmp-type timestamp-reply -j DROPsudo iptables -A INPUT -p ICMP --icmp-type time-exceeded -j DROPsudo iptables -A OUTPUT -p ICMP --icmp-type time-exceeded -j DROP

      4、保存规则,使其永久生效

      sudo service iptables save

      5、检查新添加的规则是否生效

      sudo iptables -L -n

      生效的话会显示添加下面几条规则,13,14是ICMP timestamp 请求响应漏洞的规则,11是解决允许Traceroute探测的

        DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 13DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 14DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 11Chain OUTPUT (policy ACCEPT)target prot opt source destination DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 11

        备注:
        修改过的规则保存在/etc/sysconfig/iptables文件下

          # Generated by iptables-save v1.4.21 on Wed Jan 26 16:31:39 2022*filter:INPUT ACCEPT [76:7013]:FORWARD ACCEPT [0:0]:OUTPUT ACCEPT [35:5448]-A INPUT -p icmp -m icmp --icmp-type 13 -j DROP-A INPUT -p icmp -m icmp --icmp-type 14 -j DROP-A INPUT -p icmp -m icmp --icmp-type 11 -j DROP-A OUTPUT -p icmp -m icmp --icmp-type 11 -j DROPCOMMIT# Completed on Wed Jan 26 16:31:39 202

            版权声明:本文内容始发于博客园>作者: cicero,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行可。始发链接:https://www.cnblogs.com/nanqiang/p/15847573.html在此特别鸣谢原作者的创作。此篇文章的所有版权归原作者所有,商业转载建议请联系原作者,非商业转载请注明出处