# Callback initiator not bound to caller

Callback handlers that trust msg.sender's self-reported identity or any registered instance instead of the exact expected caller

_Area: Smart contract access control and control flow. Seen in 3 disclosed reports; latest 2024-08-06. Updated 2026-11-22._

## How it works
A callback handler is invoked by an external party (a messenger, a lending pool, a swap router) and must decide whether the call is legitimate. The broken assumption is that the caller's identity can be inferred from what the caller says about itself, or from a loose membership test. Three shapes: the handler asks `msg.sender` for the original sender (`xDomainMessageSender()`) without checking `msg.sender` is the canonical messenger [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-13.md); the handler checks only that `msg.sender` is the lending pool but not that `_initiator` is the contract itself [E2](https://bugbountylibrary.com/r/sherlock%3A2023-05-dodo%3AH-1.md); the validator checks the caller is *a* factory-registered instance rather than *the* expected one [E3](https://bugbountylibrary.com/r/sherlock%3A2023-04-splits%3AM-1.md). In each case an attacker supplies the caller, so the check proves nothing.

## Where it shows up
- Cross-chain handlers calling `ICrossDomainMessenger(msg.sender).xDomainMessageSender()` with no `msg.sender == L2_MESSENGER` assertion [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-13.md)
- Flash-loan `executeOperation`/`onFlashLoan` callbacks that check the pool but ignore `_initiator` [E2](https://bugbountylibrary.com/r/sherlock%3A2023-05-dodo%3AH-1.md)
- "Callback validation" helpers whose only test is `factory.isSwapper(caller)` or similar registry membership [E3](https://bugbountylibrary.com/r/sherlock%3A2023-04-splits%3AM-1.md)
- Callback-only functions reachable by any deployed instance of a registered type, especially where that type inherits arbitrary-call helpers like `execCalls` [E3](https://bugbountylibrary.com/r/sherlock%3A2023-04-splits%3AM-1.md)
- Any handler that reads identity from a caller-controlled return value or parameter

## How to review
For every externally callable callback, name the exact caller(s) allowed and confirm the code compares `msg.sender` (and `_initiator` where the protocol passes one) against a stored, immutable trusted address — not against an interface return value, not against a registry predicate. The invariant: the authenticated identity must be derived from state the attacker cannot set. Then check what the handler does after authenticating: if it can move funds or make arbitrary calls, a single missing equality is total loss [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-13.md)[E3](https://bugbountylibrary.com/r/sherlock%3A2023-04-splits%3AM-1.md).

## How finders spotted it
- Read the cross-chain authentication pattern and asked what `xDomainMessageSender()` actually proves; saw it was caller-supplied, so any contract implementing the interface could answer [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-13.md)
- Reasoned from the flash-loan protocol's semantics: loans can be initiated for any receiver, and repayment is pulled from the receiver, so the missing `_initiator` check lets anyone trigger the callback [E2](https://bugbountylibrary.com/r/sherlock%3A2023-05-dodo%3AH-1.md)
- Noticed `verifyCallback` only tested `factory.isSwapper(swapper_)`, then traced `SwapperImpl` inheriting `WalletImpl.execCalls` to confirm arbitrary calldata from an attacker-deployed Swapper [E3](https://bugbountylibrary.com/r/sherlock%3A2023-04-splits%3AM-1.md)

## Impact and severity
All three are high severity: theft of bridged NFTs [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-13.md), closing/repaying positions and stealing funds [E2](https://bugbountylibrary.com/r/sherlock%3A2023-05-dodo%3AH-1.md), and draining user contracts [E3](https://bugbountylibrary.com/r/sherlock%3A2023-04-splits%3AM-1.md). Impact is raised when the callback reaches a primitive that moves assets or executes arbitrary calls [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-13.md)[E3](https://bugbountylibrary.com/r/sherlock%3A2023-04-splits%3AM-1.md), and when the attacker can choose the receiver/initiator freely [E2](https://bugbountylibrary.com/r/sherlock%3A2023-05-dodo%3AH-1.md).

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-13.md
- E2: https://bugbountylibrary.com/r/sherlock%3A2023-05-dodo%3AH-1.md
- E3: https://bugbountylibrary.com/r/sherlock%3A2023-04-splits%3AM-1.md
