Frax Ether Liquid Staking contest - rokinot'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: 49/133

Findings: 3

Award: $53.31

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

12.4859 USDC - $12.49

Labels

bug
duplicate
2 (Med Risk)

External Links

Lines of code

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

Vulnerability details

Impact

Some ERC20s will be unable to be withdrawn.

Proof of Concept

Certain tokens (e.g. USDT,BNB) have no return value on transfers, and so any boolean check for their transfer function will return fail (as no return value will default to false), which reverts the transaction at the specified code line.

Tools Used

Manual code reading

Use safeTransfer() instead of transfer(), like in ERC4626.sol, which is already used as an inherited contract.

#0 - FortisFortuna

2022-09-25T21:46:39Z

Not really medium risk. Technically you could use safeTransfer, but if someone were to accidentally send something to this contract, it would most likely be either ETH, FRAX, frxETH, or sfrxETH, all of which are transfer compliant.

#1 - joestakey

2022-09-26T17:01:15Z

Duplicate of #18

Low

Allowance is overridden for those who already deposited once

For example, if someone deposits 32 ETH, then 32 ETH again the allowance will be 32 instead of 64.

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

Non-critical

sfrxETHToken is not an implementation of IsfrxETHToken

This can be easily verified in sfrxETHtoken.sol, as there's no interface inheritance.

All functions in the contract are missing dev parameters

OperatorRegistry.sol

Functions don't follow camelback style like others

minter_burn_from() and minter_mint()

https://github.com/code-423n4/2022-09-frax/blob/main/src/ERC20/ERC20PermitPermissionedMint.sol#L53 https://github.com/code-423n4/2022-09-frax/blob/main/src/ERC20/ERC20PermitPermissionedMint.sol#L59

Calldata length should not be cached

Calldata access has the same cost as memory access already, so caching calldata -> memory is a waste of gas.

https://github.com/code-423n4/2022-09-frax/blob/main/src/OperatorRegistry.sol#L62

No need to compare boolean variables as true

Instead of require(minters[minter_address] == true, "Address nonexistant"); simply write require(minters[minter_address], "Address nonexistant");

https://github.com/code-423n4/2022-09-frax/blob/main/src/ERC20/ERC20PermitPermissionedMint.sol#L78 https://github.com/code-423n4/2022-09-frax/blob/main/src/ERC20/ERC20PermitPermissionedMint.sol#L46

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