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), "...");
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), "...");