Skip to content

Commit ea3d45c

Browse files
author
HackTricks News Bot
committed
Add content from: Research Update: Enhanced src/blockchain/blockchain-and-cryp...
1 parent ff7c104 commit ea3d45c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/blockchain/blockchain-and-crypto-currencies/web3-signing-workflow-compromise-safe-delegatecall-proxy-takeover.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ if (isVictimSafe && isVictimSigner && tx.data.operation === 0) {
3737
### Gateway validation relevance
3838
Safe proposals are submitted to the **Safe Client Gateway**. Prior to hardened checks, the gateway could accept a proposal where `safeTxHash`/signature corresponded to different fields than the JSON body if the UI rewrote them post-signing. After the incident, the gateway now rejects proposals whose hash/signature do not match the submitted transaction. Similar server-side hash verification should be enforced on any signing-orchestration API.
3939

40+
### 2025 Bybit/Safe incident highlights
41+
- The February 21, 2025 Bybit cold-wallet drain (~401k ETH) reused the same pattern: a compromised Safe S3 bundle only triggered for Bybit signers and swapped `operation=0``1`, pointing `to` at a pre-deployed attacker contract that writes slot 0.
42+
- Wayback-cached `_app-52c9031bfa03da47.js` shows the logic keyed on Bybit’s Safe (`0x1db9…cf4`) and signer addresses, then immediately rolled back to a clean bundle two minutes after execution, mirroring the “mutate → sign → restore” trick.
43+
- The malicious contract (e.g., `0x9622…c7242`) contained simple functions `sweepETH/sweepERC20` plus a `transfer(address,uint256)` that writes the implementation slot. Execution of `execTransaction(..., operation=1, to=contract, data=transfer(newImpl,0))` shifted the proxy implementation and granted full control.
44+
4045
## On-chain: Delegatecall proxy takeover via slot collision
4146

4247
Safe proxies keep `masterCopy` at **storage slot 0** and delegate all logic to it. Because Safe supports **`operation = 1` (delegatecall)**, any signed transaction can point to an arbitrary contract and execute its code in the proxy’s storage context.
@@ -57,6 +62,9 @@ Execution path:
5762
3. Proxy delegatecalls into `attackerContract`; the `transfer` body writes slot 0.
5863
4. Slot 0 (`masterCopy`) now points to attacker-controlled logic → **full wallet takeover and fund drain**.
5964

65+
### Guard & version notes (post-incident hardening)
66+
- Safes >= v1.3.0 can install a **Guard** to veto `delegatecall` or enforce ACLs on `to`/selectors; Bybit ran v1.1.1, so no Guard hook existed. Upgrading contracts (and re-adding owners) is required to gain this control plane.
67+
6068
## Detection & hardening checklist
6169

6270
- **UI integrity**: pin JS assets / SRI; monitor bundle diffs; treat signing UI as part of the trust boundary.
@@ -68,6 +76,8 @@ Execution path:
6876

6977
## References
7078

79+
- [AnChain.AI forensic breakdown of the Bybit Safe exploit](https://www.anchain.ai/blog/bybit)
80+
- [Zero Hour Technology analysis of the Safe bundle compromise](https://www.panewslab.com/en/articles/7r34t0qk9a15)
7181
- [In-depth technical analysis of the Bybit hack (NCC Group)](https://www.nccgroup.com/research-blog/in-depth-technical-analysis-of-the-bybit-hack/)
7282
- [EIP-712](https://eips.ethereum.org/EIPS/eip-712)
7383
- [safe-client-gateway (GitHub)](https://github.com/safe-global/safe-client-gateway)

0 commit comments

Comments
 (0)