Frankencoin - 4710710N's results

A decentralized and fully collateralized stablecoin.

General Information

Platform: Code4rena

Start Date: 12/04/2023

Pot Size: $60,500 USDC

Total HM: 21

Participants: 199

Period: 7 days

Judge: hansfriese

Total Solo HM: 5

Id: 231

League: ETH

Frankencoin

Findings Distribution

Researcher Performance

Rank: 15/199

Findings: 1

Award: $700.83

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: John

Also found by: 4710710N

Labels

bug
2 (Med Risk)
satisfactory
duplicate-454

Awards

700.8278 USDC - $700.83

External Links

Lines of code

https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol#L132

Vulnerability details

Impact

Increasing collateral and decreasing it's liquidation price, such that with new liquidation price and old collateral position is becoming unsound, leads to a revert. Such situation can happen often, imagine position that's fully minted and has market price of collateral close to liquidation, in this case, to keep position from liquidation, owner will add collateral and decrease liquidation price. Since it's fully minted, any decrease in liquidation price will lead to revert.

Proof of Concept

calling adjust with newPrice < price and newCollateral > collateralBalance() will lead to these consecutive calls https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol#L134 https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol#L163 https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol#L283 and could revert, since collateralReserve equals to CollateralBalance(), which wasn't updated yet https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol#L138

Place if (newPrice != price) clause after if (newMinted < minted)

#0 - c4-pre-sort

2023-04-24T07:01:23Z

0xA5DF marked the issue as duplicate of #454

#1 - c4-judge

2023-05-18T10:40:31Z

hansfriese marked the issue as satisfactory

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter