Technical analysis of the Audius hack


Audius Governance Takeover Post-Mortem 7/23/22 | Audius Blog

Details provided:

Contract Structure

Audius Storage layout

Storage Layout of Audius

| slot       | Admin (Implementation) | Proxy                          |                           
|------------|------------------------|--------------------------------|
| 0          | proxyAdmin             | initialized, initializing (OZ) | <------ Storage Collision 
| 1          |                        | isInitialized (V2)             |                           
| ...        |                        |                                |                           
| [0x3...bc] | implementation         |                                |                           

The problem, therefore, was storing information about the Admin in the Proxy contract.

Prevention:

The Proxy should contain no data unless it has a very specific place in storage you know will not be overwritten.

Example in OZ:

bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

Top