Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fund With The Zero Amount Leads To DOS On The Contract #163

Closed
code423n4 opened this issue May 22, 2022 · 3 comments
Closed

Fund With The Zero Amount Leads To DOS On The Contract #163

code423n4 opened this issue May 22, 2022 · 3 comments
Labels
bug Something isn't working disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) duplicate This issue or pull request already exists G (Gas Optimization)

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-05-aura/blob/main/contracts/AuraVestedEscrow.sol#L96

Vulnerability details

Impact

On the contract, Recipients can be funded with rewardTokens through fund function. However, the external call can be made with zero amount and totally will lock fund function with initialised variable.

Proof of Concept

  1. Navigate to the following contract.

https://github.com/code-423n4/2022-05-aura/blob/main/contracts/AuraVestedEscrow.sol#L96

  1. Amounts array can be filled with "0"s. With the "0" amount, the contract funding totally will be useless and that will cause to DOS in the contract.

    function fund(address[] calldata _recipient, uint256[] calldata _amount) external nonReentrant {
        require(!initialised, "initialised already");

        uint256 totalAmount = 0;
        for (uint256 i = 0; i < _recipient.length; i++) {
            uint256 amount = _amount[i];

            totalLocked[_recipient[i]] += amount;
            totalAmount += amount;

            emit Funded(_recipient[i], amount);
        }
        rewardToken.safeTransferFrom(msg.sender, address(this), totalAmount);
        initialised = true;
    }

Tools Used

code review

Recommended Mitigation Steps

Ensure that funding didn't complete with "zero amount". Compare _recipient and _amount size in the function. If arrays sizes are not equal, the function always will revert.

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels May 22, 2022
code423n4 added a commit that referenced this issue May 22, 2022
@0xMaharishi 0xMaharishi added duplicate This issue or pull request already exists disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) labels May 26, 2022
@0xMaharishi
Copy link

duplicate of #305 etc

@dmvt
Copy link
Collaborator

dmvt commented Jun 20, 2022

I'm going to downgrade this one to a gas issue given that the worst impact is a required redeploy. The suggested mitigation is valid.

@dmvt dmvt added G (Gas Optimization) and removed duplicate This issue or pull request already exists 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Jun 20, 2022
@dmvt
Copy link
Collaborator

dmvt commented Jun 25, 2022

Grouping this with the warden’s gas report, #321

@dmvt dmvt closed this as completed Jun 25, 2022
@dmvt dmvt added the duplicate This issue or pull request already exists label Jun 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) duplicate This issue or pull request already exists G (Gas Optimization)
Projects
None yet
Development

No branches or pull requests

3 participants