Skip to content
Business logic Audit finding Intermediate

LaunchToken transfers cause staking rewards to be lost to the LaunchPad

When LaunchTokens are transferred, the Distributor pays out pending staking earnings to the LaunchPad contract instead of the token holder, because it uses the wrong recipient address. A user who receives tokens can therefore lose all the staking earnings they were entitled to.

hgrano Follow with 0rpse, 0xanony and 48 others

Originally disclosed on Code4rena

Submitted by hgrano, also found by 0rpse, 0xanony, 0xAsen, 0xAura, 0xIconart, 0xMilenov, 0xnija, 0xsagetony, 0xsai, 0xvd, air_0x, AvantGard, Ayomiposi233, Bale, BenRai, boredpukar, c0pp3rscr3w3r, ChainSentry, codegpt, deccs, derastephh, dray, dreamcoder, Egbe, Ekene, emmac002, eth_11, gizzy, HalfBloodPrince, hashbug, hecker_trieu_tien, hezze, Idealz-hacks, IvanAlexandur, jerry0422, JuggerNaut63, KuwaTakushi, Ky0toFu, levantequarini, lodelux, lufP, max10afternoon, mightyraj2605, mrMorningstar, mzfr, nem0TheFinder, Nexarion, niffylord, nonso72, nuthan2x, odeili, osok, prk0, r1ver, ret2basic, Rhaydden, roccomania, serial-coder, SeveritySquad, solhhj, The_Amazing_One, Tofu, Tough, udogodwin, unnamed, veerendravamshi, VinciGearHead, Wolf_Kalp, won, yeahChibyke, ZeroEx, and zzebra83

  • launchpad/Distributor.sol #L170
  • launchpad/Distributor.sol #L175

During LaunchToken transfers the Distributor mistakenly distributes rewards to the msg.sender (which is the LaunchPad) rather than the token holder. Consider this code execution path assuming the token is not unlocked yet:

  1. LaunchToken::transferFrom is called.
  2. LaunchToken::_beforeTokenTransfer hook is executed which calls increaseStake on the LaunchPad contract for the to account.
  3. LaunchPad contract will then call increaseStake on the Distributor.
  4. Assuming the to account has pending earnings, the Distributor then distributes earnings to the account on lines 170 and 175 of Distributor.sol, however the transfer is done to the msg.sender - the LaunchPad - rather than the to account.

Impact: partial or complete loss of staking earnings for users. As shown in the attached PoC, all it takes is for a user to send some LaunchTokens to another user and the recipient loses all of the earnings they would otherwise be entitled to.

Recommended mitigation steps

Modify lines 170 and 175 of Distributor.sol so msg.sender is replaced with the correct account.

View detailed Proof of Concept


The original report as published on Code4rena, by hgrano. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The Distributor's payout logic uses msg.sender (the LaunchPad contract calling it) as the recipient instead of the actual token holder account.

Impact

Users could partially or completely lose their staking earnings simply by receiving a LaunchToken transfer.

What the attacker needed

Token not yet unlocked; recipient has pending earnings; someone sends tokens to the recipient

The fix

Lines 170 and 175 of Distributor.sol should be changed so msg.sender is replaced with the correct account.

How it was found

  1. Call transferFrom on the LaunchToken contract.
  2. The token's before-transfer hook calls increaseStake on the LaunchPad for the recipient.
  3. The LaunchPad calls increaseStake on the Distributor.
  4. If the recipient has pending earnings, the Distributor pays them to msg.sender, the LaunchPad, instead of the recipient.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A staking reward is a payment given to people who hold a token. Here, when tokens move from one person to another, the code that pays out those rewards sends the money to the wrong address, the platform contract, instead of the person receiving the tokens. That person then loses rewards they had earned.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by hgrano

View all

10 more disclosed reports, best first.

More from GTE Perps and Launchpad

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.