Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liquidation Can Be Prevented by Triggering Cooldown Expiration #235

Closed
c4-bot-3 opened this issue Jan 26, 2024 · 3 comments
Closed

Liquidation Can Be Prevented by Triggering Cooldown Expiration #235

c4-bot-3 opened this issue Jan 26, 2024 · 3 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-312 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@c4-bot-3
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/stable/CollateralAndLiquidity.sol#L154

Vulnerability details

Impact

Liquidations can be prevented by a user increasing or decreasing their share amount to reset the cooldown for decreasing shares.

Proof of Concept

In the liquidateUser function, the call to _decreaseUserShare passes in true for the useCooldown parameter. This means that any calls to liquidate will revert when the user's position is in cooldown.

if ( useCooldown )
		if ( msg.sender != address(exchangeConfig.dao()) ) // DAO doesn't use the cooldown
			{
			require( block.timestamp >= user.cooldownExpiration, "Must wait for the cooldown to expire" );


			user.cooldownExpiration = block.timestamp + stakingConfig.modificationCooldown();
			}

A user can easily trigger the cooldownExpiration by calling depositCollateralAndIncreaseShare. A user can deposit liquidity even if their position is currently liquidatable. The cooldownExpiration for increasing and decreasing shares is the same, so this affects liquidations at all. Therefore the user can prevent liquidations on their insolvent positions indefinitely.

Tools Used

Manual review

Recommended Mitigation Steps

The fix is simple: the bool value false rather than true should be used when calling the _decreaseUserShare() function within liquidateUser

Assessed type

DoS

@c4-bot-3 c4-bot-3 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Jan 26, 2024
c4-bot-3 added a commit that referenced this issue Jan 26, 2024
@c4-judge
Copy link
Contributor

Picodes marked the issue as duplicate of #891

@c4-judge
Copy link
Contributor

Picodes marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Feb 21, 2024
@thebrittfactor
Copy link

For transparency, the judge confirmed issue should be marked as duplicate-312.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-312 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants