Worked example · 2024-01
Socket / Bungee bridge infinite-approval call-injection exploit — Ethereum — 2024-01-16
Summary
Socket (formerly Bungee) operated a cross-chain bridge aggregation protocol that allowed users to swap assets across chains via a unified gateway contract. The SocketGateway contract on Ethereum handled inbound bridge transactions and user swaps. The contract's architecture accepted a swapExtraData parameter that was forwarded to an external call as part of the bridge-message execution path.
On January 16, 2024, an attacker discovered that:
- The
swapExtraDataparameter was insufficiently validated — the contract forwarded the calldata to an external address without verifying that the call target was an approved bridge route or whitelisted integration contract. - Users who had previously granted
approveto the SocketGateway contract (a routine step in using the bridge) retained active approvals that the gateway could exercise on their behalf. - By injecting a
transferFromcall via theswapExtraDataparameter, the attacker could drain approved tokens from any wallet with an active SocketGateway approval to the attacker's address.
The exploit loop was: enumerate on-chain wallets with active SocketGateway approvals → construct a malicious swapExtraData payload containing a transferFrom to the attacker's address → call performAction on the SocketGateway contract with the victim as the from parameter → the gateway forwarded the transferFrom to the token contract, which honoured it because the victim had approved the SocketGateway contract.
The Socket team paused affected contracts within approximately 3 hours of the first exploit transaction. Approximately ~$3.3M was extracted across ~200 victim wallets. The attacker subsequently returned ~$1.7M (approximately half) to the Socket team following on-chain negotiation, reducing the net loss to ~$1.6M.
The vulnerability class — user-supplied calldata forwarded to an unvalidated external call in a contract that holds standing user approvals — is structurally analogous to the LI.FI exploit (July 2024, examples/2024-07-li-finance.md) and recurred across multiple bridge-aggregation architectures through 2023–2025.
Timeline
| When | Event | OAK ref |
|---|---|---|
| 2024-01-16 14:45 UTC (approx) | First exploit transaction; attacker begins draining victim wallets with active SocketGateway approvals | T9.005 + T10 execution |
| 2024-01-16 ~17:30 UTC | Socket team detects anomalous activity; pauses affected contracts and revokes compromised gateway routes | (protocol response) |
| 2024-01-16 to 01-19 | Socket publishes post-mortem; notifies affected users; recommends approval revocation for all SocketGateway users | (user notification) |
| 2024-01-20 (approx) | Attacker returns ~$1.7M to Socket team via on-chain transfer | (partial recovery) |
| 2024-01 onward | Socket migrates to new gateway contracts with whitelisted-route validation and discontinues the unvalidated swapExtraData forwarding path |
(mitigation deployment) |
What defenders observed
- User-supplied calldata forwarding without destination validation is a standing T9.005 surface in any contract that holds standing user approvals. The Socket
swapExtraDatapath was intended to allow flexible integration with third-party swap protocols, but the flexibility came at the cost of unvalidated destination routing. The canonical mitigation is a whitelist of approved route destinations, enforced at the gateway contract, rejecting any external call whose target is not on the whitelist. - Pre-existing approvals convert a contract vulnerability into a multi-victim blast radius. The SocketGateway contract's approval surface was the vector that converted a single-contract call-injection bug into a multi-victim extraction event. Users who had bridged once and never revoked the approval remained vulnerable indefinitely — the approval persistence is the T4.001 structural adjacency.
- The Socket exploit is the mid-point in a recurring call-injection pattern across bridge aggregators (2022–2025). The pattern — user-supplied calldata forwarded to an unvalidated external call in a gateway contract with standing user approvals — appeared at LI.FI (July 2024), Socket (January 2024), and in a detected-and-patched form at multiple pre-deployment bridge audits. The recurrence validates the class as a structural bridge-aggregation-architecture surface rather than a one-off implementation bug.
What this example tells contributors writing future Technique pages
- Socket is a clean T9.005 + T10 dual-classification case. T9.005 covers the call-injection vulnerability in the
performActionpath; T10 covers the bridge-specific blast-radius dimension (cross-chain user base, gateway-contract approval surface, cross-chain message path). - The T4.001 adjacency is structural but the primary classification is T9.005. While the exploit depended on pre-existing approvals (T4.001 surface), the load-bearing vulnerability was the unvalidated call injection (T9.005), not the approval-acquisition mechanism. The T4.001 adjacency informs the blast-radius analysis but not the primary classification.
- The partial-return outcome is a recurring pattern in bridge-exploit cases. The Socket attacker returned approximately half the extracted funds, consistent with the white-hat-negotiation / partial-return pattern observed at Poly Network (2021) and in several smaller bridge exploits. Contributors should document the return amount and mechanism explicitly as a first-class observable.
Public references
- Socket Protocol. "Socket Gateway Exploit Post-Mortem." January 2024.
- PeckShield. "Socket / Bungee Exploit On-Chain Analysis." January 2024.
- Cross-reference: T9.005 (Smart-Contract Exploit — Reentrancy / Call Injection) at
techniques/T9.005-reentrancy-call-injection.md. - Cross-reference: T10 (Bridge and Cross-Chain) at
techniques/(T10 family). - Cross-reference:
examples/2024-07-li-finance.md— LI.FI bridge-aggregation exploit (July 2024); structurally parallel call-injection vulnerability in a different bridge aggregation gateway.
Proposed new BibTeX entries
@misc{socketpostmortem2024,
author = {{Socket Protocol}},
title = {Socket Gateway Exploit Post-Mortem — January 2024},
year = {2024},
month = jan,
note = {~1,993 ETH (~$3.3M) extracted via call-injection in unvalidated swapExtraData path; ~$1.7M returned}
}
@misc{peckshieldsocket2024,
author = {{PeckShield}},
title = {Socket / Bungee Exploit On-Chain Analysis},
year = {2024},
month = jan
}