Trader Joe v2 contest - hxzy'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: 62/75

Findings: 1

Award: $0.33

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Awards

0.3268 USDC - $0.33

Labels

bug
3 (High Risk)
edited-by-warden
satisfactory
duplicate-299

External Links

Lines of code

https://github.com/code-423n4/2022-10-traderjoe/blob/main/src/LBToken.sol#L182-L192

Vulnerability details

Impact

When a user holds a certain number of tokens with a specified id, the user can double the number of tokens they hold by transferring money to themselves. Repeated transfers to themselves can achieve the effect of unlimited issuance of tokens with a specified id.

Proof of Concept

In the _transfer of the LBToken contract, if the from address and the to address are the same address, the execution result of line 191 will overwrite the execution result of the previous line of code. Affected code locations: https://github.com/code-423n4/2022-10-traderjoe/blob/main/src/LBToken.sol#L182-L192

For the convenience of testing, I set the _mint function property to public. First, mint 100 tokens with an id of 1 to yourself (as shown in 1 in the picture below), and then call safeTransferFrom to transfer all tokens to your own address (as shown in 2 in the picture below). Then call the balanceOf function to query the number of tokens with its own address id 1. You can see that it has become 200 (as shown in 3 in the picture below), but in fact the total number of tokens with id 1 is 100 ( as shown in 4 in the image linked below). https://drive.google.com/file/d/1TJyW9sGpYERyZBB7MdTD9kmIp4liwNni/view?usp=sharing

Tools Used

Remix, VS code

It is recommended that safeTransferFrom cannot be called for token transfer when the from and to addresses are the same.

#0 - trust1995

2022-10-23T21:52:59Z

Dup of #422

#1 - GalloDaSballo

2022-10-26T16:35:43Z

#2 - c4-judge

2022-11-23T18:28:30Z

GalloDaSballo marked the issue as not a duplicate

#3 - c4-judge

2022-11-23T18:29:03Z

GalloDaSballo marked the issue as duplicate of #299

#4 - Simon-Busch

2022-12-05T06:39:40Z

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