Worked example · 2020-11
Pickle Finance "Evil Jar" exploit — the controller swapped between any two "jars" the caller named, including fake ones — Ethereum — 2020-11-21
Summary
On 2020-11-21 an attacker exploited Pickle Finance's ControllerV4. Its swapExactJarForJar function took the addresses of a source and a destination jar as parameters without validating them. The attacker deployed fake jars and used the function to have the controller withdraw the DAI pJar's position (held as cDAI) and route it through attacker-controlled contracts, netting ~$19.76M. Pickle disclosed the incident the same day.
Timeline (UTC)
| When | Event | OAK ref |
|---|---|---|
| 2020-11-21 | Attacker deploys fake "evil jar" contracts | (setup) |
| 2020-11-21 | swapExactJarForJar called with the fake jars; controller withdraws the DAI pJar's cDAI position and executes attacker-controlled calls |
T9.004 |
| 2020-11-21 | ~$19.76M DAI leaves the protocol | T5.001 |
| 2020-11-21 / 22 | Pickle discloses; SlowMist publishes an analysis | (response) |
Public references
[slowmistpickle2020]— SlowMist, "Reveal the process of Pickle Finance being hacked": https://slowmist.medium.com/slowmist-a981b3a2a3dc[halbornpickle2020]— Halborn, "Explained: The DeFi Protocol Pickle Finance Hack (Nov 2020)": https://www.halborn.com/blog/post/explained-the-defi-protocol-pickle-finance-hack-nov-2020[forklogpickle2020]— ForkLog, "DeFi project Pickle Finance lost nearly $20 million in hack": https://forklog.com/en/defi-project-pickle-finance-lost-nearly-20-million-in-hack/[decryptpickle2020]— Decrypt, "Pickle Finance hack": https://decrypt.co/49149/pickle-finance-hack
Discussion
Pickle is an early, large instance of the periphery-contract pattern OAK tracks as candidate T9.004.001: a contract with authority over user funds acts on counterparties the caller supplies. In 2020 the counterparty was a "jar"; in later cases it is a market (Exactly 2023), a bundle (Gondi 2026), a Safe (FlashLoopAdapter 2026) or a from address (BonfireSwap 2026). The fix is the same in each: derive what may be acted on from state the contract controls, not from parameters.