This repository has been archived by the owner on Jul 21, 2024. It is now read-only.
0xhashiman - Proposer can drain all Telcoin #91
Labels
Excluded
Excluded by the judge without consulting the protocol or the senior
Non-Reward
This issue will not receive a payout
Sponsor Disputed
The sponsor disputed this issue's validity
Won't Fix
The sponsor confirmed this issue will not be fixed
0xhashiman
high
Proposer can drain all Telcoin
Summary
In TelcoinDistributor.sol, a malicious proposer can drain all Telcoin by exploiting the executeTransaction() function.
Vulnerability Detail
When a council member proposes a new proposal, they can specify the
totalWithdrawal
amount. This amount is directly transferred from the owner's wallet when calling the functionexecuteTransaction(uint256 transactionId)
. As there is no limit to cap this withdrawal amount, a malicious proposer can execute a valid proposal, withdrawing the entire balance of the owner. The only limit is the amount of tokens that the owner approved for the contract. According to a response from the protocol team on Discord, this approval amount will likely be less than the maximum for security reasons, but large enough to avoid running a transaction every time.Protocol team answer in discord for how much the approval amount will be .
Likely it will be less than the max for security, but large enough so that a transaction does not need to be run every time.
The line responsible for the transfer from the owner to the TelcoinDistributor contract:
Additionally, a Proof of Concept is provided to illustrate the exact vulnerability described above. Add it in TelcoinDistributor.test.ts and run it using
Impact
The vulnerability allows a proposer to drain the entire balance owned by the protocol's owner, causing severe damage.
Code Snippet
https://github.com/sherlock-audit/2024-01-telcoin/blob/main/telcoin-audit/contracts/protocol/core/TelcoinDistributor.sol#L87-L106
https://github.com/sherlock-audit/2024-01-telcoin/blob/main/telcoin-audit/contracts/protocol/core/TelcoinDistributor.sol#L143-L175
https://github.com/sherlock-audit/2024-01-telcoin/blob/main/telcoin-audit/contracts/protocol/core/TelcoinDistributor.sol#L185-L203
Tool used
Manual Review
Recommendation
I suggest implementing a maximum limit
maxTotalWithdrawal
for all withdrawals to cap the amount. Additionally, consider adding a setter function for the owner to adjust this limit, either reducing it or increasing it within reasonable bounds. Also, introduce a check for maxTotalWithdrawal in the proposeTransaction() function to ensure proposed transactions adhere to the specified limit.The text was updated successfully, but these errors were encountered: