Cyber Risks · Trail of Bits Blog

Amarna: Static analysis for Cairo programs

Summary: Trail of Bits has open-sourced Amarna, a static analyzer and linter for the Cairo programming language, which powers exchanges holding millions of dollars in assets such as dYdX and StarkNet contracts. The tool ships with 10 rules, exports results to SARIF for viewing in VSCode, and targets Cairo footguns including hints that exec arbitrary Python, recursion over underconstrained structures, and nondeterministic jumps.

Bottom line: Cairo hints run arbitrary Python and do not change the program hash, so a malicious prover can supply a valid proof for any output the verifier will accept - and an off-by-one in array length tracking is enough to hand over that control.

Read the original at Trail of Bits Blog ↗