coral-xyz / sealevel-attacks

☠️ Common Security Exploits and Protections on Solana
518 stars 99 forks source link

Duplicate Mutable Accounts epxloit: Renamed secure to recommended, and added secure example #16

Closed nheingit closed 2 years ago

nheingit commented 2 years ago

This example didn't have a recommended solution folder, and the code that was in secure looked like it was idiomatic Anchor code from what I could tell.

I moved all of the contents from there into the new recommended folder, and then came up with an example that checks whether the keys of the two accounts are the same manually in the program's logic.