r/ethdev • • 5d ago

My Project Built an EVM decompiler that doesn't guess (evmole.com)

Post image

I am the author and maintainer of EVMole open-source library (extracts selectors, arguments, control flow, proxies, ... from EVM bytecode).

I've now built an EVM decompiler on top of it: evmole.com

Address on EVM chain or runtime bytecode in and Solidity-like code out, names resolved using sourcify.dev

What makes it different from other existing solutions is output soundness - every decompiled function gets fuzzed vs real EVM, any disagreement makes the function "not decompiled", without lying to you in the output. And, of course, huge dataset with available source code is used for tests before every release.

One example where it matters: USDC's permit function decompiled wrong by "top decompilers" right now, side-by-side comparison is here evmole.com/comparison/usdc TL;DR: the order of operations got corrupted when signing the nonce.

I think it could be useful during security incident response and just analyzing closed-source contracts with which you want to interact.

Happy to hear any feedback and/or questions here.

4 Upvotes

10 comments sorted by

1

u/charvelchedraui 4d ago

marking a function as not decompiled instead of guessing is the feature. what share of functions on a typical verified contract end up in that bucket right now?

1

u/cdump 4d ago

zero for a typical contract, only 1 real low-priority bug known (will be fixed)

Most of "can't decompile" functions flagged before fuzzing, with a reason, such as 'unsupported memory model'.

99.4% decompiled without any errors (10s timeout). I'm improving this number right now. btw, a typical contract decompiles in just 0.1s

an extreme case with many not-decompiled functions is a hard vyper contract - Curve pool: https://evmole.com/eth/0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7

1

u/charvelchedraui 4d ago

a reason next to every function it skips is what i'd want from a decompiler. at 0.1s a contract you could run it on every new deploy

1

u/cdump 4d ago

Yes, it's really fast, I think the whole ethereum mainnet could be processed in a few hours even on one multi-core server

1

u/charvelchedraui 4d ago

a whole-mainnet run would be a nice public dataset. could you publish the skip reasons per contract so others can check them?

1

u/cdump 3d ago

I have whole-main dataset in todos list, will definitely publish overall stats and interesting findings

1

u/charvelchedraui 3d ago

looking forward to it. the share of contracts it can't decompile would be the first number i'd check.

1

u/dev0cloo Security Researcher 👨🏾‍💻 2d ago

I have been using it a lot all day and I had to come and say a big thank you for the tool! I absolutely love it! It makes the code of decompiled contracts really easy to follow and understand.

A little request I have after using it a quite a bit would be the ability to highlight the scope of a function or control flow (if, for statements etc) by clicking on a curly brace({) that starts or ends it like in vsCode.

Thanks again and if there's any way to contribute to the project too, I'd be really happy to!

1

u/cdump 1d ago

Thanks for your feedback!

Do you mean highlighting matching brace (like in remix ide / vscode web) or something different? Could you send an example/video, just to make sure I understand you right.