Skip to content
Path traversal Advisory Intermediate CVE-2021-32825

GHSL-2020-258: ZipSlip vulnerability in bblfshd - CVE-2021-32825

The tar extraction routine in bblfshd attempted to prevent symlinks from escaping the target directory, but a crafted archive with nested symlinks could bypass this check. An attacker controlling the archive could write arbitrary files outside the extraction directory and potentially read arbitrary system files.

ghsecuritylab Follow

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.

ghsecuritylab, on GitHub Security Lab

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

The symlink check only compared the resolved target path against the destination prefix, but did not account for previously created symlinks that could redirect the path outside the destination.

Impact

This issue may lead to arbitrary file write (with same permissions as the program running the unpack operation) if the attacker can control the archive file. Additionally, if the attacker has read access to the unpacked files, he may be able to read arbitrary system files the parent process has permissions to read.

What the attacker needed

Attacker controls the tar archive; victim extracts the archive

How it was found

  1. Create a tar archive containing a symlink named subdir/parent pointing to ..
  2. Add another symlink named subdir/parent/escapes pointing to ..
  3. Extract the archive using the vulnerable untar routine
  4. The second symlink resolves outside the intended extraction directory

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 should keep all files inside the folder you choose. This report shows that a malicious archive could trick the program into creating links that point outside that folder, letting an attacker write or read 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.

More by ghsecuritylab

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.