Appearance
S1C8: The Unverified
1. Problem
The contract is not verified on the block explorer (no source code). You need to understand the contract logic by analyzing the bytecode, then call the correct function.
2. Root Cause
The contract deliberately does not disclose its source code. Players need to possess EVM bytecode analysis skills.
3. Solution
- Use
cast codeto obtain the deployed bytecode - Decode function signatures via 4-byte selectors
- Analyze the function dispatch table and function logic
- Construct the correct calldata and send the transaction
bash
# Obtain bytecode
cast code <CHALLENGE> --rpc-url $RPC
# Decode selector
cast 4byte <SELECTOR>
# Send raw calldata
cast send <CHALLENGE> <CALLDATA>
4. Pitfalls Encountered
Bytecode analysis complexity: Unverified contracts require manually tracing JUMPDEST, stack operations, and storage access.
5. Why the Pitfall Exists
EVM bytecode is a low-level representation without the semantic information of Solidity source code. It requires understanding EVM opcodes, ABI encoding, and the code patterns generated by the Solidity compiler.
6. How to Resolve
Use tools to assist with analysis:
cast selectorsto list all function selectorscast storageto read storage slots- Python scripts to parse dispatch tables and function bodies
- Pay attention to revert strings (stored at the end of the bytecode, providing hints)
7. Key Takeaways
| Point | Explanation |
|---|---|
| EVM bytecode analysis | Understanding dispatch tables, function selectors, and JUMPDEST structures |
| Function dispatch | Solidity uses a binary search + function selector dispatch pattern |
| Reverse engineering | Deriving Solidity source logic from bytecode |
| cast tools | cast code, cast selectors, cast 4byte, cast storage |