code4rena-2023-01-biconomy-m07

[M-07] SmartAccount.sol is intended to be upgradable but inherits from contracts that contain storage and no gaps

보고서

Summary

Upgradable한 컨트랙트의 부모 컨트랙트 중 Storage를 이용하면서 Storage gap이 없는 컨트랙트가 있다.

Keyword

upgradable, storage gap

Vulnerability

SmartAccount는 Upgradable 하기를 지향하고 있다. 하지만 SmartAccount는 Stateless 하지 않지만 Storage gap도 존재하지 않는 컨트랙트인 ModuleManager를 상속했다.

만약 업그레이드 할 때 ModuleManager 에 스토리지 변수를 추가한다면, 슬롯이 밀려서 중요한 변수를 덮어쓰는 등의 상당한 위험을 초래할 수 있다.

더군다나 SmartAccount는 Owner가 임의로 업그레이드를 할 수 있다. Biconomy 개발자가 아닌 누구나가 가능하다는 의미이다. 따라서 더욱 주의를 할 필요가 있다.

Impact

업그레이드시 슬롯이 밀려 변수를 덮어쓰는 등의 사고가 발생할 수 있음

Mitigation

Storage를 사용하는, 상속하는 모든 컨트랙트에 Storage gap을 추가한다.


tags: bughunting, smart contract, biconomy, account abstraction, erc4337, upgradeable, wallet, severity medium