Linux漏洞修复:禁用外来的ICMP timestamp和禁止Traceroute探测

扫描工具:绿盟

系统:centos7

漏洞一:ICMP timestamp请求响应漏洞

CVE编号:CVE-1999-0524

风险等级:低

详细描述:远程主机会回复ICMP_TIMESTAMP查询并返回它们系统的当前时间。这可能允许攻击者攻击一些基于时间认证的协议。

解决办法:建议您采取以下措施以降低威胁: 在您的防火墙上过滤外来的ICMP timestamp(类型 13)报文以及外出的ICMP timestamp回复报文。

操作需查看是否已配置,防止重复配置时报错,懒得看直接配也行。

iptables(v1.4.21):

查看是否配置:

sudo iptables -L -n

增加配置:

 iptables -A INPUT -p ICMP --icmp-type timestamp-request -j DROP
 iptables -A INPUT -p ICMP --icmp-type timestamp-reply -j DROP

删除配置,-A 换成-D,其他保持一致:

iptables -D INPUT -p ICMP --icmp-type timestamp-reply -j DROP

firewalld(0.6.3):

查看是否配置:

sudo firewall-cmd --direct --get-all-rules

新增规则:

sudo firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -p ICMP --icmp-type timestamp-request -m comment --comment "deny ICMP timestamp" -j DROP
sudo firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -p ICMP --icmp-type timestamp-reply -m comment --comment "deny ICMP timestamp" -j DROP

删除规则,将命令中的 --add-rule 换成 --remove-rule:

sudo firewall-cmd --permanent --direct --remove-rule ipv4 filter INPUT 0 -p ICMP --icmp-type timestamp-request -m comment --comment "deny ICMP timestamp" -j DROP

漏洞 二:允许Traceroute探测

CVE编号:CVE-1999-0524

风险等级:低

详细描述:本插件使用Traceroute探测来获取扫描器与远程主机之间的路由信息。攻击者也可以利用这些信息来了解目标网络的网络拓扑。

解决办法:在防火墙出站规则中禁用echo-reply(type 0)、time-exceeded(type 11)、destination-unreachable(type 3)类型的ICMP包。

iptables:

增加配置:

sudo iptables -A INPUT -p ICMP --icmp-type echo-reply -j DROP
sudo iptables -A INPUT -p ICMP --icmp-type time-exceeded -j DROP
sudo iptables -A INPUT -p ICMP --icmp-type destination-unreachable -j DROP

配置永久生效,额。。。我配置完成发现没装服务,自行百度吧。

frewalld:

增加出站规则:

sudo firewall-cmd --permanent --direct --add-rule ipv4 filter OUTPUT 0 -p icmp --icmp-type echo-reply -m comment --comment "block outbound traceroute" -j DROP
sudo firewall-cmd --permanent --direct --add-rule ipv4 filter OUTPUT 0 -p icmp --icmp-type destination-unreachable -m comment --comment "block outbound traceroute" -j DROP
# 也可以根据提供的类型值配置,不过没有名称明确 11=time-exceeded
sudo firewall-cmd --permanent --direct --add-rule ipv4 filter OUTPUT 0 -p icmp --icmp-type 11 -m comment --comment "block outbound traceroute" -j DROP

配置永久生效:

sudo firewall-cmd --reload

最终效果:

出站和入站

方向定义举例常用于
入站(Inbound)指从外部进入设备或网络的数据包一台外网电脑访问你服务器的 80 端口(网站)控制别人是否能访问你的服务
出站(Outbound)指从设备或网络内部发出的数据包你发起访问某个网站、更新系统控制设备是否能访问外部资源

以配置中禁 ping 示例:

场景数据包方向类型是否被阻断结果
别人 ping 你别人入站,你出站 echo-replyICMP type 0被 DROP别人 ping 不通你
你 ping 别人你出站 echo-request,别人入站ICMP type 8没限制ping别人正常

俗称对外隐身策略。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值