Skip to content

Repository files navigation

ALL INFO HERE ONLY FOR EDUCATIONAL PURPOSES!!!

1/ This is a small thread on: How running a Foundry test can steal all your money, leak your data, and expose your address in just a few seconds.

meme

2/ Foundry has an ffi cheatcode that lets you call external programs from your console. For example, you can fetch API data from swap aggregators. It's super handy. Read more here: https://getfoundry.sh/reference/cheatcodes/ffi

3/ At first, I thought: "Wow, I can basically make a mini weather app using Foundry." And I did. Here's a snippet:

weather

4/ But then I thought... how did it know my location?

That's when it hit me: 'FOUNDRY HAS A CHEATCODE THAT LETS YOU CALL EXTERNAL PROGRAMS FROM YOUR CONSOLE', meaning bad actors can abuse this to get your IP info:

ip

5/ They can also grab your device info and your username:

device

6/ They can read/write files on your PC.

YES - that includes unencrypted private keys and passwords.

file

7/ They can even lock your PC. 😢

lock

8/ You might ask: "Okay, but why should I care?"

If someone can run curl or similar commands, they can send all this info to a remote server. That's all your data, money, and credentials - now in the hands of a hacker, who could blackmail you. Not good.

9/ "Okay, that's scary. But how can you prevent it?" Check for ffi = true in foundry.toml and avoid running tests with the --ffi parameter unless you are 120% sure the code contains no shady calls.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages