Adversary can force user to pay large gas fees by transfering them collateral
When a user transfers collateral to another user who has no existing balance, the receiver's collateral is automatically enabled. This increases the gas cost for the receiver on any action that requires a health check, and with enough collateral types it could become a denial of service.
Submitted by 0x52
Adversary can DOS user and make them pay more gas by sending them collateral.
Proof of Concept
if (fromConfig.isUsingAsCollateral(reserveId)) {
if (fromConfig.isBorrowingAny()) {
ValidationLogic.validateHFAndLtvERC20(
reservesData,
reservesList,
usersConfig[params.from],
params.asset,
params.from,
params.reservesCount,
params.oracle
);
}
if (params.balanceFromBefore == params.amount) {
fromConfig.setUsingAsCollateral(reserveId, false);
emit ReserveUsedAsCollateralDisabled(
params.asset,
params.from
);
}
//@audit collateral is automatically turned on for receiver
if (params.balanceToBefore == 0) {
DataTypes.UserConfigurationMap
storage toConfig = usersConfig[params.to];
toConfig.setUsingAsCollateral(reserveId, true);
emit ReserveUsedAsCollateralEnabled(
params.asset,
params.to
);
}
}
The above lines are executed when a user transfer collateral to another user. If the sending user currently has the collateral enabled and the receiving user doesn’t have a balance already, the collateral will automatically be enabled for the receiver. Since the collateral is enabled, it will now be factored into the health check calculation. This increases gas for the receiver every time the user does anything that requires a health check (which ironically includes turning off a collateral). If enough different kinds of collateral are added to the platform it may even be enough gas to DOS the users.
Recommended Mitigation Steps
Don’t automatically enable the collateral for the receiver.
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 transfer logic automatically enables the received asset as collateral for the receiver when their balance was previously zero, without the receiver opting in.
Impact
An attacker could force a victim to pay higher gas fees on actions that require a health check, and if enough collateral types exist this may even become a denial of service.
What the attacker needed
Victim has no existing balance of the asset; attacker can transfer collateral to victim
The fix
The collateral should not be automatically enabled for the receiver; the receiver should opt in.
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 this lending protocol, collateral is an asset you deposit to back a loan. The health check is a calculation that verifies your loans are still safe. The code automatically turns on collateral for someone who receives a transfer, which makes that health check more expensive to run, so the receiver pays more gas (the fee for processing a transaction) for many actions.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.