Filter out the ICMP timestamp requests (13), and the outgoing ICMP timestamp replies (14) 修复方案

修复方案:过滤 ICMP 时间戳请求(Type 13)和响应(Type 14)

ICMP 时间戳请求(Type 13)和响应(Type 14) 可能被攻击者用于网络探测(如主机发现、时间同步分析),建议在防火墙或主机层面禁用。


1. 检测当前是否允许 ICMP 时间戳

(1)使用 nmap 检测

nmap -Pn --script icmp-timestamp -p 80 your-server.com
  • 如果返回 TIMESTAMP REPLY,说明服务器响应 ICMP 时间戳请求。

(2)使用 tcpdump 抓包

tcpdump -ni eth0 icmp and icmp[0] == 13 or icmp[0] == 14
  • 如果捕获到 ICMP timestamp request/reply,说明流量未被过滤。

2. 禁用 ICMP 时间戳(Type 13/14)

(1)Linux 系统(iptables/nftables)

方法 1:使用 iptables(传统方式)
# 屏蔽入站 ICMP 时间戳请求(Type 13)
iptables -A INPUT -p icmp --icmp-type timestamp-request -j DROP

# 屏蔽出站 ICMP 时间戳响应(Type 14)
iptables -A OUTPUT -p icmp --icmp-type timestamp-reply -j DROP

# 保存规则(Debian/Ubuntu)
iptables-save > /etc/iptables/rules.v4

# 保存规则(RHEL/CentOS)
service iptables save
方法 2:使用 nftables(推荐)
nft add table inet filter
nft add chain inet filter input { type filter hook input priority 0 \; }
nft add chain inet filter output { type filter hook output priority 0 \; }

# 屏蔽 ICMP 时间戳请求和响应
nft add rule inet filter input ip protocol icmp icmp type timestamp-request drop
nft add rule inet filter output ip protocol icmp icmp type timestamp-reply drop

# 持久化规则
nft list ruleset > /etc/nftables.conf

(2)Windows 系统(防火墙)

  1. 打开高级防火墙设置
    • Win + Rwf.msc入站规则新建规则
  2. 自定义规则
    • 规则类型:自定义所有程序
    • 协议类型:ICMPv4 → 高级 → ICMP 类型 13(请求)和 14(响应)
    • 操作:阻止连接
  3. 应用规则

(3)云服务器(AWS/Azure/GCP)

  • AWS Security Group
    • 入站规则:禁止 ICMP Type 13
    • 出站规则:禁止 ICMP Type 14
  • Azure NSG
    • 添加规则拒绝 ICMP 13/14
  • GCP 防火墙规则
    • 创建规则拒绝 icmp:13icmp:14

3. 验证是否生效

(1)再次使用 nmap 检测

nmap -Pn --script icmp-timestamp -p 80 your-server.com

预期结果

  • TIMESTAMP REPLY 响应。

(2)使用 ping -T 测试(Linux)

ping -T tsonly your-server.com

预期结果

  • 无响应或 Request timed out

(3)检查防火墙日志

# iptables 日志(需先启用日志记录)
grep ICMP /var/log/syslog

# nftables 日志
nft list ruleset | grep 'icmp.*drop'

4. 额外加固建议

禁用其他不必要的 ICMP 类型(如 echo-reply 可限制)。
启用防火墙默认拒绝策略

iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT  # 允许出站,按需调整

定期审计网络规则

iptables -L -v -n | grep icmp

📌 总结

  1. 检测:用 nmaptcpdump 确认 ICMP 时间戳是否开放。
  2. 修复:通过防火墙(iptables/nftables/云平台)禁用 Type 13/14
  3. 验证:确保无时间戳请求/响应泄露。

修复后,服务器将不再响应 ICMP 时间戳探测,减少信息暴露风险! 🔒

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值