Trader Joe v2 contest - Rahoz's results

One-stop-shop decentralized trading on Avalanche.

General Information

Platform: Code4rena

Start Date: 14/10/2022

Pot Size: $100,000 USDC

Total HM: 12

Participants: 75

Period: 9 days

Judge: GalloDaSballo

Total Solo HM: 1

Id: 171

League: ETH

Trader Joe

Findings Distribution

Researcher Performance

Rank: 49/75

Findings: 1

Award: $0.97

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: rbserver

Also found by: 8olidity, ElKu, Rahoz, TomJ, Trust, cccz, d3e4, hyh, lukris02, m_Rassska, neumo, pashov, vv7

Labels

bug
2 (Med Risk)
satisfactory
duplicate-469

Awards

0.9728 USDC - $0.97

External Links

Lines of code

https://github.com/code-423n4/2022-10-traderjoe/blob/79f25d48b907f9d0379dd803fc2abc9c5f57db93/src/LBRouter.sol#L493-L521

Vulnerability details

Impact

LBRouter.swapAVAXForExactTokens The payable function swapAVAXForExactTokens will use amountsIn[0] which was calculated from _getAmountsIn and call swap, so when msg.value > amountsIn[0] it should transfer leftover AVAX to sender. Currently it can be underflow by calculate amountsIn[0] - msg.value

Proof of Concept

https://github.com/code-423n4/2022-10-traderjoe/blob/79f25d48b907f9d0379dd803fc2abc9c5f57db93/src/LBRouter.sol#L493-L521

if (msg.value > amountsIn[0]) _safeTransferAVAX(_to, amountsIn[0] - msg.value);

Should transfer amount by msg.value - amountsIn[0]

#0 - GalloDaSballo

2022-10-26T18:27:18Z

#1 - GalloDaSballo

2022-11-13T19:54:01Z

L

#2 - c4-judge

2022-11-13T19:54:05Z

GalloDaSballo changed the severity to QA (Quality Assurance)

#3 - Simon-Busch

2022-11-21T06:22:24Z

Reverted to M as requested by @GalloDaSballo Duplicate of https://github.com/code-423n4/2022-10-traderjoe-findings/issues/469

#4 - Simon-Busch

2022-12-05T06:44:21Z

Marked this issue as satisfactory as requested by @GalloDaSballo

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