code4rena-2023-10-brahma-m01
[M-01] A safe that has been created using version 1.40=< will not be compatible with Brahma
Summary
Gaurd로 등록되는 SafeModeratorOverridable 컨트랙트가 ERC165를 지원하지 않아 1.4.0 이상 버전의 Safe 월렛과 통합되지 않는다.
Keyword
gnosis safe, wallet, integration, version, erc165
Vulnerability
Safe 월렛에 Guard로 등록되는 SafeModeratorOverridable 컨트랙트가 Safe 월렛 1.4.0 이상 버전과는 호환되지 않았다. 이는 1.4.0에서 GuardManager.sol에 ERC165 지원(supportsInterface)이 추가되었기 때문이다.
다음 코드가 1.4.0에 추가되었다. 등록하려는 Guard 컨트랙트가 ERC165를 지원하지 않으면 등록할 수 없도록 막는다. Safe 월렛 CHANGELOG.md에서는 1.4.0 이상 버전 이상과 통합할 경우, ERC165를 지원하는 Guard 만 추가할 수 있다고 안내한다.
function setGuard(address guard) external authorized {
+ if (guard != address(0)) {
+ require(Guard(guard).supportsInterface(type(Guard).interfaceId), "GS300");
+ }하지만 SafeModeratorOverridable 에서는 supportsInterface 함수를 작성하지 않았다. 따라서 1.4.0 이상 버전의 Safe 월렛에 setGuard 함수로 가드를 등록하려 할 시 실패한다.
Impact
1.4.0 이상 버전의 Safe 월렛과 통합되지 않는다.
Mitigation
supportsInterface 함수를 추가하여 ERC165를 지원한다.
Memo
이상함을 느껴 메모를 달아뒀는데 보고를 안 했다. 기존 서비스와 통합할 때 안 맞는 부분이 있다면 전부 보고하는 게 맞는 것 같다.. 또한 지원하는 버전은 어디까지인지, 어떤 버전에서 깨질 수 있는지 Changelog를 살펴보거나, 자주 쓰이는 프로젝트는 아예 따로 정리해둘 필요가 있겠다.
tags: bughunting, brahma, smart contract, solidity, gnosis safe, wallet, version, integration, erc165, solidity interface, severity medium