A
number of ICMP message types used for network management don't
have programs associated with them. These are automatically generated
and interpreted by various programs and network devices.
ICMP message types may also have codes, which contain more
information. For instance, there are a number of codes under
"destination unreachable", including "service
unavailable", "communication administratively
prohibited", and "fragmentation required and Don't
Fragment set". In most cases, the codes within
"destination unreachable" are the only ones of interest;
none of the other widely used ICMP types actually use codes this way
What to do with ICMP messages depends on the message and the
direction it's going in. We've already talked about
"echo request", "echo reply",
"destination unreachable", and "time to live
exceeded" messages. The other ICMP message types you probably
want to allow, both inbound and outbound, are "source
quench" (used by a receiver to tell a sender to "slow
down" because it's sending data too fast) and
"parameter problem" (which is sort of a catch-all code to
return when a problem with packet headers can't be reported any
other way).
any other ICMP message types have the potential to change local
information on your hosts (for example, "redirect" causes
changes to a host's routing tables), so you probably
don't want to allow such messages inbound through your packet
filters.
Even "destination unreachable" can be problematic. Some
attackers send out false "destination unreachable"
messages, which may cause hosts to cut off communications in
progress. (This is a popular attack against people using IRC.) There
is no way to tell a valid "destination unreachable" from
an invalid one, in general, because a "destination
unreachable" can be sent by any machine in the path between the
two hosts. However, most "destination unreachable"
messages can legitimately be sent only at the beginning of a
connection, and it is reasonable for hosts to ignore
"destination unreachable" messages that are not plausible
responses to packets that have been sent.
In general, you want to allow ICMP outbound only when it has the
chance of doing you some good. Both "source quench" and
"parameter problem" are used to get the sending host to
be nicer to you and are worth allowing outbound. Any of the ICMP
types that indicate that the connection can't be made
("destination unavailable", "network
unavailable", "service unavailable",
"destination administratively unavailable", or
"network administratively unavailable", for example) will
help an attacker probe your network without giving you much benefit,
and you may want to block these outbound.