kern/57760: Psec policy on inbound trafic is not enforced (allows spoofing)

Joachim Schueth dl2kcd at
Wed Oct 8 11:00:34 PDT 2003

>Number:         57760
>Category:       kern
>Synopsis:       Psec policy on inbound trafic is not enforced (allows spoofing)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 08 11:00:22 PDT 2003
>Originator:     Joachim Schueth <dl2kcd at>
>Release:        FreeBSD 4.8-RELEASE-p13 i386
System: FreeBSD 4.8-RELEASE-p13 i386

A host with an IPsec policy that requires ESP with authentication or AH
on inbound traffic accepts plain IP packets that carry no authentication.
This allows to bypass the IPsec authentication mechanism.

The following example uses ESP with authentication, but the effect is
the same with AH.

Configure two hosts running FreeBSD 4.8-RELEASE-p13 with IP addresses
of and, respectively (called host26 and host42
below). On host42 (the target host), use the following setkey script:

 add esp 0x026042
    -E 3des-cbc  "xxxxxxxxxxxxxxxxxxxxxxxx"
    -A hmac-sha1 "hhhhhhhhhhhhhhhhhhhh";
 add esp 0x042026
    -A hmac-sha1 "rrrrrrrrrrrrrrrrrrrr";
 spdadd any -P in  ipsec esp/transport//require;
 spdadd any -P out ipsec esp/transport//require;

On host26 (the attacking host), use the same setkey script but omit the
spadd lines. This means that host26 has the correct security associations
to accept the ESP packets of host42, but host26 itself will not use ipsec
on outgoing packets.

Then establish a TCP connection between host26 and host42, e.g. by
connecting host42 from host26 via ftp. The connection succeeds, and
a network dump shows ESP from host42 to host26, but plain TCP packets
in the other direction. These packets are accepted by host42 despite the
-P in .../require policy which is essentially ignored. Thus, an attacker
could inject spoofed packets into an ESP connection simply by omitting
the IPsec elements. The same behaviour is observed when AH is used.

Note that ICMP ping packets are apparently dropped as expected, but not
TCP packets.

This has to be fixed in the kernel. As a workaround, ipfw may be used to
limit non-IPsec traffic.


More information about the freebsd-bugs mailing list