A malicious/compromised Registry or Factory admin can drain all the funds from the Vault contracts
The Vault contract lets any address listed as a market in the Registry borrow tokens and send them to any address, with no cap on the amount. A malicious or compromised Registry or Factory admin could register a market and drain all funds held in the Vault.
Submitted by WatchPug
modifier onlyMarket() {
require(
IRegistry(registry).isListed(msg.sender),
"ERROR_ONLY_MARKET"
);
_;
}
function borrowValue(uint256 _amount, address _to) external onlyMarket override {
debts[msg.sender] += _amount;
totalDebt += _amount;
IERC20(token).safeTransfer(_to, _amount);
}
The current design/implementation allows a market address (registered on the registry) to call Vault#borrowValue() and transfer tokens to an arbitrary address.
Proof of Concept
See the PoC section on [WP-H24].
Recommendation
- Consider adding constrains (eg. timelock) to
Registry#supportMarket(). - Consdier adding constrains (upper bound for each pool, and index pool for example) to
Vault#borrowValue().
oishun1112 (Insure) acknowledged and disagreed with severity:
Ownership has to be stolen to drain funds using this method and we assume ownership control driven safely, so we don’t treat this as issue
Agree with warden that the privilege addresses should not be able to use approvals in a way that rugs users funds.
Based on the fact that we have seen many rug pulls in the space based on compromised “owner” keys, this is a valid attack path.
3 — High: Assets can be stolen/lost/compromised directly (or indirectly if there is a valid attack path that does not have hand-wavy hypotheticals).
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
What the attacker needed
Control of Registry or Factory admin key
The fix
The recommendation was to add constraints such as a timelock on supportMarket and an upper bound on borrowValue; the text does not say whether this was implemented.
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 vault holds users' tokens. It trusts a list kept by another contract (the Registry) to decide who may take tokens out. If someone can add an entry to that list, they can take everything, because there is no limit on how much they can withdraw.
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.