Beatland Festival

AI First Flight #4
Beginner FriendlyFoundrySolidityNFT
EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

in the FestivalPass.t.sol file, function test_PartialUserFlow() uses Unsafe Foundry FFI. Which enables arbitrary command execution on auditor and developer machines

Root + Impact

The repository contains a test that invokes:
​
(https://github.com/CodeHawks-Contests/2025-07-beatland-festival/blob/5034ccf16e4c0be96de2b91d19c69963ec7e3ee3/test/FestivalPass.t.sol#L447) with a dynamically constructed shell command.

Description

Foundry's FFI cheatcode executes host-system commands outside the EVM sandbox.
​
The repository includes a test that constructs a shell command and executes it using:
​
(https://github.com/CodeHawks-Contests/2025-07-beatland-festival/blob/5034ccf16e4c0be96de2b91d19c69963ec7e3ee3/test/FestivalPass.t.sol#L447)
​
Although the current implementation only prints terminal output, the same mechanism can execute arbitrary commands with the privileges of the user running the tests.
​
Any developer, auditor, CI worker, or judge running:
​
forge test --ffi
​
implicitly grants code execution permissions to the repository.
​
An attacker could:
​
Read local SSH keys
Read cloud credentials
Exfiltrate environment variables
Install malware
Modify local files
Compromise CI/CD runners
​
Resulting in complete compromise of the host environment.
// Root cause in the codebase with @> marks to highlight the relevant section

Risk

Likelihood:

Any body executing the test suite will be affected which is highly likely

Impact:

When tests are executed with: forge test --ffi arbitrary operating-system commands are executed on the host machine. A malicious contributor could modify the command payload to exfiltrate secrets, install malware, or compromise developer environments.
The test suite executes:
​
https://github.com/CodeHawks-Contests/2025-07-beatland-festival/blob/5034ccf16e4c0be96de2b91d19c69963ec7e3ee3/test/FestivalPass.t.sol#L447
​
where:
​
(https://github.com/CodeHawks-Contests/2025-07-beatland-festival/blob/5034ccf16e4c0be96de2b91d19c69963ec7e3ee3/test/FestivalPass.t.sol#L422)
https://github.com/CodeHawks-Contests/2025-07-beatland-festival/blob/5034ccf16e4c0be96de2b91d19c69963ec7e3ee3/test/FestivalPass.t.sol#L423
allowing unrestricted shell execution.

Proof of Concept

​

Recommended Mitigation

Remove unnecessary FFI usage.
If FFI is required:
Isolate FFI tests
Disable them by default
Restrict executed commands
Document security implications
vm.ffi(inputs); - remove this code
console.log(...) + add this code
Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!