Comptroller::withdraw function can be called by non-owner which leads to fund to get withdrawn without the owner intention
Summary
The withdrawRewards funciton is intended to withdraw rewards when the caller calls this function with the address and token as input. However, it fails to check whether the account given as input is the caller or any arbitary account. Which can potentially leads to protocol to withdraw amount for an address which is not expecting to receive their rewards.
Root Cause
Root cause of this vulnerability is the missing check whether the caller is the same address whose token is being withdrawn
Malicious caller can calls this function with any arbitary address, leading the protocol to withdraws the rewards of unexpecting user or address without their permission or intention.
Bugvorus
Medium
Comptroller::withdraw
function can be called by non-owner which leads to fund to get withdrawn without the owner intentionSummary
The
withdrawRewards
funciton is intended to withdraw rewards when the caller calls this function with the address andtoken
as input. However, it fails to check whether the account given as input is the caller or any arbitary account. Which can potentially leads to protocol to withdraw amount for an address which is not expecting to receive their rewards.Root Cause
Root cause of this vulnerability is the missing check whether the caller is the same address whose token is being withdrawn
Code-Snippet:
https://github.com/sherlock-audit/2024-06-union-finance-update-2/blob/main/union-v2-contracts/contracts/token/Comptroller.sol#L199
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
Malicious caller can calls this function with any arbitary address, leading the protocol to withdraws the rewards of unexpecting user or address without their permission or intention.
PoC
No response
Mitigation
I recommend the following changes: