web-dev-qa-db-ja.com

ICMPリダイレクトとは何ですか?ブロックする必要がありますか?

UfwとTigerのセキュリティ監査を有効にすると、次のような警告が表示されます。

The system accepts ICMP redirection messages

ICMPリダイレクトメッセージとは何ですか?セキュリティの目的で無効にする必要がありますか?もしそうなら、UFWファイアウォールを使用してそれを行う正しい方法は何ですか?

21
jrdioko

この記事による

ICMPパケットを使用してネットワークを攻撃できる特定のケースがあります。この種の問題は今日では一般的ではありませんが、そのような問題が発生する状況があります。これは、ICMPリダイレクトまたはICMPタイプ5パケットの場合です。 ICMPリダイレクトは、ホストの選択に基づいて1つのネットワークからのより良いルーティングパスを指定するためにルーターによって使用されるため、基本的にパケットのルーティング方法と宛先に影響します。

ICMPリダイレクトを介して、ホストはローカルネットワーク内からアクセスできるネットワークと、そのような各ネットワークに使用されるルーターを見つけることができます。セキュリティの問題は、ICMPリダイレクトを含むICMPパケットは偽造が非常に簡単であり、基本的には攻撃者がICMPリダイレクトパケットを偽造するのがかなり容易であるという事実に由来しています。

その後、攻撃者は基本的にホストのルーティングテーブルを変更し、選択したパス上の外部ホストにトラフィックを分散できます。新しいパスは、ルーターによって10分間アクティブに保たれます。この事実とこのようなシナリオに伴うセキュリティリスクのため、すべてのパブリックインターフェイスからのICMPリダイレクトメッセージを無効にする(無視する)ことをお勧めします。

ファイルを編集する必要があります/etc/sysctl.conf

そして変化

###################################################################
# Additional settings - these settings can improve the network
# security of the Host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0

###################################################################
# Additional settings - these settings can improve the network
# security of the Host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
net.ipv4.conf.all.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
net.ipv4.conf.all.send_redirects = 0

次に、上記のカーネルパラメーターの変更を適用します。

$ Sudo sysctl -p
27
Manish Sinha

転送が無効になっている場合(ルーターではない場合)、net.ipvX.conf.all.accept_redirectsの値は、インターフェース固有の値(例: net.ipvX.conf.eth0.accept_redirects。 send_redirectsは常にORされます。

完全な修正は次のとおりです。

net.ipv4.conf.all.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0

net.ipv4.conf.default.accept_redirects = 0
net.ipv6.conf.default.accept_redirects = 0
net.ipv4.conf.default.send_redirects = 0

「デフォルト」設定を使用するには、ネットワークインターフェイスを再度セットアップする必要があります。

3
Marek