Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

Malicious code writing to system in SantasListTest.t.sol

Summary

Malicious code writing to system in SantasListTest.t.sol, using ffi. ffi is set in toml file.

Vulnerability Details

This is dangerous, because malicious actions can be performed on running environment.

function testPwned() public {
string[] memory cmds = new string[](2);
cmds[0] = "touch";
cmds[1] = string.concat("youve-been-pwned");
cheatCodes.ffi(cmds);
}

Impact

private key can be stolen, virus can be injected, etc

Tools Used

Foundry

Recommendations

remove this test case, and change ffi setting in toml file to be false

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

test_pwned FFI vulnerability

The FFI variable within Foundry.TOML was set to TRUE. This variable gives foundry shell access and allows it to run commands on your terminal. The possibility of exploitation through this means are endless! This repo exploited this flag through test_pwned Keep an eye out before running tests!

Support

FAQs

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