Skip to content
Access control Audit finding Beginner

Teller Cannot Be Removed From Callback Contract

The Callback Contract lacks a function to remove a Teller from its whitelist once added. If a whitelisted Teller becomes vulnerable and is exploited, the owner cannot quickly remove it, potentially allowing an attacker to drain assets from the Callback Contract.

xiaoming90 Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-11-bond-judging/issues/18

Found by

xiaoming90

Summary

If a vulnerable Teller is being exploited by an attacker, there is no way for the owner of the Callback Contract to remove the vulnerable Teller from their Callback Contract.

Vulnerability Detail

The Callback Contract is missing the feature to remove a Teller. Once a Teller has been added to the whitelist (approvedMarkets mapping), it is not possible to remove the Teller from the whitelist.

https://github.com/sherlock-audit/2022-11-bond/blob/main/src/bases/BondBaseCallback.sol#L59

Solidity
File: BondBaseCallback.sol
56:     /* ========== WHITELISTING ========== */
57: 
58:     /// @inheritdoc IBondCallback
59:     function whitelist(address teller_, uint256 id_) external override onlyOwner {
60:         // Check that the market id is a valid, live market on the aggregator
61:         try _aggregator.isLive(id_) returns (bool live) {
62:             if (!live) revert Callback_MarketNotSupported(id_);
63:         } catch {
64:             revert Callback_MarketNotSupported(id_);
65:         }
66: 
67:         // Check that the provided teller is the teller for the market ID on the stored aggregator
68:         // We could pull the teller from the aggregator, but requiring the teller to be passed in
69:         // is more explicit about which contract is being whitelisted
70:         if (teller_ != address(_aggregator.getTeller(id_))) revert Callback_TellerMismatch();
71: 
72:         approvedMarkets[teller_][id_] = true;
73:     }

Impact

In the event that a whitelisted Teller is found to be vulnerable and has been actively exploited by an attacker in the wild, the owner of the Callback Contract needs to mitigate the issue swiftly by removing the vulnerable Teller from the Callback Contract to stop it from draining the asset within the Callback Contract. However, the mitigation effort will be hindered by the fact there is no way to remove a Teller within the Callback Contract once it has been whitelisted. Thus, it might not be possible to stop the attacker from exploiting the vulnerable Teller to drain assets within the Callback Contract. The Callback Contract owners would need to find a workaround to block the attack, which will introduce an unnecessary delay to the recovery process where every second counts.

Additionally, if the owner accidentally whitelisted the wrong Teller, there is no way to remove it.

Code Snippet

https://github.com/sherlock-audit/2022-11-bond/blob/main/src/bases/BondBaseCallback.sol#L59

Tool used

Manual Review

Recommendation

Consider implementing an additional function to allow the removal of a Teller from the whitelist (approvedMarkets mapping), so that a vulnerable Teller can be removed swiftly if needed.

Solidity
function removeFromWhitelist(address teller_, uint256 id_) external override onlyOwner {
    approvedMarkets[teller_][id_] = false;
}

Note: Although the owner of the Callback Contract can DOS its own market by abusing the removeFromWhitelist function, no sensible owner would do so.

Discussion

Evert0x

Message from sponsor


Agree with this issue. We implemented a blacklist() function on the BondBaseCallback.sol contract to allow removing a teller and market ID combination from using the callback.

xiaoming9090

Fixed in https://github.com/Bond-Protocol/bonds/commit/368e6c5b120d9fc44c59cc21d33ee51728728067

The original report as published on Sherlock, by xiaoming90. 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 whitelist function only adds entries to the approvedMarkets mapping and there is no corresponding function to remove them.

Impact

If a whitelisted Teller is exploited, the owner cannot remove it, potentially allowing the attacker to drain assets from the Callback Contract.

What the attacker needed

A Teller is whitelisted; the Teller becomes vulnerable and is exploited

The fix

A blacklist function was added to allow removing a teller and market ID combination from the whitelist.

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.

A smart contract called the Callback Contract keeps a list of approved Teller contracts. Once a Teller is added, it can never be removed. If that Teller later has a security flaw, the owner cannot stop it from being used, which could let an attacker steal funds.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by xiaoming90

View all

122 more disclosed reports, best first.

More from Bond Options

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.