CVE-2026-143292: tcp: wait for TIME_WAIT teardown before freeing per-netns ehash

Published Dec 3, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

tcp: wait for TIMEWAIT teardown before freeing per-netns ehash

inettwskkill() removes a TIMEWAIT socket from the established hash before it finishes using the ehash lock, hashinfo and bind tables, and before it drops the death-row reference. A running timer can therefore unhash its socket before inettwskpurge() reaches it. The purge cannot synchronize with that timer, and tcpskexitbatch() can free the private ehash and hashinfo while inettwskkill() is still using them.

An unprivileged reproducer using user and network namespaces, a private TCP ehash and a FINWAIT2 timer triggers a KASAN slab-use-after-free in inettwskkill(). The allocation and free stacks point to inetpernethashinfoalloc() and inetpernethashinfofree().

Wait for an RCU grace period after purging the whole batch, if one netns in the batch uses a private ehash. TIMEWAIT removal runs with bottom halves disabled, so this also waits for removers that were already invisible to the purge. Keep the wait under tcpexitbatchmutex, before freeing any private hashinfo.

The same window exists with the shared tcphashinfo. There, the hashinfo memory stays valid, but tcpskexitbatch() can decrement tcpdeathrow.twrefcount from 2 to 1 before inettwskkill() drops its own reference. This triggers the WARNONONCE() in tcpskexitbatch(), then a refcountt "decrement hit 0" warning from inettwskkill().

Adding a grace period for the shared case would be costly on busy hosts. It is not needed: struct net is freed by a later cleanupnet(), after the synchronizercu() in opsundolist(), so inettwskkill() can safely drop the last twrefcount reference itself. Use refcountdecifone() and only warn if twrefcount is not 1 after a grace period.

[edumazet: only call synchronizenet() if one netns in the batch uses a private ehash, use refcountdecifone() to avoid a false WARN with the shared ehash]

Affected Software

1 affected component
Linux Linux kernel

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Compensating control

    After purging the whole batch, wait for an RCU grace period before freeing private per-netns ehash/hashinfo; call synchronize_net() when a netns in the batch uses a private ehash.

  2. Compensating control

    In tcp_sk_exit_batch(), use refcount_dec_if_one() and warn only if tw_refcount is not 1.

Event History

Dec 3, 2026
CVE Published
via MITRE·09:21 AM
Data Sourced
via MITRE·09:21 AM
Description

Frequently Asked Questions

1

What conditions are needed to trigger the use-after-free?

The described reproducer is unprivileged and uses user and network namespaces, a private TCP ehash, and a FIN_WAIT2 timer. The race occurs when a TIME_WAIT timer removes a socket while network-namespace TCP teardown is purging sockets and freeing hash structures.

2

Are systems using the shared TCP hash information also affected?

Yes. The description states that the same race window exists when using the shared tcp_hashinfo, although the explicitly described reproducer uses a private TCP ehash.

3

How can administrators determine whether the fault has occurred?

The reported manifestation is a KASAN slab-use-after-free in inet_twsk_kill(). The allocation and free stacks point to inet_pernet_hashinfo_alloc() and inet_pernet_hashinfo_free(), respectively.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203