code-423n4 / 2021-05-yield-findings

0 stars 0 forks source link

maxFlashLoan has no effect on flashLoan #23

Closed code423n4 closed 3 years ago

code423n4 commented 3 years ago

Handle

pauliax

Vulnerability details

Impact

contract Join declares a function maxFlashLoan which should indicate a maximum amount of tokens that can be lended: function maxFlashLoan(address token) public view override returns (uint256) { return token == asset ? storedBalance : 0; } Depending on the token a maximum amount is either a storedBalance or 0. However, this limit is never enforced. function flashLoan does not check that amount is within the limit of maxFlashLoan, thus making this function useless or even misleading.

Recommended Mitigation Steps

In function flashLoan add a check: require(amount <= maxFlashLoan(token), "...");

ninek9 commented 3 years ago

Withdrawn by warden.