code4rena-2022-08-nounsdao-l01

[L‑01] Nouns will not be able to be transferred once the block.number passes type(uint32).max

보고서

Summary

block number를 32비트로 잘라내 이용하는데, 이러면 32비트 범위를 넘어가는 약 1260년 뒤에 정상 작동하지 않을 것이라 지적했다.

Keyword

block number, type casting

Vulnerability

File: /contracts/base/ERC721Checkpointable.sol
 
238          uint32 blockNumber = safe32(
239              block.number,
240              'ERC721Checkpointable::_writeCheckpoint: block number exceeds 32 bits'
241:         );
File: /contracts/governance/NounsDAOLogicV2.sol
 
923:         uint32 blockNumber = safe32(blockNumber_, 'NounsDAO::getDynamicQuorumParamsAt: block number exceeds 32 bits');

block.number를 uint32로 잘라내 사용하고 있다. 현재 이더리움의 블록 속도라면 약 1260년 뒤에는 block.number가 32비트를 넘어 동작하지 않게 된다. 하드포크로 블록 속도가 변경되면 더 빠르게 동작하지 않게 될 것이다.

굳이 32비트로 제한할 필요가 없다면 uint32로 잘라낼 필요가 없어보인다.

Impact

block.number 가 type(uint32).max 를 넘기면 컨트랙트가 동작하지 않게 된다.

Mitigation

block.number를 32비트로 자르지 않고, 그대로 uint256을 이용한다.


tags: bughunting, nouns dao, smart contract, solidity, type casting, severity low