# Caller-supplied identity field trusted

Does the code bind the user/sender/receiver field to the authenticated caller, or trust caller input?

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

## How it works
A contract needs to know *who* an action is for. It takes that identity from a field the caller supplies (`user`, `_from`, `receiver`, `callTo`, or the message sender) and acts on it without proving the field matches the authenticated origin. The assumption that breaks: that a trusted or whitelisted relay, or a validated wrapper, only ever passes identity values it has itself checked. When any caller can reach that relay path, or when the validated field is not the field actually used downstream, the identity becomes attacker-controlled and the contract acts on someone else's behalf [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-tokamak-network%3AH-1.md)[E2](https://bugbountylibrary.com/r/c4%3A2024-02-tapioca%3AH-01.md)[E3](https://bugbountylibrary.com/r/cantina%3Asuperform_erc1155a_dec2023%3A3.2.9.md).

## Where it shows up
- A boolean flag that switches off a security check (e.g. address aliasing skipped when `_isOnApproveTrigger` is set) [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-tokamak-network%3AH-1.md)
- A token callback (`approveAndCall`, `onApprove`) that can set that flag from user-reachable code [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-tokamak-network%3AH-1.md)
- Whitelisted relay contracts (`_checkSender` allows a privileged caller to act on any `_from`) [E2](https://bugbountylibrary.com/r/c4%3A2024-02-tapioca%3AH-01.md)
- Cross-chain compose payloads carrying a `user`/`from` struct field that is never compared to the original caller [E2](https://bugbountylibrary.com/r/c4%3A2024-02-tapioca%3AH-01.md)
- Validators that check one struct's `receiver` while the bridge facet reads a different field (`callTo`) as the destination [E3](https://bugbountylibrary.com/r/cantina%3Asuperform_erc1155a_dec2023%3A3.2.9.md)
- Wrapper protocols that fan out to several underlying bridges, each with its own receiver field [E3](https://bugbountylibrary.com/r/cantina%3Asuperform_erc1155a_dec2023%3A3.2.9.md)

## How to review
Find the authenticated origin (msg.sender, tx.origin, the verified cross-chain sender) and the identity the action is applied to. The invariant: **the identity field must be bound to the authenticated origin, or the code must prove the relay is entitled to act for that identity.** Concretely:
- For every flag that disables a check, list every path that can set it and ask whether an unprivileged caller reaches it [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-tokamak-network%3AH-1.md).
- For every whitelisted caller, audit each field of the struct it relays; the relay's privilege overrides per-user checks [E2](https://bugbountylibrary.com/r/c4%3A2024-02-tapioca%3AH-01.md).
- For every validator, trace to the code that actually spends the value and confirm the validated field is the one used [E3](https://bugbountylibrary.com/r/cantina%3Asuperform_erc1155a_dec2023%3A3.2.9.md).

## How finders spotted it
- Read the aliasing condition in `depositTransaction`, noticed the `!_isOnApproveTrigger` exception, and reasoned any contract can reach the onApprove path, defeating the invariant [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-tokamak-network%3AH-1.md).
- Read `_checkSender` whitelist logic, traced the cross-chain compose flow, and saw `mintBBLendXChainSGL` encodes a `user` field into `composeMsg` without validating it, while USDO is whitelisted [E2](https://bugbountylibrary.com/r/c4%3A2024-02-tapioca%3AH-01.md).
- Noticed `validateTxData` extracts `receiver` from `BridgeData`, then traced `StargateFacet._startBridge` and saw it passes `_stargateData.callTo` as the destination — a field the validator never checks [E3](https://bugbountylibrary.com/r/cantina%3Asuperform_erc1155a_dec2023%3A3.2.9.md).

## Variants seen
- Check disabled by a user-reachable flag on a token callback [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-tokamak-network%3AH-1.md)
- Trusted relay acting on an unvalidated `user` field in a cross-chain message [E2](https://bugbountylibrary.com/r/c4%3A2024-02-tapioca%3AH-01.md)
- Validator checks field A, bridge uses field B as receiver [E3](https://bugbountylibrary.com/r/cantina%3Asuperform_erc1155a_dec2023%3A3.2.9.md)

## Impact and severity
High. Spoofing an unowned L2 address lets an L1 contract act as it [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-tokamak-network%3AH-1.md); manipulating victim positions via a whitelisted relay [E2](https://bugbountylibrary.com/r/c4%3A2024-02-tapioca%3AH-01.md); redirecting bridged tokens to the attacker, and if keepers credit amounts against shared liquidity, draining other users' funds [E3](https://bugbountylibrary.com/r/cantina%3Asuperform_erc1155a_dec2023%3A3.2.9.md). Impact rises with shared liquidity and off-chain keeper logic [E3](https://bugbountylibrary.com/r/cantina%3Asuperform_erc1155a_dec2023%3A3.2.9.md).

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2024-08-tokamak-network%3AH-1.md
- E2: https://bugbountylibrary.com/r/c4%3A2024-02-tapioca%3AH-01.md
- E3: https://bugbountylibrary.com/r/cantina%3Asuperform_erc1155a_dec2023%3A3.2.9.md
