Frankencoin - kodyvim'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: 107/199

Findings: 2

Award: $22.67

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

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

Vulnerability details

Impact

In Equity contract restructureCapTable aims to restructure the system after a devastating loss but fails to burn all participating members token. Which affects the efforts to restructure the system after a devastating loss since only the token of the first address would be burnt.

Proof of Concept

function restructureCapTable(address[] calldata helpers, address[] calldata addressesToWipe) public {
        require(zchf.equity() < MINIMUM_EQUITY);
        checkQualified(msg.sender, helpers);
        for (uint256 i = 0; i<addressesToWipe.length; i++){
            address current = addressesToWipe[0];//@audit-issue only the first address
            _burn(current, balanceOf(current));
        }
    }

Tools Used

Manuel Review

Replace addressesToWipe[0] to addressesToWipe[i]

#0 - c4-pre-sort

2023-04-20T14:24:29Z

0xA5DF marked the issue as duplicate of #941

#1 - c4-judge

2023-05-18T14:28:48Z

hansfriese marked the issue as satisfactory

QA report:

suggestMinter can be initially frontrunned.

https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Frankencoin.sol#L83 suggestMinter does the following check.

if (_applicationPeriod < MIN_APPLICATION_PERIOD && totalSupply() > 0) revert PeriodTooShort(); if (_applicationFee < MIN_FEE && totalSupply() > 0) revert FeeTooLow(); if (minters[_minter] != 0) revert AlreadyRegistered();

This means during deployment totalSupply() would be zero, an attacker or bot monitoring the mempool for such transaction could frontrun the call to suggestMinter setting their own minter address with _applicationPeriod = 0 and _applicationFee = 0, this would bypass the check since && is used. Recommendation: Add a check if (totalSupply() == 0 && msg.sender != INITIAL_DEPLOYER) revert NOT_AUTHORIZED; to the suggestMinter function, with this you can also remove the other checks for totalSupply() saving gas as well.

expectedSize parameter does not guard against frontrunners.

https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/MintingHub.sol#L199 This parameter does not guard against frontrunners since MEV bot could read the calldata or follow the evm traces.

Recommendations:

Follow a commit-Reveal Scheme.

#0 - 0xA5DF

2023-04-26T19:26:48Z

#1 is dupe of #921 #2 seems wrong

#1 - c4-judge

2023-05-16T16:29:42Z

hansfriese marked the issue as grade-b

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