Safe Dollar Hack

Reported loss $248K
Polygon
Incentive Rewards Exploit

What happened

On June 28, 2021, weeks after its June 2021 launch, SafeDollar's algorithmic stablecoin SDO on Polygon was exploited through a flaw in its reward logic. The attacker minted about 831.3 quadrillion SDO (831,309,277,244,108,000) and dumped it into on-chain liquidity pools for about 202K USDC and 46K USDT, roughly $248K in total. SDO fell to $0.

The pool involved paid SDO rewards to depositors of PolyDex's PLX token. PLX charges a fee on every transfer. On withdrawals, SafeDollar's reward pool paid that fee out of the pool's own PLX balance instead of charging the user. Repeated deposits and withdrawals drained the pool's PLX balance, which inflated the accSdoPerShare reward rate to 1,142,913,215,739,484,400 SDO per PLX.

Attacker: 0xFeDC2487Ed4BB740A268c565daCdD39C17Be7eBd. Setup deposit: 0x55dad44a7ed31d1637e70879af66e02290d39aea54554f8411e6ec19c03a074b. Deposit/withdraw loop: 0xd78ff27f33576ff7ece3a58943f3e74caaa9321bcc3238e4cf014eca2e89ce3f. Claim and dump (drain()): 0x1360315a16aec1c7403d369bd139f0fd55a99578d117cb5637b234a0a0ee5c14.

SafeDollar paused activity, said it was investigating, and promised to publish a plan to compensate liquidity providers.

How it happened

  1. The attacker made an initial PLX deposit into the SafeDollar Safe Farm (tx 0x55dad44a...074b).
  2. At 03:48 UTC, the attacker ran 101 deposit/withdraw cycles on the PLX pool in one transaction (0xd78ff27f...ce3f). Each withdrawal's PLX transfer fee came out of the pool's balance, so the pool's PLX holdings shrank with every cycle.
  3. With the pool's PLX balance nearly empty, accSdoPerShare grew to about 1.14 quintillion SDO per PLX.
  4. Twelve seconds later, a drain() transaction (0x1360315a...5c14) claimed rewards on the original deposit, receiving about 831.3 quadrillion SDO, and swapped it for 202,230 USDC and 46,006 USDT from liquidity pools. SDO went to zero.

Protocol details

Classification Protocol Logic / Stablecoin
Protocol Type Exploit/Other
Affected asset / contract SDO
Implementation language Solidity
Protocol links Website @safedollarfi

Build your security review skills

Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.