GHSL-2021-052: Potential local Denial of Service in systemd
An integer overflow in systemd-ask-password's error handling causes an infinite loop when an invalid unicode character followed by backspace is entered. An attacker could cause a local denial of service by consuming 100% of a CPU core.
Originally disclosed on GitHub Security Lab
There is an infinite loop in systemd-ask-password, due to an integer overflow in an error handling code path. The bug can be triggered by entering an invalid unicode character followed by backspace.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely an integer overflow: a negative error code (-22) is assigned to an unsigned size_t variable, causing a large value that leads to an infinite loop when added to the position counter.
Impact
This issue may lead to local denial of service, but the impact is low because systemd-ask-password normally runs privileged and only accepts input from privileged clients, forming a self-DoS.
What the attacker needed
Local access to run systemd-ask-password; ability to feed input via a tty
The fix
The suggested fix was merged in a pull request.
How it was found
- Build the C program that generates the malicious passphrase.
- Use ssh with a pseudo-terminal to feed the output of the program into systemd-ask-password.
- Run top to observe that systemd-ask-password is consuming 100% of a CPU core.
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 report has not been written yet. The Original tab links to the source.
systemd-ask-password is a program that asks for passwords on the command line. A bug in how it handles certain invalid characters can make it loop forever, using up all the CPU on that machine. This only affects the local machine and requires someone to type the special sequence.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.