No checks if given product is created by the factory
The Collateral contract does not verify that a product was created by the factory, allowing an attacker to deploy a fake product that returns arbitrary maintenance amounts. This lets the attacker make deposits to the fake product stuck and later liquidate to claim the full collateral.
Submitted by 0x0x0x
An attacker can create a fake product. Collateral contract does not check whether the given product is created by the factory. A malicious product can return arbitrary maintenance amounts, therefore they can make any deposit to fake product stuck (simply return collateral - 1 as maintenance) and fake product owner can change the maintenance and liquidate whenever wanted and claim full collateral.
This is a serious attack vector, since by only interacting with Collateral contract the user can lose funds. Furthermore, this vulnerability poses big risks in combination web vulnerabilities. Users always have to check the product address to avoid getting scammed, but likely most users will only check the contract address.
Furthermore, if another protocol would want to add perennial protocol for its use case, the other protocol has to be careful with this behaviour and keep track of whitelisted products. This complicates adoption of perennial protocol, since whitelist has to be managed manually or else this vulnerability will likely be exploitable.
Mitigation step
Add a mapping inside Collateral, which verifies whether a product is created by factory or not. This mapping should get updated by the factory. This will add a little bit gas cost, but will eliminate a serious attack vector.
Or less gas efficient option is directly call a function from factory to verify.
kbrizzle (Perennial) disagreed with severity:
Good find 🙏
On severity: In general there’s a whole plethora of ways a Product owner could create a product that harmful a user which choses to take part in it. The design model of Perennial is to give the Product owners the freedom to create risky products, but to segregate that risk to only those products, and this issue does not break this segregation of risk. This is especially important during our gated-beta phase while we learn which levers are worth it to lock down.
That being said this is low hanging fruit to correct, so we think it should still be
2 (Medium)severity.
Alex the Entreprenerd (judge) commented:
Given the extensible nature of the
Collateralcontract, users can call the contract with any user input forproductthis could be used maliciously against the users as the warden highlighted.This can definitely happen, but is contingent on a set of external factors, so I think medium severity is more appropriate
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
The Collateral contract lacks a check that the product address was created by the factory, so it accepts arbitrary malicious contracts.
Impact
Users who interact with a fake product can lose their deposited funds, and the attack is easy to perform by only interacting with the Collateral contract.
What the attacker needed
Attacker can deploy a fake product; victim deposits into the fake product
The fix
Add a mapping in Collateral, updated by the factory, to verify that a product was created by the factory, or call a factory function to verify.
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 smart contract lets users deposit funds into 'products'. The main contract trusts any product address it is given, without checking that the product was made by the official factory. An attacker can make a fake product that lies about how much maintenance is needed, so users who deposit into it cannot withdraw, and the attacker can take all the money.
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.