codehawks-2023-07-codehawks-escrow-contract-l02
[L-02] If the arbiter is not set, arbiter fee should not be positive
Summary
중재자를 이용하지 않는데도 중재자 수수료를 양수로 설정할 수 있다.
Keyword
wrong state
Vulnerability
Escrow 컨트랙트 배포시 중재자를 address(0)로 설정하여 중재자 없이 진행할 수 있다. 중재자를 사용하지 않는데도 중재자 수수료는 양수가 될 수 있다. 단지 수수료가 price보다 작은지만 확인한다. 이는 맞지 않다.
constructor(
uint256 price,
IERC20 tokenContract,
address buyer,
address seller,
address arbiter,
uint256 arbiterFee
) {
...
if (arbiterFee >= price) revert Escrow__FeeExceedsPrice(price, arbiterFee);
...
}Impact
중재자가 설정되지 않으면 애초에 수수료 정보가 사용되지 않으므로 불필요한 데이터를 저장했다는 것 외의 문제는 없다.
Mitigation
arbiter가 address(0)인 경우 arbiterFee는 0이어야 한다는 조건을 추가한다.
Memo
Escalation 기간에 이는 취약점이 아니며 invalid로 내려야 한다고 주장했다. 하지만 CodeHawks dosc에서 자산에 위험은 없지만, state가 제대로 핸들링되지 않은 경우 low로 취급된다 명시되어 low로 지정했다.
tags: bughunting, codehawks, smart contract, solidity, wrong state, severity low