Skip to content
Path traversal Disclosed report Intermediate

Worker container escape lead to arbitrary file reading in host machine

A build worker could delete the expected log file and replace it with a symbolic link pointing at a host path. When the host copied the log out of the container, it followed the link on the host side, letting the attacker read arbitrary host files such as the password file.

Nguyễn Tiến Giang Follow

Originally disclosed on HackerOne

Bounty$2,000 Critical 9.3 View original
  • Disclosed after 33 days

Summary:

Because lack of security, attacker will be able to remove original log file and replace it will a symlink to other file, After finishing job, host machine copy file from docker container. Because the original log file has been removed, the host machine will copy the symlink file. But the problem is it doesn't copy the linked file in container, it copys the linked file in the HOST MACHINE.

Steps To Reproduce:

The attack is very simple, just remove the original build.log file and replace with a symlink file, I used this configuration to read the /etc/passwd:

  cpp:
    after_prepare:
      - rm -rf /opt/out/snapshot/log/build.log && ln -s /etc/passwd /opt/out/snapshot/log/build.log

PoC

Content of /etc/passwd is attached below

Impact

Give attacker ability to explore the host machine, expose more sensitive informations from it.

Attachments

docker_escape_read_file.PNG
docker_escape_read_file.PNG From the original on HackerOne

The original report as published on HackerOne, by testanull. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 host-side copy followed symbolic links in the container's output directory rather than copying the link itself or resolving it inside the container.

Impact

An attacker could explore the host machine and expose sensitive information from it.

What the attacker needed

Ability to run a build job; control over build configuration

How it was found

  1. Remove the original build log file in the container's output directory.
  2. Create a symbolic link at the same path pointing to a host file of interest.
  3. Let the job finish so the host copies the log out of the container.
  4. Read the copied output, which now contains the linked host file's contents.

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.

A symbolic link is a shortcut file that points to another file. The build system expected a log file inside a container and copied it out afterwards, but it followed the shortcut on the host machine instead of inside the container, so the attacker could make it read any file on the host.

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 Nguyễn Tiến Giang

View all

2 more disclosed reports, best first.

More from Semmle

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.