GHSL-2020-256: Unsafe handling of symbolic links in dbdeployer unpacking routine - CVE-2020-26277
The unpacking routine in dbdeployer attempted to prevent symbolic links from escaping the extraction directory, but a malicious tarball could create a chain of symlinks that ultimately pointed outside the target folder. An attacker who controls the archive could read or write arbitrary files with the permissions of the unpacking process.
Originally disclosed on GitHub Security Lab
The unsafe handling of symbolic links in an unpacking routine may enable attackers to read and/or write to arbitrary locations outside the designated target folder.
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
Impact
An attacker who can control the archive file could write arbitrary files with the permissions of the unpacking process, and if they have read access to the unpacked files, they could read arbitrary system files the parent process can read.
What the attacker needed
Attacker controls the tar archive; victim extracts the archive with dbdeployer
The fix
The vulnerability was fixed in version 1.58.2 by improving the handling of symbolic links during unpacking.
How it was found
- Create a tar archive containing a symlink named subdir/parent that points to .. (the parent directory).
- Add another symlink inside that path, such as subdir/parent/escapes, also pointing to .., which resolves outside the extraction root.
- Extract the archive using the vulnerable unpackTarFiles routine, which creates the symlinks without detecting the escape.
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.
When you extract a tar archive, the program tries to keep all files inside the folder you choose. A symbolic link (symlink) is like a shortcut that points to another file or folder. The bug lets an attacker craft an archive with symlinks that trick the program into creating shortcuts that point outside the intended folder, so the attacker can then read or write files anywhere the program has permission.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.