Needrestart Local Root Exploit: CVE-2026-124757 Analysis
Published 2026-11-19Category: Guides
CVE-2026-124757 allows local root escalation via forged systemd sessions in needrestart's apt/dpkg hooks. All supported Ubuntu and Debian versions
Table of contents
- 1.Introduction and Key Points
- 2.Core Facts and Parameter Comparison
- 3.Deep Dive and Operational Details
- 3.1.Vulnerability Mechanism and Attack Chain
- 3.2.Version Verification and Asset Inventory Commands
- 3.3.Temporary Mitigations and Functional Trade-offs
- 4.Scenario-Based Selection and Pitfall Checklist
- 5.FAQ
- 6.Sources & References

Introduction and Key Points
On November 17, 2026, security researcher Armaan Sandhu disclosed a local privilege escalation vulnerability in needrestart, tracked as CVE-2026-124757, via the oss-security mailing list. The tool is installed by default on Ubuntu Server 21.04 and later, running automatically via apt/dpkg hooks after package upgrades to detect daemons requiring a restart. The exploitation path is stealthy: any local user only needs to wait for or trigger a root-executed apt/dpkg upgrade operation, then forge a systemd session to hijack the needrestart notify hook and gain root privileges. As of the evening of November 17, neither Canonical nor Debian has released a fixed version. All supported Ubuntu releases (16.04 LTS through 26.10) and Debian bookworm (3.6-4+deb12u3), trixie/forky/sid (3.11-1) are marked Vulnerable with a fixed-version of unfixed in official trackers. For multi-user shared servers, automated operations pipelines, and non-interruptible production environments, this vulnerability poses an immediate high-severity threat. Operations staff must immediately verify versions and deploy mitigations.
Core Facts and Parameter Comparison
| Dimension | Key Information | Status / Risk Note |
|---|---|---|
| CVE ID | CVE-2026-124757 | Assigned by Red Hat, rated High by Canonical |
| Affected Component | needrestart (including apt/dpkg hook scripts) | Default on Ubuntu 21.04+, affects Debian bookworm and experimental branches |
| Trigger Condition | root executes apt or dpkg upgrade/install | No active attacker interaction required; automated upgrades trigger it |
| Exploitation Principle | Forge systemd session to hijack notify hook | Local user obtains full root privileges |
| Affected Ubuntu Versions | 16.04 LTS, 18.04 LTS, 20.04 LTS, 22.04 LTS, 24.04 LTS, 24.10, 26.10 | Official CVE pages show all Vulnerable, no fixed version |
| Affected Debian Versions | bookworm (3.6-4+deb12u3), trixie/forky/sid (3.11-1) | Security Tracker marks unfixed |
| Fix Progress | No patch released as of 2026-11-17 | Neither Canonical nor Debian ready; continuous tracking required |
| Temporary Mitigation | Uninstall needrestart or disable apt/dpkg hook | Loses automatic post-upgrade service restart detection |
Deep Dive and Operational Details
Vulnerability Mechanism and Attack Chain
Needrestart invokes automatically after any package installation or upgrade via apt/dpkg hook scripts located in the upstream repository’s ex/ directory. The attacker does not need to trick an administrator into running a special command; they only need to wait for a system cron job (such as unattended-upgrades) or an administrator’s routine apt upgrade. At that moment, needrestart runs with root privileges. Its notify hook contains a validation flaw when handling systemd session communication. A local user can craft a forged systemd session environment (variables such as XDG_RUNTIME_DIR, DBUS_SESSION_BUS_ADDRESS), lure needrestart into connecting to an attacker-controlled socket, execute arbitrary code, and complete the privilege escalation. The researcher has reproduced the exploit in lab environments on Debian bookworm and Ubuntu 24.04, targeting root only; other package interaction scenarios were not tested.
Version Verification and Asset Inventory Commands
Operations teams must immediately run version checks on all Ubuntu/Debian hosts:
dpkg -l needrestart | grep ^ii
apt policy needrestart
Cross-reference the version numbers against the table above: any supported Ubuntu version is unsafe; Debian bookworm showing 3.6-4+deb12u3 and trixie/sid showing 3.11-1 are vulnerable. Simultaneously check /etc/apt/apt.conf.d/ and /etc/dpkg/dpkg.cfg.d/ for hook configurations calling needrestart (typically 99needrestart or similar files) to confirm automatic trigger paths.
Temporary Mitigations and Functional Trade-offs
Until an official patch is released, adopt one of the following mitigations:
- Uninstall needrestart: Remove needrestart and its hooks via the package manager. This eliminates the attack surface entirely but loses automatic post-library-upgrade service restart reminders, requiring manual restart list maintenance.
- Disable hook scripts: Delete or rename
/etc/apt/apt.conf.d/99needrestartand/etc/dpkg/dpkg.cfg.d/needrestart. Retain the binary for manual invocation while breaking the automatic trigger chain. - Restrict local logins: On high-sensitivity shared hosts, suspend unnecessary shell accounts to reduce the attack surface.
When choosing a mitigation, evaluate the business priority between “ automated upgrades with restart detection” and “privilege escalation risk.” Production environments should prefer option 2 combined with manual audits.
Scenario-Based Selection and Pitfall Checklist
- Multi-user shared development / jump hosts: Immediately implement option 2 (disable hooks), audit all local account permissions, and prohibit login for service accounts that do not require a shell.
- Automated CI/CD build nodes: If nodes run apt as root to install dependencies, remove needrestart or disable hooks during the image build phase to prevent a malicious dependency package from triggering escalation during the build.
- Non-interruptible single-tenant production servers: May temporarily retain needrestart but disable automatic hooks; switch to manual needrestart execution during maintenance windows to balance availability and security.
- Container hosts: The shared kernel amplifies the impact of escalation. Clean up needrestart at the host level. Containers running in non-privileged mode face lower risk but cleanup is still recommended.
- Pitfalls: Do not assume “I didn’t install needrestart, so I’m safe” — Ubuntu Server 21.04+ installs it by default. Do not wait for routine distribution security updates; CVE pages explicitly show no fixed version. Actively track ubuntu.com/security/notices and security-tracker.debian.org.
FAQ
Does this vulnerability affect RHEL, Fedora, Arch, or other non-Debian-based distributions?
The source material only discloses the impact on Ubuntu and Debian. Red Hat assigned the CVE identifier but the material does not state which RHEL/Fedora versions are actually affected or their remediation progress. For other distributions, consult their respective security advisories.
How do I manually check which services need a restart after uninstalling needrestart?
You can use the needrestart binary (if retained) or combine systemctl list-units with lsof -n | grep DEL for manual investigation. Alternatively, deploy open-source alternatives such as checkrestart (from the debian-goodies package) or custom scripts that scan /proc/*/maps for deleted library files.
Sources & References
- FOSS Linux: Needrestart Local Root Flaw Has No Fix Yet (2026-11-18)
Spotted outdated pricing, stock, or expired coupons?See methodology & report an update →

