Skip to content
Business logic Audit finding Intermediate

Tokens not owned by an account can be added as an asset to the account

The controllers incorrectly add tokens to an account's asset list even when the account did not receive those tokens, because the canCall functions return token addresses that were not actually transferred to the account. An attacker could have tokens they do not own appear in their asset list, though the report notes this does not affect collateral calculation.

Bahurum Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-01-sentiment-judging/issues/26

Found by

Bahurum

Summary

In the controllers RewardRouterController, RewardRouterV2Controller and DNGMXVaultController the function canCall can return in tokenIn a token address that has actually not been received by the account. If the account did not have the token before, than the token is added to the asset list of the account even if the account does not hold the token at all.

Vulnerability Detail

  • in RewardRouterController: in canCallCompound(), WETH is added to tokensIn but no tokens are sent to the account as a result of the call to the Reward Router's function compound()
  • in RewardRouterV2Controller: in canCallRedeem() the token redeemed is added to tokensIn, but the router's function unstakeAndRedeemGlp() allows to send the tokens to a 3rd party receiver instead of the caller. In such a case, nop tokens are sent to the account.
  • in DNGMXVaultController: in canWithdraw() the token redeemed is added to tokensIn, but the DN GMX vault's functions redeemToken() and withdrawToken() allow to send the tokens to a 3rd party receiver instead of the caller. In such a case, nop tokens are sent to the account.

Impact

There can be tokens in the list of assets of an account that the account doesn't actually hold. Note that this does not pose any issues for the calculation of collateral.

Code Snippet

https://github.com/sherlock-audit/2023-01-sentiment/blob/main/controller-55/src/gmx/RewardRouterController.sol#L67

https://github.com/sherlock-audit/2023-01-sentiment/blob/main/controller-55/src/gmx/RewardRouterV2Controller.sol#L88

https://github.com/sherlock-audit/2023-01-sentiment/blob/main/controller-55/src/gmx/RewardRouterV2Controller.sol#L88

Tool used

Manual Review

Recommendation

No particular reccommendation.

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

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

Likely the canCall functions assume tokens are always sent to the caller, but the underlying router functions allow specifying a different receiver, so the tokensIn list is populated without verifying actual receipt.

Impact

Tokens that an account does not hold can appear in its asset list, but the report states this does not pose issues for collateral calculation.

What the attacker needed

Account interacts with affected controllers

The fix

No particular recommendation was provided; the issue should be fixed by ensuring tokensIn only includes tokens actually received by the account.

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.

In some smart contracts, when a user performs an action, the system records which tokens they received. Here, the system sometimes records tokens that the user never actually got, because the tokens were sent to someone else or not sent at all. This means a user's list of assets can show tokens they do not own, but the report says this does not break the collateral calculation.

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 Bahurum

View all

10 more disclosed reports, best first.

More from Sentiment Update #3

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.