GHSL-2020-254: Arbitrary file read and/or write in dotmesh - CVE-2020-26312
The tar extraction routine in dotmesh attempted to prevent symlink escapes but could be bypassed by a chain of symlinks, allowing an attacker to create links pointing outside the extraction directory. This could lead to arbitrary file read or write 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
Root cause
Likely the symlink validation only checked the immediate target path without resolving chained symlinks, allowing a two-step escape.
Impact
An attacker who controls the archive could write arbitrary files with the permissions of the unpacking process, and if they can read the unpacked files, they could read arbitrary system files the parent process can access.
What the attacker needed
Attacker controls the tar archive; victim extracts the archive with dotmesh
How it was found
- Create a tar archive containing a symlink named subdir/parent pointing to ..
- Add another symlink inside that path, e.g., subdir/parent/escapes, also pointing to ..
- Extract the archive using the vulnerable untarFile routine
- The resulting symlink points outside the extraction directory, enabling access to files outside
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 must ensure that files and links stay inside the target folder. Here, the check could be tricked by creating a link that points to the parent folder, and then another link inside that which escapes further. An attacker who controls the archive could then read or write files anywhere the program has access.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.