Back to Intelligence

Ubuntu LSN-0121-1: ksmbd Use-After-Free and nf_conntrack_h323 Flaws Patched via Kernel Livepatch — Detection and Remediation Guide

SA
Security Arsenal Team
August 28, 2026
11 min read

Canonical has published Kernel Live Patch Security Notice LSN-0121-1, resolving three distinct Linux kernel vulnerabilities — two use-after-free conditions in ksmbd, the in-kernel SMB3 server, and a length-validation defect in the netfilter H.323 connection tracking helper (nf_conntrack_h323). Because these flaws live in kernel code paths reachable from the network, any Ubuntu host running ksmbd or the H.323 conntrack helper should be treated as exposed until the livepatch is applied or the kernel is updated.

This matters more than a routine kernel update notice. ksmbd has matured into a realistic attack surface: it listens on TCP/445 (SMB), handles unauthenticated protocol parsing before session setup, and runs in ring 0. A use-after-free in that context is not an application crash — it is a kernel memory-corruption primitive with a direct line to privilege escalation or host compromise. The H.323 helper, meanwhile, processes attacker-controlled packet bytes from the network data plane. Both deserve immediate triage in your vulnerability queue.

What LSN-0121-1 Actually Fixes

The notice (https://ubuntu.com/security/notices/LSN-0121-1) bundles three kernel fixes. No CVE identifiers were enumerated in the summary text of the notice, and no public in-the-wild exploitation has been confirmed at time of writing — but kernel UAF bugs in network-facing parsers historically move from fix to PoC quickly, so defenders should not wait for a proof of concept to act.

1. ksmbd IPC use-after-free — ipc_msg_send_request()

ipc_msg_send_request() waits for a generic netlink reply using an ipc_msg_table_entry allocated on the stack. The defect: if the waiting function times out or returns while the entry is still registered in the global IPC message table, a later netlink reply (or a racing kernel thread) can dereference a pointer into a dead stack frame — a classic use-after-free against stack memory.

From a defensive standpoint, the important properties:

  • Attack surface: ksmbd's IPC channel is how the kernel module talks to the ksmbd.mountd userspace daemon (share enumeration, session/user lookups). It is exercised during normal SMB client activity, meaning unauthenticated or low-authentication SMB traffic drives this code path.
  • Impact class: kernel memory corruption → denial of service (kernel oops/panic) at minimum; potentially exploitable for privilege escalation given the stack-based primitive.
  • Exploitation requirements: the host must be running the ksmbd kernel module with an active ksmbd.mountd daemon, i.e., the box is serving SMB via the kernel server rather than Samba.

2. ksmbd share_conf use-after-free in compound requests

smb2_get_ksmbd_tcon() reuses work->tcon across SMB2 compound requests without validating tcon->t_state. In a compound request chain, a tree connect can be torn down (e.g., via a SMB2_TREE_DISCONNECT or LOGOFF in the same chain) and then reused by a subsequent operation in the same compound — leaving share_conf pointing at freed memory.

This is the more dangerous of the two ksmbd bugs from an exploitation-theory perspective: SMB2 compound requests are a protocol-level feature reachable by any client that can open a TCP session to port 445 — no valid credentials are strictly required to reach the compound-parsing logic, and tree state manipulation is a well-trodden kernel-SMB attack pattern.

3. netfilter nf_conntrack_h323 — zero-length underflow in DecodeQ931()

In DecodeQ931(), the UserUserIE code path reads a 16-bit length field from the packet, then decrements it by 1 to skip the protocol discriminator byte before handing the buffer to DecodeH323_UserInformation(). If an attacker supplies a length of zero, the decrement underflows to 65535, and the downstream decoder processes a wildly out-of-bounds buffer.

Key exposure notes:

  • The H.323 conntrack/NAT helper is only active if the nf_conntrack_h323 module is loaded and either automatic helper assignment is enabled or an explicit -j CT --helper h323 netfilter rule exists. Most modern distros disable automatic helper assignment by default (net.netfilter.nf_conntrack_helper=0), which sharply reduces real-world exposure.
  • Where it is enabled — VoIP gateways, SBC-adjacent Linux firewalls, legacy PBX infrastructure — this is remotely triggerable with crafted H.225/Q.931 traffic (typically TCP/UDP 1720).

Affected Products and Platforms

  • Ubuntu LTS kernels covered under Canonical's Kernel Livepatch service (Ubuntu Pro / Ubuntu Advantage livepatch subscribers receive the fix without reboot; see the notice for the exact kernel ABIs covered).
  • Any Ubuntu system running the ksmbd kernel module with ksmbd-tools (ksmbd.mountd) — common on embedded NAS builds and minimal file-serving appliances.
  • Any Ubuntu system with nf_conntrack_h323 loaded or an explicit H.323 CT helper rule in nftables/iptables.

Exploitation status: No public PoC, no confirmed in-the-wild exploitation, and no CISA KEV entry at time of publication. Treat as patch-now theoretical — which is exactly the window where remediation is cheapest.

Detection & Response

The most defensible detection posture here is twofold: (1) find the attack surface — hosts loading ksmbd or nf_conntrack_h323 that you didn't know about — and (2) watch for kernel-level crash artifacts consistent with UAF/OOB exploitation attempts. Both are high-signal, low-noise.

SIGMA Rules

YAML
---
title: ksmbd Kernel SMB Server Module Loaded or Daemon Started
id: 1b7c2f44-9a3e-4d51-b6a2-8e1f0c4d5a7b
status: experimental
description: Detects loading of the ksmbd kernel module or execution of the ksmbd.mountd userspace daemon. ksmbd exposes an in-kernel SMB3 parser on TCP/445 and was patched for multiple use-after-free flaws in Ubuntu LSN-0121-1. Unauthorized ksmbd activation should be investigated as either shadow service deployment or attacker setup of a kernel-level file-sharing primitive.
references:
  - https://ubuntu.com/security/notices/LSN-0121-1
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.persistence
  - attack.lateral_movement
  - attack.t1021.002
logsource:
  product: linux
  category: process_creation
detection:
  selection_module:
    CommandLine|contains:
      - 'modprobe ksmbd'
      - 'insmod ksmbd'
  selection_daemon:
    Image|endswith:
      - '/ksmbd.mountd'
      - '/ksmbd.adduser'
  condition: 1 of selection_*
falsepositives:
  - Legitimate NAS/file-serving appliances intentionally running ksmbd
level: high
---
title: H.323 Netfilter Conntrack Helper Loaded
id: 3e9d1a56-7c4b-4f28-a9e3-2d6b8f0c1e94
status: experimental
description: Detects loading of the nf_conntrack_h323 kernel module or explicit assignment of the H.323 conntrack helper. The helper parses attacker-controlled Q.931 packet data and was patched for a zero-length underflow in DecodeQ931() (Ubuntu LSN-0121-1). Its presence outside of known VoIP gateway infrastructure warrants investigation.
references:
  - https://ubuntu.com/security/notices/LSN-0121-1
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.defense_evasion
  - attack.t1210
logsource:
  product: linux
  category: process_creation
detection:
  selection_modprobe:
    CommandLine|contains:
      - 'modprobe nf_conntrack_h323'
      - 'insmod nf_conntrack_h323'
  selection_helper:
    CommandLine|contains:
      - '--helper h323'
      - 'ct helper h323'
  condition: 1 of selection_*
falsepositives:
  - VoIP gateways, SBCs, and PBX infrastructure legitimately using H.323 NAT traversal
level: medium
---
title: Kernel Memory Corruption Signature in ksmbd or H.323 Code Path
id: 5f2a8c13-4d6e-4b79-9c1a-7e3d5b8a2f60
status: experimental
description: Detects kernel log signatures consistent with memory-safety faults (KASAN reports, general protection faults, BUG/Oops) in ksmbd or nf_conntrack_h323 code paths. Repeated occurrences indicate possible exploitation attempts against the use-after-free or out-of-bounds flaws fixed in Ubuntu LSN-0121-1 and should trigger DFIR triage of the host.
references:
  - https://ubuntu.com/security/notices/LSN-0121-1
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.execution
  - attack.t1210
logsource:
  product: linux
  service: kern
detection:
  selection_fault:
    - 'BUG: KASAN'
    - 'use-after-free'
    - 'general protection fault'
    - 'kernel BUG at'
  selection_component:
    - 'ksmbd'
    - 'smb2_get_ksmbd_tcon'
    - 'ipc_msg_send_request'
    - 'nf_conntrack_h323'
    - 'DecodeQ931'
  condition: selection_fault and selection_component
falsepositives:
  - Rare; kernel faults in these subsystems are inherently anomalous on production hosts
level: critical

KQL — Microsoft Sentinel

These assume Linux syslog/CEF ingestion into Sentinel (Syslog table) and MDE-on-Linux coverage (DeviceProcessEvents) where deployed.

KQL — Microsoft Sentinel / Defender
// Hunt 1: ksmbd / H.323 helper module activation and kernel fault indicators (Syslog)
Syslog
| where TimeGenerated > ago(7d)
| where SyslogMessage has_any (
    "modprobe ksmbd", "ksmbd.mountd", "ksmbd.adduser",
    "modprobe nf_conntrack_h323", "--helper h323", "ct helper h323",
    "use-after-free", "general protection fault", "BUG: KASAN")
| project TimeGenerated, Computer, HostIP, ProcessName, SyslogMessage
| order by TimeGenerated desc;

// Hunt 2: Kernel oops/BUG lines referencing the vulnerable subsystems — repeated faults = possible exploit attempts
Syslog
| where TimeGenerated > ago(7d)
| where SyslogMessage has_any ("ksmbd", "nf_conntrack_h323", "DecodeQ931", "smb2_get_ksmbd_tcon", "ipc_msg_send_request")
  and SyslogMessage has_any ("BUG", "Oops", "use-after-free", "protection fault", "Call Trace")
| summarize FaultCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated)
    by Computer, bin(TimeGenerated, 1h)
| where FaultCount >= 2
| order by FaultCount desc;

// Hunt 3 (MDE on Linux): Process execution loading the vulnerable modules
DeviceProcessEvents
| where TimeGenerated > ago(7d)
| where FileName in~ ("modprobe", "insmod", "ksmbd.mountd")
| where ProcessCommandLine has_any ("ksmbd", "nf_conntrack_h323")
| project TimeGenerated, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessAccountName
| order by TimeGenerated desc;

Velociraptor VQL

This hunt artifact inventories exposure across your Linux fleet — which hosts actually have ksmbd or nf_conntrack_h323 loaded, and whether a livepatch is applied — so you can scope remediation precisely instead of guessing.

VQL — Velociraptor
-- Hunt: Inventory ksmbd / nf_conntrack_h323 exposure and livepatch status (Linux)
-- Source 1: loaded kernel modules from /proc/modules
LET modules = SELECT
    split_string(string=Line, sep=" ", max_splits=2)[0] AS ModuleName
FROM read_file(filenames="/proc/modules")
WHERE ModuleName =~ "ksmbd|nf_conntrack_h323"

SELECT
    "loaded_module" AS Finding,
    ModuleName AS Detail,
    timestamp(epoch=now()) AS SeenAt
FROM modules

-- Source 2: check whether Canonical Livepatch reports patches applied
UNION ALL
SELECT
    "livepatch_status" AS Finding,
    stdout AS Detail,
    timestamp(epoch=now()) AS SeenAt
FROM execve(argv=["/usr/bin/canonical-livepatch", "status", "--format", "json"])

Remediation / Verification Script (Bash)

Bash / Shell
#!/bin/bash
# LSN-0121-1 verification and mitigation — Ubuntu hosts
# Run as root. Checks exposure, applies fixes, and reports status.

set -u
echo "=== [1] Checking for vulnerable module exposure ==="

KSMBD_LOADED=$(lsmod | awk '{print $1}' | grep -c '^ksmbd$' || true)
H323_LOADED=$(lsmod | awk '{print $1}' | grep -c '^nf_conntrack_h323$' || true)
HELPER_SYSCTL=$(sysctl -n net.netfilter.nf_conntrack_helper 2>/dev/null || echo "n/a")

echo "ksmbd loaded:            ${KSMBD_LOADED}"
echo "nf_conntrack_h323 loaded: ${H323_LOADED}"
echo "nf_conntrack_helper:      ${HELPER_SYSCTL}"

echo "=== [2] Checking Canonical Livepatch status ==="
if command -v canonical-livepatch >/dev/null 2>&1; then
  canonical-livepatch status --format=machine-readable || canonical-livepatch status
else
  echo "canonical-livepatch not installed. Consider: snap install canonical-livepatch && canonical-livepatch enable <TOKEN>"
fi

echo "=== [3] Applying kernel package updates (fallback if no livepatch) ==="
apt-get update -qq
apt-get install --only-upgrade -y linux-image-$(uname -r | sed 's/-generic.*//')-generic 2>/dev/null || \
  apt-get upgrade -y linux-image-generic

echo "=== [4] Mitigation: unload unused vulnerable modules ==="
# Only unload ksmbd if no ksmbd.mountd daemon is active (i.e., not actually serving SMB)
if [ "${KSMBD_LOADED}" -gt 0 ] && ! pgrep -x ksmbd.mountd >/dev/null 2>&1; then
  modprobe -r ksmbd && echo "ksmbd unloaded (no active daemon)" || echo "WARN: could not unload ksmbd"
  echo -e "# LSN-0121-1 mitigation\nblacklist ksmbd" > /etc/modprobe.d/blacklist-ksmbd.conf
else
  echo "ksmbd in active use or not loaded — patch via livepatch/reboot instead of unloading"
fi

if [ "${H323_LOADED}" -gt 0 ]; then
  echo "nf_conntrack_h323 is loaded. If H.323 NAT traversal is not required:"
  modprobe -r nf_conntrack_h323 && echo "nf_conntrack_h323 unloaded" || echo "WARN: unload failed (may be in use by conntrack)"
  echo -e "# LSN-0121-1 mitigation\nblacklist nf_conntrack_h323" > /etc/modprobe.d/blacklist-h323.conf
fi

echo "=== [5] Hardening: ensure automatic conntrack helper assignment stays disabled ==="
sysctl -w net.netfilter.nf_conntrack_helper=0
grep -q 'nf_conntrack_helper' /etc/sysctl.d/99-security.conf 2>/dev/null || \
  echo 'net.netfilter.nf_conntrack_helper=0' >> /etc/sysctl.d/99-security.conf

echo "=== [6] Verification ==="
lsmod | grep -E '^(ksmbd|nf_conntrack_h323)' && echo "WARNING: vulnerable modules still loaded — schedule a reboot into the patched kernel" || \
  echo "OK: neither ksmbd nor nf_conntrack_h323 is loaded"
echo "Done. If ksmbd must remain in service, confirm livepatch applied or reboot into the updated kernel."

Remediation

  1. Apply the livepatch (Ubuntu Pro subscribers): Verify with canonical-livepatch status — patched systems will list the LSN-0121-1 fixes as applied. Livepatch eliminates the reboot requirement for these kernel fixes. If you are not an Ubuntu Pro subscriber, note that Ubuntu Pro is free for up to 5 machines and is the only path to rebootless kernel patching.
  2. Patch and reboot (non-livepatch hosts): apt update && apt upgrade linux-image-generic, then reboot into the updated kernel. Confirm with uname -r against the kernel versions listed at https://ubuntu.com/security/notices/LSN-0121-1.
  3. Eliminate unneeded attack surface:
    • If you serve SMB with Samba (smbd), you do not need ksmbd — blacklist and unload it. Running both is redundant exposure.
    • Blacklist nf_conntrack_h323 everywhere except documented VoIP gateway roles. H.323 is a legacy protocol; in most environments the helper should never load.
  4. Keep automatic conntrack helper assignment disabled: net.netfilter.nf_conntrack_helper=0 (default on modern kernels — verify it, don't assume it). Explicit -j CT --helper rules should be audited and justified per host.
  5. Restrict SMB exposure: hosts running ksmbd should have TCP/445 firewalled to known client networks. Both ksmbd bugs are reached via SMB protocol parsing — network segmentation directly reduces exploitability, independent of patch state.
  6. Monitor for exploitation artifacts: deploy the kernel-fault detection (SIGMA rule 3 / KQL Hunt 2) above. A use-after-free under active exploitation almost always produces crash noise before it produces a working exploit — that noise is your early warning.
  7. Fleet scoping: run the Velociraptor artifact (or your EDR equivalent) to inventory which hosts actually load these modules. In our IR experience, kernel SMB servers and VoIP helpers are frequently present on appliances and image builds that nobody in the security team authorized.

Bottom line: no active exploitation has been reported, and the exposure is conditional (module must be loaded) — but these are remotely reachable, kernel-memory-corruption-class bugs in protocol parsers. Inventory, patch or mitigate within your standard kernel-patch SLA, and treat any ksmbd presence you can't explain as an incident, not a finding.

Related Resources

Security Arsenal Penetration Testing Services AlertMonitor Platform Book a SOC Assessment vulnerability-management Intel Hub

Is your security operations ready?

Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.