Skip to content
RCE Write-up Advanced

Unveiling Needrestart Vulnerabilities: A Decade of Hidden Risks i

Five local privilege escalation flaws in needrestart let a local attacker run code as root by manipulating environment variables, replacing interpreter binaries during scanning, or injecting shell commands through filenames. The most severe chain combines these to achieve full root compromise.

researcher grey Follow

Published on medium.com

Linux systems are well-regarded for their stability and robust security features. Among the utilities designed to maintain this standard is needrestart, introduced in 2014.

researcher grey, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely, needrestart trusted environment variables and filenames from running processes and scanned interpreters without sanitising them, and it validated interpreter binaries in a way that could be raced.

Impact

A local attacker could gain root privileges and fully compromise the system, though the command injection flaw alone requires chaining with another vulnerability to escalate.

What the attacker needed

Local access to the system; needrestart below 3.8; Module::ScanDeps below 1.36

The fix

It was fixed by updating needrestart to version 3.8 or later and Module::ScanDeps to 1.36 or later; a temporary workaround is to disable interpreter scanning.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

needrestart is a helper program on Linux that checks which services need restarting after updates. These bugs let someone who already has a normal account on the machine trick that helper into running their own code with the highest permissions (root), so they could take over the whole system.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.