Daejun Park
278 posts

Daejun Park
@daejunpark
formal methods for appsec @a16zcrypto



Hacks always suck. For everyone. When a long-running protocol by an OG team is the victim, even more so. I believe the only thing we can do is to learn from these events and build tools that will help reduce the likelihood of them happening in the future. When the Balancer hack happened, it was not immediately apparent how it had happened. It was clear that rates were manipulated in stable pools, but how it was all possible was unclear. I decided to take all the tools we have been developing at @phylaxsystems and put them to the test. Since the root cause was still unclear, I focused on the invariant that seemed to have been broken by the exploit: "Exchange rates of stable pools should never change drastically within a single transaction". Again, I didn't understand the how of the exploit, just the what. If I could find a way to define this invariant as a security rule that is enforceable by the Credible Layer, I would be able to replay the real transaction against the rule and see if it was caught. Luckily, it was relatively straightforward to write the rule by comparing the exchange rates of the pools touched by the batchSwap before and after the transaction. The next step was to replay the exploit tx against the rule. This included another tool we recently developed, which enables users to test rules against historical transactions before deployment. If a rule passes, everything operates as expected; however, if a transaction breaks a rule, the transaction will revert. The tool correctly flagged the transaction as violating the defined rule. There's still work to do, but we're getting closer. We do our best to learn from every security incident that happens so that we can do our part in making crypto more secure.


Recent Balancer + yETH exploits share a common pattern: tiny numerical edge cases becoming real vulnerabilities. We outline the mechanics and argue for a missing defense: runtime checks on precision + invariants. This needs to be a first-class design requirement in DeFi.👇



The future of DeFi security: Not “did we catch every bug?” but “can the system block unsafe behavior by design?” Core invariants + runtime guardrails = spec is law.






