Called programs can be upgraded between approval and execution
Members approve a call to a program; if that program is upgradeable, different code may run at execution.
Why this is a risk, not a vulnerability · Documented behavior
- Program
- Squads V3
- Source
- Neodyme ND-SQD1-L2 (Squads V4); Neodyme MPL1
- Code
- View at c95b767
At execution the program checks only that the program account passed in matches the stored program ID. Nothing checks that the program’s code is unchanged since approval. Many Solana programs keep a live upgrade authority, so members can approve a call to program X and later execute a call to a different version of X. This is the same behavior documented for Squads V4 as V4-03.
Neodyme noted that it matters most for transactions executed one instruction at a time (V3-08): a callee upgraded partway through can make the remaining instructions fail after earlier ones have already run.
What to do
- Before executing, check whether each called program has an upgrade authority and when it was last deployed.
- Be cautious executing an old approval against an upgradeable program.
- Integrators: warn when a callee was redeployed after the transaction was created.