GHSL-2020-168, GHSL-2020-169, GHSL-2020-170: Integer overflows and file descriptor leak in aptd - CVE-2020-27349, CVE-2020-27350, CVE-2020-27351
Three bugs in the C parsing code used by aptd when it reads a local .deb package: a negative integer overflow that leads to an out-of-memory crash, a second overflow that puts the parser into an infinite loop, and a file descriptor leak when a package is invalid. An unprivileged local user could use these to cause a denial of service against the system service.
Originally disclosed on GitHub Security Lab
The aptd daemon is a system service for installing and updating packages. It is accessible via dbus and has a method named “InstallFile” which is used for installing local .deb packages.
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 the ar archive header parser trusted a fixed-length size field without checking for negative values, and an error path in the Python binding returned without freeing the object it had created.
Impact
Each issue may lead to local denial of service: a crash, an infinite loop, or exhaustion of file descriptors; polkit stops the package from actually being installed but does not stop the parsing.
What the attacker needed
Local unprivileged user account; ability to send dbus messages to aptd; a crafted .deb file
The fix
The parsing code was patched and an extra polkit check was added in aptdaemon, and the fixes were released.
How it was found
- Create a crafted .deb package that triggers the bug.
- Send the package path to aptd's InstallFile method over dbus.
- Take the transaction id returned by that call.
- Call Run on that transaction to make aptd parse the file.
- Observe the crash, hang, or an extra open file descriptor on the package.
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.
aptd is a background service that installs software packages on Ubuntu. Even when a normal user is not allowed to actually install a package, the service still opens and reads the file they hand it, and that reading code had mistakes. A normal user could therefore crash or hang the service, or slowly use up its open-file slots, which is a denial of service: stopping the machine from doing its job rather than stealing data.
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.