LI.FI contest - minhquanym's results

Bridge & DEX Aggregation.

General Information

Platform: Code4rena

Start Date: 24/03/2022

Pot Size: $75,000 USDC

Total HM: 15

Participants: 59

Period: 7 days

Judge: gzeon

Id: 103

League: ETH

LI.FI

Findings Distribution

Researcher Performance

Rank: 59/59

Findings: 1

Award: $61.54

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Awards

61.5429 USDC - $61.54

Labels

disagree with severity
G (Gas Optimization)
resolved

External Links

Lines of code

https://github.com/code-423n4/2022-03-lifinance/blob/699c2305fcfb6fe8862b75b26d1d8a2f46a551e6/src/Libraries/LibAsset.sol#L67-L68

Vulnerability details

Impact

  • In function approveERC20 of LibAsset, line 67 safeApprove to 0 before safeApprove to MAX_INT in line 68. This is because we can only approve their allowance to zero or from zero in SafeERC20.
  • In SafeERC20, it is used to prevent front-run by approved addresses and usually users have to do 2 TXs.
  • But when we do both in 1 TX, it does not add any layer of security and just wasting gas. Such behavior creates a false sense of security.

Proof of concept

  • Simply call IERC20(assetId).approve(spender, MAX_INT);

#0 - maxklenk

2022-04-14T15:32:09Z

Thanks for your suggestion. We have improved the handling to save gas and renamed the function to be more easy to read. We disagree with the risk attached as it is only a gas improvement.

#1 - gzeoneth

2022-04-16T17:44:50Z

Labeling as gas optimization.

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