Frax Ether Liquid Staking contest - rvierdiiev's results

A liquid ETH staking derivative designed to uniquely leverage the Frax Finance ecosystem.

General Information

Platform: Code4rena

Start Date: 22/09/2022

Pot Size: $30,000 USDC

Total HM: 12

Participants: 133

Period: 3 days

Judge: 0xean

Total Solo HM: 2

Id: 165

League: ETH

Frax Finance

Findings Distribution

Researcher Performance

Rank: 12/133

Findings: 3

Award: $630.30

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

19.982 USDC - $19.98

Labels

bug
duplicate
2 (Med Risk)

External Links

Lines of code

https://github.com/code-423n4/2022-09-frax/blob/main/src/frxETHMinter.sol#L191-L196

Vulnerability details

Impact

frxETHMinter.recoverEther function sends all contract funds to the owner. I has onlyByOwnGov modifier that allows it to be called by owner or timelock contract.

In case where the admin wallet has been hacked, the attacker can drain all funds. Or malicious owner can also send all funds to it.

I would recommend to allow to call that function only for timelock through the governance. Also i would change the function to take an address param as a sender to not send funds to owner only(in case when owner wallet is hacked for example).

Remove ability for the owner to send all funds to himself.

#0 - FortisFortuna

2022-09-25T21:23:13Z

We are well aware of the permission structure. The owner will most likely be a large multisig. We mentioned the Frax Multisig in the scope too. If moving funds, it is assumed someone in the multisig would catch an invalid or malicious address.

#1 - joestakey

2022-09-26T15:00:26Z

Duplicate of #107

Findings Information

🌟 Selected for report: ronnyx2017

Also found by: ayeslick, rvierdiiev

Labels

bug
duplicate
2 (Med Risk)

Awards

582.3084 USDC - $582.31

External Links

Lines of code

https://github.com/code-423n4/2022-09-frax/blob/main/src/frxETHMinter.sol#L166-L174

Vulnerability details

Impact

frxETH is going to be stable coin to eth that means that frxETH should be backed 1:1 with ether. frxETH is minted by frxETHMinter using _submit function. It can be triggered by receive function as well (that's important here).

frxETHMinter.moveWithheldETH function allows to send some amount of currentWithheldETH and then decrease the value that you can withdraw here and sends the value to the provided address to.

If this function will be called(by mistake or no) with param to == address(frxETHMinter), then some amount of ether will be sent to frxETHMinter, that will trigger receive function and then more amount of frxETH token will be minted and frxETH token is not pegged to ether as 1:1 anymore as we minted new frxETH tokens without additional ether supply.

Proof of Concept

This test was ran in frxETHMinterTest. It shows that after withdrawing to minter new frxETH tokens were minted while balance of frxETHMinter remain the same.

function testWithheldToMinter() public { vm.startPrank(FRAX_COMPTROLLER); vm.deal(FRAX_COMPTROLLER, 32 ether); // Set the withhold ratio to 50% (5e5) minter.setWithholdRatio(500000); // Deposit 32 ETH for frxETH vm.expectEmit(true, true, false, true); emit TokenMinterMinted(address(minter), FRAX_COMPTROLLER, 32 ether); vm.expectEmit(true, true, false, true); emit ETHSubmitted(FRAX_COMPTROLLER, FRAX_COMPTROLLER, 32 ether, 16 ether); minter.submit{ value: 32 ether }(); // Check that 16 ether was withheld assertEq(minter.currentWithheldETH(), 16 ether); //amount of frxToken before withdraw uint256 currentSupply = frxETHToken.totalSupply(); uint256 currentMinterBalance = address(minter).balance; minter.moveWithheldETH(payable(minter), minter.currentWithheldETH()); //note that also 50% were withheld assertEq(minter.currentWithheldETH(), 8 ether); //amount of frxToken after withdraw uint256 newSupply = frxETHToken.totalSupply(); uint256 newMinterBalance = address(minter).balance; //we have minted new tokens assertTrue(newSupply > currentSupply); //balance of minter hasn't changed assertTrue(newMinterBalance == currentMinterBalance); vm.stopPrank(); }

Tools Used

VsCode

Make sure that to param is not the frxETHMinter contract.

#0 - FortisFortuna

2022-09-26T00:22:32Z

We are well aware of the permission structure. The owner will most likely be a large multisig. We mentioned the Frax Multisig in the scope too. If moving funds, it is assumed someone in the multisig would catch an invalid or malicious address.

#1 - joestakey

2022-09-26T18:04:00Z

Duplicate of #221

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