🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.bugs
1 messages
1 total messages Started by bugzilla-noreply Wed, 02 Dec 2026 21:34
[Bug 122562] [ipsec] IPsec AH tunneled packet mis handling?
#886
Author: bugzilla-noreply
Date: Wed, 02 Dec 2026 21:34
74 lines
5575 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=122562

--- Comment #4 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=cefc83b7fdb829ec4382e4ad5c05454d1d216e38

commit cefc83b7fdb829ec4382e4ad5c05454d1d216e38
Author:     R. Christian McDonald <rcm@FreeBSD.org>
AuthorDate: 2026-12-02 21:32:48 +0000
Commit:     R. Christian McDonald <rcm@FreeBSD.org>
CommitDate: 2026-12-02 21:32:48 +0000

    netinet6: Keep the AH flags on the inner packet of a tunnel mode SA

    ip6_input() clears M_AUTHIPHDR and M_AUTHIPDGM on every packet. The
    inner packet of a tunnel mode AH SA reaches it through netisr after
    ipsec[46]_common_input_cb() has stripped the outer header, so it loses
    the flags that ah_input_cb() set after verifying the ICV. The inbound
    policy check in ipsec_in_reject() then finds no AH flag on a packet
    whose policy requires AH and drops it as a policy violation ("inbound
    packets violated process security policy" in netstat -sp ipsec6). With
    the usual "require" level, every IPv6 packet carried by a policy-based
    AH tunnel is dropped, whatever the outer address family. ESP is not
    affected, since M_DECRYPTED is not cleared, and neither are IPv4 inner
    packets, since ip_input() has never cleared the flags. if_ipsec(4) is
    not involved, since it only uses ESP.

    net.inet.ipsec.check_policy_history does not help: ipsec_in_reject()
    checks the flags in addition to the history tags.

    The clearing comes from KAME, whose ah6_input() deliberately did not
    consider the inner packet authentic and cleared the flags itself. The
    comment refers to ah4_input(), removed with the rest of the KAME IPsec
    code in e66ff7fc8e12. Fast IPsec marks the inner packet authenticated,
    since the ICV of a tunnel mode SA covers it entirely, and its IPv4 path
    has relied on that from the start. Drop the clearing, as PR 122562
    proposed in 2008.

    The only other user of the flags is nd6_ra_input(), which treats a
    Router Advertisement with both set as authenticated and lets it reduce
    the valid lifetime of a prefix below two hours. A Router Advertisement
    carried by a tunnel mode AH SA now qualifies. This changes little, since
    the peer of the SA could already send Router Advertisements that are
    accepted without the flags.

    Add an AH tunnel test to the netipsec tunnel suite; the inet6 case fails
    without this change. ist_setkey() in utils.subr now emits AH SAs and
    policies when no encryption algorithm is given, and ist_test() quotes
    its argument list so that empty arguments reach it.

    PR:                     122562
    Reviewed by:            kib
    MFC after:              2 weeks
    Sponsored by:           Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D62099

 sys/netinet6/ip6_input.c                           | 12 -------
 tests/sys/netipsec/tunnel/Makefile                 |  1 +
 .../sys/netipsec/tunnel/ah_hmac_sha2_256.sh (new)  | 42 ++++++++++++++++++++++
 tests/sys/netipsec/tunnel/utils.subr               | 22 +++++++-----
 4 files changed, 57 insertions(+), 20 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads