Resources

People often ask me "How did you learn how to hack?" The answer: by reading. This page is a collection of the blog posts and other articles that I have accumulated over the years of my journey. Enjoy!

How init and init_if_needed work under the hood and the associated token account griefing attack- 1849

jesjupyterPosted 2 Months Ago
  • In Anchor, the main framework for developing Solana programs, there are two identifiers for creating accounts: init and init_if_needed. init requires for account creation to occur otherwise it exists. init_if_needed will always run but will create the account if it doesn't already exist.
  • So, is there anything an attacker can open where init is required? Associated Token Accounts (ATAs) are 100% permissionless to create. So, using init with ATAs is a bad idea.