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.
Originally disclosed on Immunefi
- 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
- Report ID: #37286
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/ethereum/execution-specs
- Impacts:
- (Compiler) Elimination of security checks
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:
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.
#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
Proof of Concept
Proof of Concept
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.