Borrower has no way to update maxTotalSupply of market or close market.
The market contracts restricted setMaxTotalSupply and closeMarket to the controller, but the controller exposed no borrower-facing function to call them. As a result the borrower could not raise or lower a market's supply cap or shut down an unused market, and kept paying interest on idle capacity.
Submitted by 0xpiken, also found by Aymen0909, MiloTruck, Fulum, 0xCiphky, max10afternoon, tallo, Drynooo, cartlex_, HALITUS, gumgumzum (1, 2), CaeraDenoir, serial-coder, stackachu, 0xkazim, josephdara, Toshii, DeFiHackLabs (1, 2), SpicyMeatball (1, 2), ZdravkoHr (1, 2), nirlin, radev_sw, TuringConsulting, nonseodion, Yanchuan, hash (1, 2), erictee, jasonxiale, _nd_koo, 0xhegel, gizzy, sl1, QiuhaoLi (1, 2), trachev, smiling_heretic, crunch, LokiThe5th, said, lanrebayode77, circlelooper, SovaSlava, osmanozdemir1, Mike_Bello90, TrungOre, Silvermist, Vagner (1, 2), kodyvim, deth, ke1caM (1, 2), Jiamin, 0xStalin (1, 2), almurhasan, peter, audityourcontracts, ggg_ttt_hhh, AM, Eigenvectors (1, 2), 3docSec, Juntao, marqymarq10 (1, 2), 0xComfyCat (1, 2), rvierdiiev (1, 2), ayden, squeaky_cactus, cu5t0mpeo, zaevlad, HChang26, and T1MOH (1, 2)
Without the ability to update maxTotalSupply, borrower has no way to raise more assets in a specific market. Even worse, borrower has to pay extra interest for unused assets all the time because borrower has no way to reduce the max total supply of the market.
Similarly, borrower has to pay extra interest to the no-longer-used market all the time because there is no way to close it.
Proof of Concept
There are access controls on functions setMaxTotalSupply() and closeMarket(), and only WildcatMarketController is allowed to access them; however, there is not a function in WildcatMarketController allowing the borrower to access them.
Recommended Mitigation Steps
Add setMaxTotalSupply() and closeMarket() in WildcatMarketController to allow the borrower access these functions:
function setMaxTotalSupply(address market, uint256 _maxTotalSupply) external onlyBorrower {
WildcatMarket(market).setMaxTotalSupply(_maxTotalSupply);
}
function closeMarket(address market) external onlyBorrower {
WildcatMarket(market).closeMarket();
}
Assessed type
Access Control
laurenceday (Wildcat) commented:
Lodging a protest against the High Risk decision, however:
- Markets could still effectively be closed by all lenders redeeming their market tokens; the borrower handling these repayments ad hoc and the borrower removing all lenders from the appropriate controller to prevent future deposits. No funds are at risk here.
- The inability to increase or decrease the capacity from the controller - which can lead to more interest accruing to a lender that refuses to withdraw - is not a matter of funds being “lost” but rather a grieving.
In either case, assets are not at direct risk while in the market: the definition of High Risk as given by the label is “assets can be stolen/lost/compromised directly”.
This does not apply here. It’s certainly a Medium; however, and a valuable finding in and of itself.
I partially agree with the sponsor. However, if the protocol was deployed with this bug, it would lack 2 core functionalities.
A protocol being fully functional as intended, which is crucial to attract and keep customers/users with funds in the long term, can be considered a valuable asset itself.
Although Medium severity is predestined for this category of findings which impede the function of a protocol, High severity seems justified given the impact.
The following might further clarify my reasoning:
- Please also consider that not all findings that lead to lost or stolen funds will strictly yield a High severity finding, since it depends on the amount of funds at risk.
- In contrast, not every impeded functionality will only yield Medium severity.
laurenceday (Wildcat) confirmed and commented:
Fair enough - not going to throw toys out of the pram over semantics. Appreciate the feedback!
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
Root cause
Likely the controller contract was never given borrower-only wrapper functions for the market's setMaxTotalSupply and closeMarket, so the access control on those functions left no reachable path for the borrower.
Impact
The borrower could not adjust a market's supply cap or close an unused market, so they kept accruing interest on unused assets; the sponsor argued no funds were directly at risk, while the judge rated it High because two core functions were missing.
What the attacker needed
Borrower role on a deployed market
The fix
Borrower-only functions were added to the controller that forward calls to the market's setMaxTotalSupply and closeMarket, and the sponsor says it was mitigated.
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.
A lending market lets a borrower take funds from lenders up to a set limit. The code that changes that limit or shuts the market down only accepts calls from a middle-man contract, but that middle-man never offered the borrower a way to trigger it. So the borrower was locked out of two basic controls and kept paying interest on money nobody was using.
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.