Skip to content
Path traversal Audit finding Beginner

Elimination of Security Checks in ForkCreator Class

The ForkCreator class and its helper methods do not validate the from_fork and to_fork inputs before building file paths, so an attacker can use directory traversal to copy sensitive files or overwrite arbitrary files. The report claims this could expose data, cause data loss, or lead to privilege escalation.

\[redacted] Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#37286 [SC-Insight] Elimination of Security Checks in ForkCreator Class

Submitted on Dec 1st 2024 at 16:44:46 UTC by [redacted] for Attackathon | Ethereum Protocol

Description

#Summary:

The ForkCreator class and its associated methods (find_replace and duplicate_fork) fail to validate user input (from_fork and to_fork) before constructing file paths or performing file operations. This lack of input validation allows attackers to bypass intended security controls, such as directory traversal prevention or file overwriting safeguards.

Attackers can exploit this vulnerability to:

1- Perform directory traversal attacks to access sensitive system files.
2- Overwrite arbitrary files or directories, potentially causing data loss or privilege escalation.

Vuln Code Snippet:

https://github.com/ethereum/execution-specs/blob/master/src/ethereum\\_spec\\_tools/new\\_fork.py#L162

Proof of Concept (PoC):

The following PoC demonstrates how an attacker could exploit the vulnerability to copy sensitive system files from /etc to a new location /tmp/malicious_fork, exposing critical information.

Link POC - https://gist.githubusercontent.com/ShellInjector/f1869cd2456d01285a02828b5aec582b/raw/db5381a2946caa6e7ca15053ed6f263ff8ae589f/POC

#Usage:

python poc.py --from_fork="../../../etc" --to_fork="../../../../tmp/malicious_fork"

#Output of the POC :

If the exploit succeeds, it will copy the contents of /etc into /tmp/malicious_fork. The output will look like this:

[INFO] Copying from src/ethereum/../../../etc to src/ethereum/../../../../tmp/some_fork
[INFO] Successfully copied to src/ethereum/../../../../tmp/some_fork

#Impact:

Data Exposure: Allows attackers to access sensitive files (..).
Data Loss: Enables overwriting of existing directories or files without validation.
Privilege Escalation: Overwriting critical system files could lead to a compromise of system integrity.

Link to Proof of Concept

https://gist.link

Proof of Concept

Proof of Concept

https://gist.githubusercontent.com/ShellInjector/f1869cd2456d01285a02828b5aec582b/raw/db5381a2946caa6e7ca15053ed6f263ff8ae589f/POC

The original report as published on Immunefi, by \[redacted]. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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 could read sensitive files, overwrite arbitrary files or directories, and potentially escalate privileges, though the report only demonstrates copying a system directory.

What the attacker needed

Ability to run the fork creation tool; control over from_fork and to_fork arguments

The fix

The tool should validate from_fork and to_fork, reject path traversal sequences, and resolve paths only inside the intended source and destination directories.

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.

This is a tool that creates new versions of code by copying folders. It takes folder names from the user and uses them directly to build file paths without checking them. Because of that, someone can type a path that climbs out of the intended folder and reaches other parts of the computer, like system files.

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 \[redacted]

View all

6 more disclosed reports, best first.

More from Ethereum Protocol

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.