Skip to content
Business logic Audit finding Beginner

`FeeBuyback` native token can not be rescued

The FeeBuyback contract lacks a method to rescue native tokens, so any native tokens sent to it as part of a swap or otherwise become permanently stuck. An attacker cannot directly exploit this, but users may lose funds.

WatchPug Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-11-telcoin-judging/issues/80

Found by

WATCHPUG

Summary

Lack of methods to rescue native tokens trapped in the FeeBuyback contract.

Vulnerability Detail

Like ERC20 tokens, the native token may also get stuck in the FeeBuyback contract for all sorts of reasons.

For example, at L77, the _aggregator is called with a msg.value, which means that the native token can be used as an inToken for the swap. Therefore, part of the input native token can be sent back to the FeeBuyback contract as a leftover.

However, the current implementation of rescueERC20() only supports rescue ERC20 tokens.

Impact

The leftover native tokens trapped in the contract can not be rescued.

Code Snippet

https://github.com/sherlock-audit/2022-11-telcoin/blob/main/contracts/fee-buyback/FeeBuyback.sol#L77-L78

https://github.com/sherlock-audit/2022-11-telcoin/blob/main/contracts/fee-buyback/FeeBuyback.sol#L94-L97

Tool used

Manual Review

Recommendation

Consider adding support to rescue native tokens.

Discussion

amshirif

https://github.com/telcoin/telcoin-staking/pull/10

jack-the-pug

Fix confirmed

The original report as published on Sherlock, by WATCHPUG. 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

The contract only implements a rescue function for ERC20 tokens, not for the native token.

Impact

Leftover native tokens trapped in the contract cannot be rescued, resulting in permanent loss of funds.

What the attacker needed

None

The fix

The issue was fixed by adding support to rescue native tokens.

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.

This smart contract can receive the blockchain's native token (like ETH) but has no function to send it out. If native tokens end up in the contract, they are stuck forever because only ERC20 tokens can be rescued.

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 WatchPug

View all

197 more disclosed reports, best first.

More from Telcoin Platform Audit

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.