Any liquidators can pretend to be a loan contract to validate offers, due to insufficient validation
The pool's validateOffer function only checks that the caller is an accepted caller, which includes liquidators, not just loan contracts. A liquidator could call it directly with fabricated offer data, bypassing loan contract checks and modifying internal accounting without transferring collateral.
Submitted by oakcobalt
Accepted callers in a loan manager (e.g. Pool.sol) can be either liquidators or loan contracts.
And only loan contracts should validate offers during a loan creation. However, the current access control check is insufficient in pool::validateOffer, which allows liquidators to pretend to be a loan contract, and directly modify storage (__outstandingValues) bypassing additional checks and accounting in a loan contract.
//src/lib/pools/Pool.sol
//@audit onlyAcceptedCallers only doesn't ensure caller is a loan contract
|> function validateOffer(bytes calldata _offer, uint256 _protocolFee) external override onlyAcceptedCallers {
if (!isActive) {
revert PoolStatusError();
}
...
Current access control check (onlyAcceptedCallers) only ensures caller is accepted caller but doesn’t verify the caller is a loan contract (_isLoanContract(caller)==true``).
//src/lib/loans/LoanManager.sol
modifier onlyAcceptedCallers() {
if (!_acceptedCallers.contains(msg.sender)) {
revert CallerNotAccepted();
}
_;
}
When a liquidator calls validateOffer, they can provide a fabricated bytes calldata _offer and uint256 _protocolFee bypassing additional checks and state accounting in a loan contract. For example, in MultiSourceLoan.sol- emitLoan, extra checks are implemented on LoanExecutionData to verify borrower and lender signatures and offer expiration timestamp as well as transfer collateral NFT tokens and recoding loan to storage. All of the above can be skipped if a liquidator directly call validateOffer and modify __outstandingValues without token transfer.
Recommended Mitigation Steps
In Pool::validateOffer, consider adding a check to ensure _isLoanContract(msg.sender)==true``.
Assessed type
Invalid Validation
0xend (Gondi) acknowledged and commented:
This is a low one given these contracts must all live within our ecosystem and be whitelisted. Given there’s already that trust assumption, not doing that check to save some gas on an extra state read.
This is a low one given these contracts must all live within our ecosystem and be whitelisted.
That makes sense. However, I’m judging this based on the info that was present to the wardens in the README and docs. Given that that trust assumption wasn’t noted there I’m going to sustain Medium severity.
Check
loanContract.
Status: Mitigation confirmed. Full details in reports from oakcobalt, minhquanym and bin2chen.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
A liquidator could bypass loan contract checks and modify the pool's outstanding values without transferring collateral, potentially corrupting accounting; the project argued this is low risk because all contracts are whitelisted, but the judge rated it medium due to missing trust assumption documentation.
What the attacker needed
Caller must be a whitelisted liquidator
The fix
The fix was to add a check that the caller is a loan contract in Pool::validateOffer.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In a smart contract system, some functions are meant to be called only by certain trusted contracts. Here, a function that should only be callable by loan contracts can also be called by liquidators. A liquidator could call it directly with fake data, skipping important checks and changing the pool's records without moving any tokens.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.