code4rena-2023-11-party-dao-m06

[M-06] ETHCrowdfundBase.processContribution - Impossible to finalize crowdfund because of minContribution check

보고서

Summary

최대 가능 펀딩 금액과 펀딩 완료 금액(최소 목표)의 차액이 1회 최소 투자금보다 작다면, 1회 최소 투자금을 넣었을 때 최대 가능 펀딩 금액을 넘어가기 때문에 더이상 투자가 불가하다. 이 점을 이용하여 DoS가 가능하다.

Keyword

arithmetic error, dos

Vulnerability

크라우드 펀딩을 할 때, minContribution 변수를 사용해 1회 최소 투자금을 강제한다. 또한 maxTotalContribution 로 크라우드 펀딩을 받을 수 있는 금액을 제한하고, minTotalContribution로 크라우드 펀딩이 성공하기 위해 필요한 최소 금액을 설정한다.

    // Check that the contribution amount is at or above the minimum. This
    // is done after `amount` is potentially reduced if refunding excess
    // contribution. There is a case where this prevents a crowdfunds from
    // reaching `maxTotalContributions` if the `minContribution` is greater
    // than the difference between `maxTotalContributions` and the current
    // `totalContributions`. In this scenario users will have to wait until
    // the crowdfund expires or a host finalizes after
    // `minTotalContribution` has been reached by calling `finalize()`.
    uint96 minContribution_ = minContribution;
    if (amount < minContribution_) {
        revert BelowMinimumContributionsError(amount, minContribution_);
    }

minContribution > maxTotalContribution - minTotalContribution 일 때 문제가 발생할 수 있다. minTotalContribution에 도달하지 못해 추가 펀딩이 필요하지만, 1회 최소 투자금만큼 투자해도 펀딩 상한을 넘어 트랜잭션이 취소된다. 따라서 아무도 추가 투자를 할 수 없게 되고, 이 크라우드 펀딩은 성공할 수 없게 된다.

크라우드 펀딩에 실패하면 유저는 환불을 요청할 수 있다. minTotalContribution에 도달하지 못했기 때문에 크라우드 펀딩을 조기 종료할 수 없으므로 유저가 환불받기 위해서는 종료 기간까지 기다려야 한다. 이를 통해 DoS가 가능하다.

Impact

DoS. 크라우드 펀딩을 성공할 수 없는 조건으로 만들어 DAO의 생성을 방해한다. 유저가 환불받기 위해 펀딩 종료일까지 기다리게 한다.

Mitigation

minContributions 값을 설정할 때 minContribution > maxTotalContribution - minTotalContribution 하지 않도록 한다.


tags: bughunting, party dao, smart contract, solidity, arithmetic error, dos, severity medium