This repository has been archived by the owner on May 26, 2023. It is now read-only.
obront - All Rage Trade functions allow sending tokens to a different address, leading to incorrect tokensIn #5
Labels
Disagree With Severity
The sponsor disputed the severity of this issue
Escalation Resolved
This issue's escalations have been approved/rejected
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Will Fix
The sponsor confirmed this issue will be fixed
obront
medium
All Rage Trade functions allow sending tokens to a different address, leading to incorrect tokensIn
Summary
All three approved functions on Rage Trade (
depositTokens()
,withdrawTokens()
andredeemTokens()
) allow for areceiver
argument to be included, which sends the resulting tokens to that address. The corresponding Controller assumes that all tokens are withdrawn to the Sentiment account that called the function.Vulnerability Detail
The three functions that can be called on Rage Trade have the following signatures:
Each of these functions contains a
receiver
argument, which can be passed any address that will receive the outputted tokens.The DNGMXVaultController incorrectly assumes in all cases that the outputted tokens will be received by the Sentiment account in question, regardless of what is entered as a receiver.
Impact
Accounting on user accounts can be thrown off (intentionally or unintentionally), resulting in mismatches between their assets array and hasAsset mapping and the reality of their account.
This specific Impact was judged as Medium for multiple issues in the previous contest:
Code Snippet
https://github.com/sherlock-audit/2023-01-sentiment/blob/main/controller-52/src/rage/DNGMXVaultController.sol#L60-L73
https://github.com/sherlock-audit/2023-01-sentiment/blob/main/controller-52/src/rage/DNGMXVaultController.sol#L75-L88
Tool used
Manual Review
Recommendation
When decoding the data from the call to Rage Trade, confirm that receiver == msg.sender. Here's an example with the deposit function:
function canDeposit(bytes calldata data) internal view returns (bool, address[] memory, address[] memory) { (address token, address receiver,) = abi.decode( data, (address, address, uint256) ); + if (receiver != msg.sender) return (true, vault, new address[](0)); address[] memory tokensOut = new address[](1); tokensOut[0] = token; return (true, vault, tokensOut); }
The text was updated successfully, but these errors were encountered: