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

Wrong implementation of function addVoteEscrow() in RewardDistributor.sol #567

Closed
code423n4 opened this issue Aug 1, 2022 · 1 comment
Closed
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists old-submission-method

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/rewards/RewardDistributor.sol#L298-L305

Vulnerability details

Impact

  • Denial of Service because ve always is address(0)

Proof of concept

There is no initial setup for ve variable in contract RewardDistributor. So if we want to set ve variable, we will need to call function addVoteEscrow().

function addVoteEscrow(address _voteEscrow) external onlyOwner {
    if (address(ve) == address(0)) {
        ve = VE(pendingVoteEscrow);
    } else {
        voteEscrowEnableDate = block.timestamp + 1 days;
        pendingVoteEscrow = _voteEscrow;
    }
}

Function addVoteEscrow() will check address(ve) == address(0) or not. Cause there is no initialization for ve, it will set ve = VE(pendingVoteEscrow). But at this time, pendingVoteEscrow is address(0) too.
==> ve == address(0) forever

Tools Used

Manual review

Recommended Mitigation Steps

change function to

function addVoteEscrow(address _voteEscrow) external onlyOwner {
    if (address(ve) == address(0)) {
        ve = VE(_voteEscrow);
    } else {
        voteEscrowEnableDate = block.timestamp + 1 days;
        pendingVoteEscrow = _voteEscrow;
    }
}
@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working old-submission-method labels Aug 1, 2022
code423n4 added a commit that referenced this issue Aug 1, 2022
@okkothejawa
Copy link

Duplicate of #611

@itsmetechjay itsmetechjay added the duplicate This issue or pull request already exists label Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists old-submission-method
Projects
None yet
Development

No branches or pull requests

3 participants