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

Insufficient input validation #45

Open
code423n4 opened this issue Dec 8, 2021 · 2 comments
Open

Insufficient input validation #45

code423n4 opened this issue Dec 8, 2021 · 2 comments
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Handle

WatchPug

Vulnerability details

https://github.com/maple-labs/debt-locker/blob/81f55907db7b23d27e839b9f9f73282184ed4744/contracts/DebtLocker.sol#L85-L89

function setAllowedSlippage(uint256 allowedSlippage_) external override whenProtocolNotPaused {
        require(msg.sender == _getPoolDelegate(), "DL:SAS:NOT_PD");

        emit AllowedSlippageSet(_allowedSlippage = allowedSlippage_);
    }

Considering that _allowedSlippage is a crucial settings for getExpectedAmount(), it's necessary to add require(_allowedSlippage < 10000, "...") to validate the input.

If _allowedSlippage is misconfigured to a value > 10000, getExpectedAmount() will always revert.

Recommendation

Change to:

function setAllowedSlippage(uint256 allowedSlippage_) external override whenProtocolNotPaused {
        require(msg.sender == _getPoolDelegate(), "DL:SAS:NOT_PD");
        require(_allowedSlippage <  10000, "!slippage")

        emit AllowedSlippageSet(_allowedSlippage = allowedSlippage_);
    }
@code423n4 code423n4 added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working labels Dec 8, 2021
code423n4 added a commit that referenced this issue Dec 8, 2021
@lucas-manuel lucas-manuel added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Dec 8, 2021
@lucas-manuel
Copy link
Collaborator

Will address.

@pauliax
Copy link
Collaborator

pauliax commented Dec 19, 2021

Valid suggestion. I am grouping all input validation-related issues together and assigning them a severity of low.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

3 participants