大网数据广告活动
服务器运维问答

Iptables protection against port scanners without DoS vulnerability

· 52CE 我爱测

Archwiki features an article with suggestions for a stateful iptables firewall . They recommend some rules to trick port scanners , but advise that they open up a vulnerability for DoS attacks. In particular, by denying access to…

问题原文

原帖链接 · andresgongora · CC BY-SA 3.0

Archwiki features an article with suggestions for a stateful iptables firewall. They recommend some rules to trick port scanners, but advise that they open up a vulnerability for DoS attacks. In particular, by denying access to IPs that continuously try to access closed ports, a potential attacker could send these packets with a spoofed IP so that my firewall would lock out legitimate users.

The suggested TCP rules are as follows:

# iptables -I TCP -p tcp -m recent --update --rsource --seconds 60 --name TCP-PORTSCAN -j REJECT --reject-with tcp-reset
# iptables -A INPUT -p tcp -m recent --set --rsource --name TCP-PORTSCAN -j REJECT --reject-with tcp-reset

My question is, could I limit the effectiveness of said DoS attack if I add the packet's TTL to the rules? According to iptables' man page:

--rttl: [···] this will narrow the match to only happen when the address is in the list and the TTL of the current packet matches that of the packet which hit the --set rule. This may be useful if you have problems with people faking their source address in order to DoS you via this module by disallowing others access to your site by sending bogus packets to you.

Would it work or am I missing something?

已采纳解答

原帖链接 · B00TK1D · CC BY-SA 3.0

There are a couple of issues with using the TTL option for this purpose. You are essentially proposing using TTL as an additional component of identification when identifying addresses.

However, just as attackers can spoof IPs to lock out legitimate clients, they can also spoof packets' TTL values; anybody can generate packets with arbitrary TTL values, they aren't confined to starting with the assumed initial value.

Also, naturally as network infrastructure changes, the number of hops between you and the attacker will change over time, limiting the practical usefulness of TTL as a unique identifier.

The final problem with this technique is that it is entirely possible that an attacker would happen to have the same number of hops between them and you as there are between many legitimate hosts and you. Therefore even without any TTL spoofing they could probably achieve some level of DoS attack.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-03-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。