Beatland Festival

First Flight #44
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

Test compromises host environment resulting loss of funds

Root + Impact

Test compromises host environment resulting loss of funds

Description

Normally, smart contract tests are expected to execute within a deterministic and sandboxed virtual machine environment, ensuring no unintented side effects or interactions with the host system.

In this case, a malicious test uses vm.ffi to invoke shell commands that simulate scanning the local environment, harvesting sensitive information like a private key, and broadcasting a transaction to steal funds. Even though this appreas partially simulated via terminal output, the structure enables real-world abuse if further are introduced.

This demonstates an abuse of the test framework's ffi capability to potentially execute hostile actions against the developer's environment.

// FestivalPass.t.sol
@> function test_PartialUserFlow() public {...}
// foundry.toml
@> ffi = true

Risk

Likelihood: High
Any developer running the test suite locally with Foundry's ffi feature enabled will execute arbitrary shell code. Users may assume safety when running the suite as it is embedded in the project.

Impact: High
Host enviroment is compromised with potential loss of funds.

Proof of Concept

vm.ffi(inputs);

Recommended Mitigation

Remove the following line from foundry.toml

- ffi = true

Use isolated environment such as vscode devcontainers to run the tests, ensure no private data are exposed to the environment.

Updates

Lead Judging Commences

inallhonesty Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

FFI joke

OOS / Info

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!