Sample audits · Open-source projects and documentation, eight more

Anchor (otter-sec/anchor)

The Solana program framework. On GitHub at otter-sec/anchor; solana-foundation/anchor redirects there.

Summary card for this audit: 143 findings after review, 0 High, 16 Medium, 123 Low, 4 Info
Auditedotter-sec/anchor at commit 50c68b9b9b57ce7a6f6014e707febef9abb33401
Date11 October 2026 (audited again; first audit 11 October 2026)
How it ranlocal run on our workstation, full audit, Standard review
Verdict after reviewPass with notes (Fail if a High finding remains after review, otherwise Pass with notes)
0
High after review
16
Medium after review
123
Low after review
4
Info after review
0
excluded on review

Compared with the first audit

Same commit as the first audit: the project's default branch has no later commits (checked 11 October 2026), so nothing could have been fixed upstream in between. Each finding of the first audit (11 October 2026) was checked again against the code audited now. 39 findings in the first audit; 39 still open (27 found again, 12 not reported again but still present). This audit has 143 findings after review, 116 of them new.

First auditFindingReviewed rating thenNowIn this audit
#1associatedAddress ignores Token-2022LowStill open#7
#2signAllTransactions result not validatedLowStill open#10
#3removeEventListener race with addLowStill open#99
#4module-global account subscription registryLowStill open#18
#5Rust client event sub ends silentlyMediumStill open#41
#6debugger re-resolves paths per frameLowStill opennot reported again
#7GDB accept loop 20 ms pollLowStill opennot reported again
#8nightly cache one version for two binariesLowStill opennot reported again
#9current-version file non-atomicLowStill opennot reported again
#10set_current_dir not restored on errorLowStill opennot reported again
#11IDL stream decompressor no total budgetLowStill opennot reported again
#12legacy IDL fetch unbounded inflateLowStill open#36
#13legacy IDL fetch unchecked slice (panic)LowStill open#36
#14base58 metadata decode no limitLowStill opennot reported again
#15TS metadata gunzip/inflate/bs58 no limitLowStill open#35
#16anchor account trusts u32 vec countLowStill open#37
#17IDL resolution env value exact-caseLowStill opennot reported again
#18cli/src/lib.rs very largeLowStill open#52
#19program.rs / config.rs largeLowStill open#52
#20resolver does not coalesce fetchesLowStill open#29, #30
#21anchor new deletes existing lib.rsMediumStill opennot reported again
#22anchor init --force overwrites silentlyLowStill open#83
#23solana-verify downloaded, no checksumLowStill open#72
#24legacy Solana installer in shared /tmpLowStill open#112
#25installer hashes from same bucketLowStill open#80
#26default keypair path built 7 timesLowStill open#61
#27prerelease logic duplicated in scriptsLowStill open#92
#28host target detection duplicatedLowStill open#62
#29template.rs <-> lib.rs import cycleLowStill opennot reported again
#30npm publish no version assertionLowStill open#68
#31npm wrapper repeats warningInfoStill opennot reported again
#32program keypair default permsLowStill open#116
#33remove_dir_all weak path checksLowStill open#120, #121
#34surfpool wait no timeout / leakLowStill open#119
#35IDL history accepts foreign chunksMediumStill opennot reported again
#36websocket callback decodes unguardedLowStill open#40
#37fetchMultiple throws, docs say nullLowStill open#100
#38fixed 1000-byte encode bufferLowStill open#101
#39make publish omits two cratesLowStill open#75
How to read this page

Each finding keeps the number it has in the audit report. The rating shown first is the one after review; the first automated rating is listed with it. 86 findings were first rated Medium or High; 16 of them are Medium or High after review. Text marked "From the report" is quoted from the audit report; fixes are suggestions and were not tested. Code locations link to the file and line at the audited commit.

Medium after review (16)

11. Medium unverify_collection sends the item metadata as the collection
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
collection: *ctx.accounts.metadata.key,
collection_authority: *ctx.accounts.collection_authority.key,
metadata: *ctx.accounts.metadata.key,
Why it matters

the context has a collection account that is never read. The CPI references the wrong account, so it fails or targets the wrong metadata.

Suggested fix, not tested

use *ctx.accounts.collection.key.

12. Medium unverify_sized_collection_item sends the item metadata as the collection
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
collection: *ctx.accounts.metadata.key,
Why it matters

this is the same defect as finding 11, here for sized collections.

Suggested fix, not tested

use *ctx.accounts.collection.key.

14. Medium Test.toml inheritance drops shutdown_wait and upgradeable
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
if let Some(startup_wait) = other_test.startup_wait {
    my_test.startup_wait = Some(startup_wait);
}
Why it matters

an overriding test file's shutdown_wait and upgradeable values are silently ignored.

Suggested fix, not tested

carry every field in the merge, and destructure the overriding struct exhaustively.

15. Medium Rewriting Anchor.toml drops workspace idls and types
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
workspace: (!self.workspace.members.is_empty() || !self.workspace.exclude.is_empty())
    .then(|| self.workspace.clone()),
Why it matters

keys sync and new rewrite the file. A project that only sets idls/types loses them.

Suggested fix, not tested

write the workspace table whenever it differs from the default.

16. Medium Command-line overrides and reformatting are written back into Anchor.toml
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
deployment.address = Pubkey::try_from(actual_program_id.as_str()).unwrap();
fs::write(cfg.path(), cfg.to_string())?;
Why it matters
  • The config being saved already includes --provider.* overrides (config.rs:675-680) and an absolute wallet path, so values meant for one run become permanent.
  • Re-serializing also drops the user's comments and formatting. config set (lib.rs:6762) does the same.
Suggested fix, not tested

keep the persisted config separate from the effective config, and edit only the intended keys with a format-preserving TOML editor.

20. Medium Debugger traces are lost when a failing test exits the process
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
if let Ok(captures) = self.captures.lock() {
    if let Err(e) = write_pending_captures(&self.profile_dir, &captures) {
Why it matters

the captures are written only when the guard is dropped. std::process::exit on a failing test (lib.rs:5039) skips that, so traces are lost in exactly the case the debugger is meant for.

Suggested fix, not tested

flush captures explicitly before exiting, or return the exit code to the entry point.

41. Medium Rust event subscription stops for good on one bad log
First rating: Medium · Reviewed rating: Medium · Review: confirmed · also in the first audit (#5)
From the report
Evidence
let events = parse_logs(&logs.value.logs, &program_id_str)?;
let _ = self.handle.await;   // line 277
Why it matters

one unparsable log (or a bad signature at line 404) ends the listener task. The error is discarded on unsubscribe, so later events are silently missed.

Suggested fix, not tested

log or forward per-notification errors and keep the loop running. Return the task's result on unsubscribe.

42. Medium Broken workspace config silently falls back to mainnet
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
if let Ok(Some(cfg)) = Config::discover(cfg_override) {
Why it matters

if Anchor.toml exists but has an error, the command quietly uses the Solana CLI config, or mainnet with the default wallet.

Suggested fix, not tested

propagate the config error, fall back only when no Anchor.toml exists, and print which cluster and wallet were chosen.

94. Medium Lazy field offsets are recomputed exponentially
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
#ty_as_lazy::size_of(&self.__info.data.borrow()[self.#offset_of_ident()..])
Why it matters

each offset calls the previous offset and size, and that size calls the offset again. Accounts with many variable-size fields exhaust the compute budget.

Suggested fix, not tested

compute offsets once (a running sum or cache).

Review: opt-in Lazy accounts only

95. Medium Anyone can create the legacy IDL account first
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
idl_account.authority = *accounts.from.key;
Why it matters

the first signer becomes the IDL authority of any program that enables the legacy IDL instructions. That person can then publish misleading layouts.

Suggested fix, not tested

require the program's upgrade authority, or drop the legacy path.

98. Medium Legacy string seeds keep JSON quotes
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
IdlType::String => seed.value.to_string().as_bytes().into(),
Why it matters

the seed bytes include " characters, so clients derive the wrong PDA.

Suggested fix, not tested

use seed.value.as_str(), and add a round-trip test.

Review: ` keeps the quotes)

117. Medium Global toolchain not restored when a command exits early
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
let result = process_command(opts);
restore_toolchain(restore_cbs)?;
Why it matters

failed tests, builds and migrations call process::exit (lines 5039, 3048, 6524). The machine-wide Solana version then stays switched.

Suggested fix, not tested

return exit codes to entry, or restore the toolchain in a drop guard.

122. Medium Deploy can silently use a new program address
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
None => program.keypair_file()?.path().clone(),
Why it matters

on a fresh clone, a new keypair is generated and deployed to. The id mismatch is only a warning (line 2340, marked FIXME).

Suggested fix, not tested

make a missing or mismatched keypair a hard error in deploy.

124. Medium --final with a new authority does not make the program immutable
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
loader_v3_instruction::set_upgrade_authority(
    &program_id, &current_authority_keypair.pubkey(), new_upgrade_authority.as_ref(),
Why it matters

with both flags given, the tool prints "Making program immutable" but sets the new authority. The user believes the program is frozen.

Suggested fix, not tested

declare the flags as conflicting, and pass None whenever --final is set.

Review: `, so the authority is set, not removed. The "Making program immutable" text the report quotes is in the deploy path, program.rs:1303, not this one)

127. Medium Legacy IDL write retry can duplicate chunks
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
for retries in 0..20 {
    ...
    match client.send_and_confirm_transaction_with_spinner(&tx) {
Why it matters

after a confirmation timeout, a re-signed retry can append the same chunk twice and corrupt the on-chain IDL.

Suggested fix, not tested

check the signature status or the account length before retrying.

136. Medium Custom websocket URL dropped when Anchor.toml is rewritten
First rating: Medium · Reviewed rating: Medium · Review: confirmed · new in this audit
From the report
Evidence
(Ok(h), Ok(w)) if h.domain() == w.domain() => s.serialize_str(http),
Why it matters

IP hosts, and same-domain URLs with different ports, lose their custom websocket endpoint.

Suggested fix, not tested

collapse to one string only when ws equals the value that would be derived from http.

Review: is None for IP hosts and ignores ports, so the ws` entry is silently dropped on rewrite; same class as #15)

Low after review (123)

1. Low Init code calls whatever account is named like a system or token program
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
::anchor_spl::associated_token::create(CpiContext::new(associated_token_program.key(), ...
let #cpi_context = anchor_lang::context::CpiContext::new(system_program.key(), #cpi_accounts);
Why it matters

the parser (lang/syn/src/parser/accounts/mod.rs:156) only checks that fields named system_program, token_program or associated_token_program exist. It never checks their type. If a developer declares one of them as an unchecked account, the generated init code sends the payer's signed CPI (or a PDA payer's seeds) to any program the caller supplies.

Suggested fix, not tested

require the field type to be the matching Program<...> / Interface<TokenInterface> at parse time. Alternatively, have the generated code compare the key with the canonical program ids before each CPI.

2. Low Token-2022 CPI wrappers do not check the target program id
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
let ix = spl_token_2022::instruction::transfer(&ctx.program_id, ctx.accounts.from.key, ...
if key != ctx.program_id {
Why it matters

the target program comes from the caller-built context. The return-data check compares against that same unchecked value, so it proves nothing.

Suggested fix, not tested

require ctx.program_id to be the legacy token id or the Token-2022 id, and compare return data against the canonical id.

3. Low Token-2022 extension wrappers trust a caller-supplied program account
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
ctx.accounts.token_program_id.key,
ctx.accounts.mint.key,
transfer_fee_config_authority,
Why it matters

these wrappers sign authority changes with invoke_signed toward a program id that nothing validates.

Suggested fix, not tested

check token_program_id against the Token-2022 id in each wrapper, or type the field as the token interface.

4. Low Mint extension reader does not check the account owner
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
let mint_data = account.data.borrow();
let mint_with_extension =
    StateWithExtensions::<spl_token_2022::state::Mint>::unpack(&mint_data)?;
Why it matters

extension-authority constraints rely on data read from any account, and borrow() panics when a mutable borrow is active.

Suggested fix, not tested

check the owner against the token program ids first, and use try_borrow_data().

6. Low Metadata wrappers hard-code the legacy token program
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
token_program: spl_token_interface::ID,
Why it matters

these wrappers cannot be used with Token-2022 mints, while sibling wrappers use the caller's token program. The convention is inconsistent.

Suggested fix, not tested

take the token program from a validated account restricted to the two known ids, or document that only the legacy program is supported and remove the unused field.

7. Low Associated token address helper only supports the legacy token program
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#1)
From the report
Evidence
[owner.toBuffer(), TOKEN_PROGRAM_ID.toBuffer(), mint.toBuffer()],
ASSOCIATED_PROGRAM_ID
Why it matters

the helper returns the wrong address for Token-2022 mints.

Suggested fix, not tested

add a token-program parameter that defaults to the legacy id.

8. Low Account resolver decodes token accounts without an owner check
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
if (name === "tokenAccount") {
  const account = decodeTokenAccount(accountInfo.data);
Why it matters

any account whose bytes fit the layout is accepted, and its fields are then used as PDA seeds.

Suggested fix, not tested

reject the account unless its owner is one of the two token programs.

9. Low Realloc refund can go to an unverified payer account
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
let #lamport_amt = #field_info.lamports().checked_sub(#new_rent_minimum).unwrap();
anchor_lang::Lamports::add_lamports(#payer_ref, #lamport_amt)?;
Why it matters

on a shrink, the released rent goes to whichever mutable account is named as payer. That account does not have to be a signer or the original funder.

Suggested fix, not tested

require the realloc payer to be a signer, and return an error instead of unwrapping.

10. Low Wallet signing results are not checked before sending
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#2)
From the report
Evidence
const signedTxs = await this.wallet.signAllTransactions(txs);
const tx = signedTxs[k];
const rawTx = tx.serialize();
Why it matters

a wallet that drops or rejects entries causes a failure mid-batch, after earlier transactions have already been sent.

Suggested fix, not tested

before sending anything, check the returned count and that the required signatures are present.

13. Low Legacy IDL conversion drops type generics
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
generics: Default::default(),
ty: value.ty.into(),
Why it matters

converting a legacy IDL loses its generic parameters, although the reverse conversion carries them.

Suggested fix, not tested

map the legacy generics list into type generics, and add a round-trip test.

17. Low Custom account resolver results can be lost
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
this._accounts = accounts;
return resolved;
Why it matters

the builder (methods.ts:182-184) keeps its own reference. If a custom resolver returns a new object, the builder never sees the accounts it resolved.

Suggested fix, not tested

merge the result into the shared object (Object.assign), or let the builder read accounts back from the resolver.

18. Low Account subscriptions are shared globally by address only
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#4)
From the report
Evidence
const sub = subscriptions.get(address.toString());
if (sub) {
  return sub.ee;
Why it matters

the subscription map is module-wide (line 397). A second client for the same address, with another account type or provider, receives the first client's emitter and decoder. An unsubscribe from one client also removes the subscription for all of them.

Suggested fix, not tested

key subscriptions per client instance, or by program, account type, address and commitment.

19. Low Loading the workspace config silently rewrites program ids
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
if !deploy_dir.exists() && !cfg.programs.contains_key(&Cluster::Localnet) {
    println!("Updating program ids...");
    keys_sync(&ConfigOverride::default(), None)?;
Why it matters

nearly every command loads the config. On a fresh checkout, a read-only command can create keypairs and rewrite declare_id! and Anchor.toml.

Suggested fix, not tested

keep config loading free of side effects, and run the sync explicitly in build/init.

21. Low Nightly channel switch can overwrite the stable backup
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
if !nightly_enabled() {
    backup_stable_avm()?;
}
Why it matters

the nightly binary is activated before the state flag is written (line 922). If enabling is interrupted, the next enable backs up the nightly binary over the stable backup.

Suggested fix, not tested

write the state first, or make enable/disable one transactional routine. Refuse to overwrite the backup with a non-stable binary.

22. Low Local validator left running when the test script is missing
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
let Some(cmd) = scripts.get(script_name) else {
    bail!("Not able to find script for `{}`", script_name);
};
Why it matters

the validator has already been started (lines 4912-4946) and is killed only further down. It keeps the port, so the next run fails.

Suggested fix, not tested

resolve the script before starting the validator, or hold the child process in a guard that kills it on drop.

23. Low Detached validator mode panics when stdin is closed
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
std::io::stdin().lock().lines().next().unwrap().unwrap();
Why it matters

when stdin is at end-of-file (CI, containers, nohup), this panics right after the validator starts and leaves it orphaned. The same code is at line 5018.

Suggested fix, not tested

handle end-of-file by shutting down, or wait on a signal instead.

24. Low Verifiable-build container is not removed after a failed cleanup
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
docker_exec(container_name, &["rm", "-rf", target_dir.to_str().unwrap()])?;
Why it matters

if this step fails, docker rm -f never runs. Because the container name is fixed, every later verifiable build then fails.

Suggested fix, not tested

always remove the container, clear stale containers before starting, and use a unique name per build.

25. Low Debugger starts a busy-polling thread for every stepped instruction
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
while start.elapsed() < window && !cancel.load(Ordering::Acquire) {
    if let Ok(s) = TcpStream::connect(("127.0.0.1", port)) { return Some(s); }
    thread::yield_now();
Why it matters

one thread is spawned per instruction (line 438) and spins on connect. Long traces become extremely slow.

Suggested fix, not tested

use one long-lived watcher or a notification channel, or at least add backoff.

26. Low Event subscription handle has no automatic cleanup
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
pub struct EventUnsubscriber<'a> {
    handle: JoinHandle<Result<(), ClientError>>,
Why it matters

if the handle is dropped without calling unsubscribe(), the subscription task keeps running.

Suggested fix, not tested

implement Drop to abort the task or unsubscribe.

28. Low avm binary is recopied on every invocation
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
Location: avm/src/lib.rs:1021 (line corrected on review; the report cites :1019)
From the report
Evidence
if now - ts < UPDATE_CHECK_INTERVAL_SECS && nightly_binaries_exist() {
    activate_nightly_avm()?;
Why it matters

the whole binary is copied on every call, even when nothing changed.

Suggested fix, not tested

copy only when the size or hash differs.

29. Low Account resolution repeats RPC fetches without a progress check
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#20)
From the report
Evidence
while ((await this.resolvePdasAndRelations(this._idlIx.accounts)) + (await this.resolveCustom()) > 0) {
Why it matters

accounts that cannot be resolved are fetched again on every pass, up to 16 passes.

Suggested fix, not tested

stop when a pass resolves nothing new, and cache failed lookups for the duration of the resolve.

30. Low Resolver account cache is keyed only by address
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#20)
From the report
Evidence
if (!this._cache.has(address)) {
Why it matters

the account type that was requested is not part of the cache key.

Suggested fix, not tested

include the requested name in the key, and check that the decoded type matches it.

31. Low Cargo target directory memo ignores working directory and environment
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
if (cargoTargetDirectoryCache !== undefined) { return cargoTargetDirectoryCache; }
Why it matters

a cached value can be stale after cwd or CARGO_TARGET_DIR changes.

Suggested fix, not tested

key the cache by those inputs, or do not cache.

32. Low Account-resolution mode is toggled from two methods
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
this._resolveAccounts = true;   // accountsPartial
this._resolveAccounts = false;  // accountsStrict (line 237)
Why it matters

the resulting behaviour depends on the order in which the methods are called.

Suggested fix, not tested

reject mixed use, or set the mode once.

33. Low Unbounded parallel account batch requests
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
const results = await Promise.all(batches.map((batch) => getMultipleAccountsAndContextCore(connection, batch, commitment)));
Why it matters

large requests can hit RPC rate limits.

Suggested fix, not tested

limit how many requests are in flight, and back off on 429 responses.

34. Low Program address is updated in only one IDL copy
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
idl.address = address;
Why it matters

the generated TypeScript types and the workspace copies keep the old address.

Suggested fix, not tested

route address updates through one function that refreshes every copy.

35. Low On-chain IDL is decompressed without a size limit (TypeScript client)
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#15)
From the report
Evidence
case MetadataCompression.Gzip:
  return Buffer.from(ungzip(data));
case MetadataCompression.Zlib:
Why it matters

IDL data is controlled by whoever publishes it, and the resolver fetches it automatically. A compression bomb exhausts the client's memory.

Suggested fix, not tested

inflate with a hard cap on output size (a few MiB), and reject anything larger.

36. Low Legacy IDL account is inflated and sliced without limits (CLI)
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#12, #13)
From the report
Evidence
let compressed_bytes = &account.data[44..44 + compressed_len];
let mut z = ZlibDecoder::new(compressed_bytes);
z.read_to_end(&mut s)?;
Why it matters

an inconsistent length panics on the slice, and a crafted stream expands without limit. The sibling fetch path already caps decompression at 16 MiB.

Suggested fix, not tested

check the bounds, and read through .take(MAX) with the shared cap.

37. Low Account decoder pre-allocates from an on-chain length
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#16)
From the report
Evidence
let mut vec_data: Vec<JsonValue> = Vec::with_capacity(size);
Why it matters

a length of up to 4 billion read from account data aborts anchor account by exhausting memory.

Suggested fix, not tested

cap the pre-allocation by the remaining bytes, and add depth and element budgets.

38. Low Borsh decoder does not bound zero-size collection elements
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
if (elementLayout.span < 0 && count > remainingBytes) {
Why it matters

elements with span 0 are never checked. A 4-byte length can drive about 4 billion iterations from a tiny buffer.

Suggested fix, not tested

cap the count for zero-size elements, or reject them.

39. Low Name conversion regex is quadratic on long identifiers
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
.replace(/([A-Z][A-Z\d]*)([A-Z][a-z])/g, "$1 $2")
Why it matters

every name in an untrusted on-chain IDL is converted. A very long upper-case identifier stalls the event loop.

Suggested fix, not tested

use a linear tokenizer, or cap identifier length before conversion.

40. Low A malformed event aborts delivery in the TypeScript listener
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#36)
From the report
Evidence
data: layout.layout.decode(logArr.subarray(givenDisc.length)),
Why it matters

a decode error inside the websocket callback stops the remaining events of that transaction from being delivered.

Suggested fix, not tested

catch decode errors per event, and guard each user callback.

43. Low The global --commitment option is ignored
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
pub commitment: Option<CaseInsensitiveCommitmentLevel>,
Why it matters

only log subscriptions use the option (lib.rs:7566). Every other client is hard-coded to confirmed.

Suggested fix, not tested

pass the option through to every client, or remove it.

44. Low Lazy account size scan loops on an unchecked count
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
(0..get_len(buf)).fold(LEN, |acc, _| acc + T::size_of(&buf[acc..]))
Why it matters

the element count read from account bytes is not compared with the buffer length.

Suggested fix, not tested

reject counts the remaining bytes cannot hold.

45. Low IDL type-string parser has no recursion limit
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
if let Some(inner) = s.strip_prefix("Option<") {
    let inner_ty = Self::from_str(
Why it matters

deeply nested input can exhaust the stack.

Suggested fix, not tested

pass a depth counter and fail past a small limit.

46. Low Downloads are read fully into memory with no size cap
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
let bytes = response.bytes()
Why it matters

an oversized response is held entirely in memory.

Suggested fix, not tested

check the length and stream with a maximum size.

47. Low Historical IDL replay has no overall RPC budget
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
let mut eligible = fetch_signatures_for_address(client, account_address, None, None, Some(before_or_at_slot), tuning.max_signatures,
Why it matters

nested replays multiply RPC work with no total limit.

Suggested fix, not tested

add a global transaction cap and a deadline.

48. Low Signature pagination scans without a page cap
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
loop { let config = GetConfirmedSignaturesForAddress2Config { ... limit: Some(IDL_SIGNATURE_PAGE_SIZE),
Why it matters

only the entries kept are capped, not the pages scanned.

Suggested fix, not tested

cap the number of pages scanned.

49. Low Client generator expands generics with no depth limit
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
type_node_from_anchor(inner_ty, &scoped)
Why it matters

expansion is recursive with no depth or node budget.

Suggested fix, not tested

track depth and the instantiations already visited.

51. Low Nightly install failure reason is not shown
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
if let Err(err) = install_nightly_manifest(&manifest, skip_attestation) {
    write_nightly_cache_error();
Why it matters

the underlying error is dropped and a cached build is activated. That error can be a failed provenance check.

Suggested fix, not tested

print the error, and say clearly that a cached build is in use.

52. Low Command-line tool modules are very large
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#18, #19)
From the report
Evidence
mod abs_path; mod account; ... pub mod fetch; ... mod program;
Why it matters
  • lib.rs is about 8.6k lines and mixes parsing, build, validators, IDL, deploy and keys.
  • program.rs (3.2k), config.rs (2.4k), template.rs (2.2k) and codama.rs (1.9k) are similarly mixed.

This makes changes risky.

Suggested fix, not tested

split by responsibility, and keep only dispatch in lib.rs.

53. Low Framework macro modules are very large
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
fn generate_constraint_init_group(
Why it matters
  • The function is about 730 lines, in a 2,078-line file with one block repeated 12 times.
  • parser/accounts/constraints.rs (about 1.9k lines) and lang/syn/src/lib.rs (about 1.3k lines) are similar.
Suggested fix, not tested

split by constraint kind, and share the repeated mint-extension checks.

54. Low Version manager, client and IDL modules are very large
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
mod attestation;
pub mod idl_nightly;
pub mod platform_tools;
Why it matters

avm/src/lib.rs, client/src/lib.rs and idl/src/convert.rs each exceed 1,000 lines and mix several concerns.

Suggested fix, not tested

extract the nightly, update-check and install modules, plus the event parsing and the separate conversion directions.

55. Low Keypair getter creates directories and new keys
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
pub fn keypair_file(&self) -> Result<WithPath<File>> {
Why it matters

a read-style accessor creates a new program identity when the key is missing.

Suggested fix, not tested

split it into a read that fails when the key is missing and an explicit create.

56. Low Environment set after threads start; helpers exit the process
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
std::env::set_var(crate::debugger::gdb::SOCKET_ENV, driver.sock_path());
Why it matters

the process environment is changed after the accept thread has started, and helpers call process::exit.

Suggested fix, not tested

set the environment before spawning threads, or pass it per child, and return errors instead of exiting.

57. Low Cluster and wallet resolution implemented four times
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
pub(super) fn create_rpc_client(cfg_override: &ConfigOverride) -> Result<RpcClient> {
Why it matters

the copies (also account.rs:113, legacy_idl.rs:223, lib.rs:1123) use different defaults.

Suggested fix, not tested

use one shared resolver.

58. Low Small helpers duplicated across modules
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
fn short_pid(pid: &str) -> String { ... &pid[..8] ...
Why it matters

parse_transaction_data, short_pid, cargo_home and the no-op contexts each exist twice, and these byte slices panic on non-ASCII input.

Suggested fix, not tested

keep one crate-level copy of each.

59. Low Local-URL detection copied with different behaviour
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
let is_localnet = cluster_url.contains("localhost") || cluster_url.contains("127.0.0.1");
Why it matters

substring matching also accepts real hostnames that contain these strings, and an IDL write is then skipped with exit code 0.

Suggested fix, not tested

use one helper that parses the host.

60. Low Transaction retry loop duplicated four times
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
for retries in 0..20 {
Why it matters

the retry logic and its count can drift apart between copies.

Suggested fix, not tested

extract one send-with-retries helper.

61. Low Default wallet path hard-coded in seven places
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#26)
From the report
Evidence
path.push(".config"); path.push("solana"); path.push("id.json");
Why it matters

the copies can drift, and expect panics when there is no home directory.

Suggested fix, not tested

use one helper that does not panic.

62. Low Host-target and ancestor-file helpers duplicated in the version manager
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#28)
From the report
Evidence
let output = Command::new("rustc").arg("-vV").output()?;
Why it matters

these helpers duplicate rustc_host_target, and idl_nightly.rs:231 duplicates find_ancestor_file.

Suggested fix, not tested

reuse the shared helpers.

63. Low Default RPC port written as literals beside its constant
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
_ => "http://127.0.0.1:8899".to_string(),
Why it matters

changing DEFAULT_RPC_PORT would leave stale copies behind.

Suggested fix, not tested

build these URLs from the constants.

64. Low Rent minimum computed by a hard-coded formula
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
fn rent_exempt_minimum(data_len: u64) -> u64 { (128 + data_len) * 3480 * 2 }
Why it matters

this diverges from the cluster's rent parameters, which are used elsewhere in the same crate.

Suggested fix, not tested

read the rent parameters from the cluster.

66. Low 64-bit values emitted as plain JSON numbers
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
"rentEpoch": account.rent_epoch,
Why it matters

JavaScript consumers lose precision; for example, u64::MAX is common here.

Suggested fix, not tested

emit 64- and 128-bit integers as strings.

67. Low Deploy proceeds without verifying the uploaded buffer
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
.filter(|e| format!("{:?}", e) != "AlreadyProcessed")
Why it matters
  • After the write phase, the buffer is not read back and compared with the binary before the irreversible deploy or upgrade.
  • Resume uses a snapshot that may still be changing on timeout (line 265).
  • Errors are filtered by their Debug text.

A corrupted program can go on-chain, and possibly be made immutable.

Suggested fix, not tested

compare the buffer byte for byte (or by hash) before deploying, and match on the error variant.

68. Low Release does not check the tag against source versions
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#30)
From the report
Evidence
if grep -q "no packages selected" "$out_file" \
 && grep -q "disabled due to previous publish" "$out_file"; then
Why it matters

a tag whose sources carry another version is treated as "already published", and a release and an image are still produced under that tag.

Suggested fix, not tested

compare the tag with VERSION, the Cargo workspace version and package.json in verify-tag.

69. Low Release dry-run watches removed workflow files
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
- .github/workflows/publish-crates.yaml
- .github/workflows/publish-npmjs.yaml
Why it matters

edits to the real release.yaml never trigger the rehearsal, and the dry-run uses a different toolchain from the release.

Suggested fix, not tested

watch release.yaml, and use the same toolchain and flags.

70. Low npm pack guard can never fail
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
"prepack": "[ ... ] && (echo Can be packed only on x86_64 GNU/Linux && exit 1) || ([ ... ] && (echo Check anchor binary version && exit 2) || exit 0)"
Why it matters

the trailing || exit 0 swallows both failures, so a wrong-platform or wrong-version binary can be published.

Suggested fix, not tested

rewrite the guard as explicit if/else in a checked script, and run it in the publish job.

Review: maintainer-only, borderline

71. Low Nightly build can mix commits under one label
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
const { channel, date, version, git_sha, git_short_sha, github_run_id } = manifests[0].data;
Why it matters

each matrix job checks out master separately (line 50). A commit that lands between jobs produces a mixed set, labelled with the first job's commit.

Suggested fix, not tested

resolve the commit once, check out that commit in every job, and assert all manifests agree.

72. Low Third-party tools installed without integrity checks
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#23)
From the report
Evidence
let bin_path = get_bin_dir_path().join("solana-verify");
fs::write(&bin_path, res.bytes()?)?;
Why it matters

solana-verify, and the platform-tools archive later run as a compiler (platform_tools.rs:586), are installed with no checksum or attestation check. The Anchor binaries are attested.

Suggested fix, not tested

verify a pinned SHA-256 or an attestation before installing. Where that is impossible, print an explicit "unverified" warning.

73. Low Program keypair replaced on any read error
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
read_keypair_file(&keypair_path)
    .unwrap_or_else(|_| {
        let keypair = Keypair::new();
Why it matters

a transient read error or a malformed file destroys the key that controls the program address.

Suggested fix, not tested

create a key only when the file is not found, and report every other error.

Review: )` overwrites; called only by init/new paths, lib.rs:1859, 2107)

74. Low Installer silently replaces existing avm and anchor commands
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
Location: avm/install:333
From the report
Evidence
if ! ln -sfn "$BIN_DIR/anchor" "$cargo_bin/anchor" 2>/dev/null; then
Why it matters

a cargo-installed stable anchor is overwritten without a backup.

Suggested fix, not tested

check whether the target exists, then back it up or ask first, and print what was replaced.

75. Low Makefile publish target is a stale second release path
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#39)
Location: Makefile:15
From the report
Evidence
publish:
	cd lang/syn/ && cargo publish && cd ../../
	sleep 25
Why it matters

the target omits crates that others pin exactly (for example lang/error, cli/cli-macros), so it fails midway. It also bypasses the signed-tag release flow.

Suggested fix, not tested

delete the target, or call the same release command as CI.

76. Low Changelog link date computed by two clocks
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
RELEASE_CHANGELOG="$(echo $GITHUB_REF_NAME | sed 's/\.//g' | sed 's/^v//')---$(date '+%Y-%m-%d')"
Why it matters

bump-version.sh:146 dates the heading on bump day. A release on another day links to an anchor that does not exist.

Suggested fix, not tested

derive the anchor from the changelog heading itself.

77. Low No final check of the published release
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
publish-npmjs:
  needs: verify-tag
Why it matters

five independent publish jobs run with no closing verification, so one failure leaves a half-published release.

Suggested fix, not tested

add a final job that installs the published artifacts and checks their versions.

78. Low No post-deploy check of on-chain program data
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
println!("Signature: {}", signature); Ok(())
Why it matters

success is reported on transaction confirmation alone.

Suggested fix, not tested

compare the program data's length and hash with the uploaded binary.

79. Low Toolchain swap deletes the working install first
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
if target.exists() { fs::remove_dir_all(target)...?; }
fs::rename(staging, target)...?;
Why it matters

if the rename fails, the user is left without a toolchain.

Suggested fix, not tested

rename the old install aside, swap in the new one, and restore the old one on failure.

80. Low Installer trusts a checksum from the same server
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#25)
Location: avm/install:303
From the report
Evidence
[ "$actual_sha" = "$expected_sha" ] || fail "checksum mismatch ..."
Why it matters

the checksum comes from the same bucket as the artifact. The size field is ignored, and the existing attestations are not checked.

Suggested fix, not tested

verify the build attestation, and check the size.

81. Low Installer version check compares a value with itself
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
Location: avm/install:357
From the report
Evidence
nightly_version="$(field "$avm_line" 1)"
anchor_version="$(field "$anchor_line" 1)"
Why it matters

both values come from the same manifest field, so a mixed set is never detected.

Suggested fix, not tested

compare per-artifact identifiers such as the commit.

82. Low Output files overwritten without a check
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
let mut file = File::create(&output_file)
Why it matters

program dump, the coverage output (coverage.rs:146) and fetch output overwrite existing files.

Suggested fix, not tested

use create_new, or require --force.

83. Low init --force replaces project files without listing them
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#22)
From the report
Evidence
if force { ... fs::remove_dir_all(default_program_dir)?; }
Why it matters

customised Anchor.toml and security.json files are replaced without a prompt.

Suggested fix, not tested

list what will be replaced and ask first, or skip files that already exist.

84. Low Commands bypass the shared RPC client constructor
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
let client = RpcClient::new(cluster_url);
Why it matters

these commands read finalized state while the rest of the CLI reads confirmed.

Suggested fix, not tested

route them through create_client().

85. Low Cached update failure repeats the same warning on every run
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
eprintln!("avm update check failed. Next attempt in {next_attempt_secs}s.");
Why it matters

the repeated line drowns out real warnings.

Suggested fix, not tested

print it once per window, or only in verbose mode.

86. Low Library writes simulation failures to the console
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
console.error(res.error.message, logTrace);
throw new SendTransactionError(...)
Why it matters

the output duplicates the thrown error, and callers cannot silence it.

Suggested fix, not tested

drop the console output, or put it behind a debug flag.

87. Low Three copies of the embedded version-map loader
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
static MAP: LazyLock<ParsedMap> = LazyLock::new(|| { ...
Why it matters

the copies in solana.rs and idl_nightly.rs can drift apart.

Suggested fix, not tested

use one generic loader.

88. Low Send configuration repeated at seven call sites
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
RpcSendTransactionConfig { skip_preflight, preflight_commitment: Some(CommitmentConfig::confirmed().commitment), ...
Why it matters

the copies can drift apart.

Suggested fix, not tested

use one helper.

89. Low Tool versions copied across workflows and drifted
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
SOLANA_VERSION: 3.1.10
Why it matters

other workflows use 4.1.2 or 4.1.0-rc.1, and the checkout action is pinned at three major versions.

Suggested fix, not tested

keep one source of truth, and document deliberate differences.

90. Low Retry-and-install block repeated across CI files
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
Location: .github/actions/setup-ts/action.yaml:16 (line corrected on review; the report cites :13)
From the report
Evidence
- uses: nick-fields/retry@... # v2
Why it matters

the block is repeated more than ten times.

Suggested fix, not tested

loop over the packages in one step, and reuse the action.

91. Low Error-recovery and blockhash logic repeated in provider
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
Location: ts/packages/anchor/src/provider.ts:177 (line corrected on review; the report cites :175)
From the report
Evidence
if (err instanceof ConfirmError) {
Why it matters

this logic appears in two methods, and the blockhash check in three.

Suggested fix, not tested

extract shared helpers.

92. Low npm dist-tag logic copied in two places
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#27)
Location: .github/workflows/release.yaml:401 (line corrected on review; the report cites :399)
From the report
Evidence
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+-.+ ]]; then
Why it matters

the same logic also lives in publish-npmjs.sh.

Suggested fix, not tested

move it into one shared script.

93. Low Vec<T> account lists validate only one account
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
T::try_accounts(program_id, accounts, ix_data, bumps, reallocs)
    .map(|item| vec.push(item))?;
Ok(vec)
Why it matters

a Vec<Account<..>> field looks as if it validates every supplied account. In fact it validates one, and the rest stay unchecked in the remaining slice.

Suggested fix, not tested

loop until the slice is exhausted (or up to a declared count), or reject Vec<T> at compile time.

96. Low Pre-funding the legacy IDL account blocks resizing
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
new_rent_minimum
    .checked_sub(idl_ref.lamports())
    .unwrap(),
Why it matters

anyone can send lamports to this deterministic address. Once it holds more than the minimum, resize panics permanently.

Suggested fix, not tested

use saturating arithmetic, and skip the transfer when the account is already funded.

97. Low Zero-copy loader panics on misaligned data
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
bytemuck::from_bytes(&data[disc.len()..mem::size_of::<T>() + disc.len()])
Why it matters

with a custom discriminator whose length is not a multiple of the type's alignment, load, load_mut and load_init abort on every call.

Suggested fix, not tested

use try_from_bytes, and assert the alignment at compile time.

99. Low Event listener added during removal never subscribes
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#3)
From the report
Evidence
await this._provider!.connection.removeOnLogsListener(this._onLogsSubscriptionId);
this._onLogsSubscriptionId = undefined;
Why it matters

a listener added during the await sees the old id and skips subscribing, so it never receives events.

Suggested fix, not tested

clear the id before the await, or serialise add and remove.

100. Low fetchMultiple throws instead of returning null
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#37)
From the report
Evidence
data: this._coder.accounts.decode(this._idlAccount.name, account.data),
Why it matters

the method is documented to return null for a wrong discriminator, but decode throws, so one foreign account fails the whole batch.

Suggested fix, not tested

catch the error per entry and return null.

101. Low Account encoding limited to 1000 bytes
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#38)
From the report
Evidence
const buffer = Buffer.alloc(1000); // TODO: use a tighter buffer.
Why it matters

larger accounts cannot be encoded. Type encoding (types.ts:33) has the same limit.

Suggested fix, not tested

size the buffer from the layout, or grow it on demand.

102. Low sendAll loses signatures of already-sent transactions
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
sigs.push(await sendAndConfirmRawTransaction(this.connection, rawTx, opts));
Why it matters

the first failure throws without the signatures of transactions that already committed, so callers retry them blindly.

Suggested fix, not tested

attach the partial results and the failing index to the error.

103. Low Plain program logs can be read as events (TypeScript)
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
if (log.startsWith(PROGRAM_LOG) || log.startsWith(PROGRAM_DATA)) {
Why it matters

a program that logs caller-controlled text lets that caller forge events.

Suggested fix, not tested

decode events only from Program data: lines, and make the free-text path opt-in.

104. Low Plain program logs can be read as events (Rust client)
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
if let Some(log) = l
    .strip_prefix(PROGRAM_LOG)
    .or_else(|| l.strip_prefix(PROGRAM_DATA))
Why it matters

this is the same weakness as finding 103, in the Rust client.

Suggested fix, not tested

accept only Program data: lines for events.

105. Low Negative integer PDA seeds encoded incorrectly
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
case "i64":
  return new BN(value).toArrayLike(Buffer, "le", 8);
Why it matters

the magnitude is encoded instead of two's complement, so negative seeds derive a different PDA from the on-chain program.

Suggested fix, not tested

use .toTwos(bits) for signed types, and range-check u8/i8.

Review: toArrayLike` encodes the magnitude; the wrong PDA fails the seeds check loudly)

106. Low Fetched accounts are not checked for program ownership
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
value && value.data.length !== 0
  ? this._coder.accounts.decode<T>(this._idlAccount.name, value.data)
Why it matters

an account from another program with the same discriminator is accepted as genuine state.

Suggested fix, not tested

compare value.owner with the program id before decoding.

107. Low Wrong array length for types with several const generics
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
const genericLen = genericArgs.find((g) => g.kind === "const");
Why it matters

the first const argument is taken regardless of its name, so data silently mis-parses.

Suggested fix, not tested

match the const generic by name.

108. Low Error translation can throw on unexpected logs
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
const leftPubkey = pubkeyRegex.exec(logs[anchorErrorLogIndex + 2])![1];
const rightPubkey = pubkeyRegex.exec(logs[anchorErrorLogIndex + 4])![1];
Why it matters

missing lines or non-key text throw, and that exception replaces the original transaction error.

Suggested fix, not tested

null-check every match, and fall back to the untranslated error.

109. Low Workspace proxy throws on inspection and symbol keys
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
get(workspaceCache: { [key: string]: Program }, programName: string) {
  ...
  programName = toCamelCase(programName);
Why it matters

logging, awaiting or inspecting anchor.workspace throws.

Suggested fix, not tested

return undefined for non-string keys and for probe names such as then, toJSON and inspect.

110. Low Simulation errors carry no message
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
class SimulateError extends Error {
  constructor(readonly simulationResponse: SimulatedTransactionResponse, message?: string) {
    super(message);
Why it matters

the error is thrown at line 358 with an empty message and is not exported, so callers can neither read nor match it.

Suggested fix, not tested

build a message from the error and logs, set the name, and export the class.

111. Low Downloaded installer script run without integrity check (version manager)
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
let status = Command::new("sh")
    .arg("-c")
    .arg(script)
Why it matters

the script is triggered automatically by versions pinned in a cloned project, with no checksum and no confirmation.

Suggested fix, not tested

verify a pinned checksum, and ask for consent before project-triggered installs.

112. Low Installer binary written to a predictable temp path and executed
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#24)
From the report
Evidence
let installer = std::env::temp_dir().join(format!("solana-install-init-{target}-{version}"));
fs::write(&installer, bytes)
Why it matters

another local user can pre-create or swap the file, which then runs as the invoking user.

Suggested fix, not tested

use a private temporary directory with exclusive creation, and verify a checksum before running.

113. Low Installing a version switches the global default
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
use_version(Some(version))
Why it matters

project-triggered installs (cli/src/lib.rs:1422, 3253) change the default Anchor version for every other project.

Suggested fix, not tested

make activation an explicit step.

114. Low Temporary proxy directory leaked on failing runs
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
if !exit.status.success() {
    std::process::exit(exit.status.code().unwrap_or(1));
Why it matters

the temporary cargo-proxy directory (a binary copy on Windows) is never cleaned up.

Suggested fix, not tested

return the code to main, and exit only after the guards are dropped.

115. Low Built-in debug cluster uses plaintext HTTP to a raw IP
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
Cluster::Debug => "http://34.90.18.145:8899",
Why it matters

signed traffic goes unencrypted to an address nothing shows the project controls.

Suggested fix, not tested

remove the variant, or use TLS on a domain the project controls.

116. Low Program keypair file created with default permissions
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#32)
From the report
Evidence
let mut file = File::create(&path)
file.write_all(format!("{:?}", program_kp.to_bytes()).as_bytes())?;
Why it matters

other local users can read the program key. The crate already has a 0600 writer (lib.rs:5081).

Suggested fix, not tested

use write_keypair_secure.

118. Low Failed installer download is reported as success
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
let install_script = std::process::Command::new("curl")
    .args(["-sSfL", &format!("https://release.{domain}/v{version}/install")])
    .output()?;
Why it matters

the curl exit status is never checked. A failed download produces an empty script, and sh -c "" succeeds.

Suggested fix, not tested

check the status and that the script is non-empty, and ask before running a downloaded script.

119. Low Unbounded wait for Surfpool runbooks
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#34)
From the report
Evidence
loop {
    let resp = client.send::<RpcResponse<SurfnetInfoResponse>>(
Why it matters

a stuck runbook hangs anchor test forever, and an RPC error leaves Surfpool running.

Suggested fix, not tested

add a deadline and error checks, and kill the child on failure.

120. Low Relative ledger path can delete the project
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#33)
From the report
Evidence
if !ledger_path.is_relative() {
...
fs::remove_dir_all(&ledger_path)
Why it matters

ledger = "." or ".." (possibly inherited through extends) deletes the project or its parent on every test run.

Suggested fix, not tested

canonicalise the path, require a strict descendant of a tool-owned directory, and reject ...

121. Low Coverage trace directory deleted without containment check
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#33)
From the report
Evidence
let trace_path = ws.root.join(trace_dir);
Why it matters

anchor coverage --trace-dir . deletes the whole project (line 4767).

Suggested fix, not tested

enforce containment in the target directory.

123. Low Any RPC error treated as "program does not exist"
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
let is_upgrade = rpc_client.get_account(&program_id).is_ok();
Why it matters

a transient error sends an existing program down the fresh-deploy path. The full buffer is written, at a cost in fees, before the deploy fails.

Suggested fix, not tested

distinguish "not found" from transport errors.

Review: ` at 1030; cost is buffer fees, and the deploy then fails)

125. Low Legacy IDL chunks ordered by signature within a slot
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
all_chunks.sort_by(|a, b| a.0.cmp(&b.0).then_with(|| a.1.cmp(&b.1)));
Why it matters

signatures carry no ordering, so several writes in one slot reassemble scrambled.

Suggested fix, not tested

use the on-chain order as the tie-break.

126. Low Hex decoder panics on non-ASCII chain data
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
.map(|i| u8::from_str_radix(&hex[i..i + 2], 16)
Why it matters

slicing the string by byte offsets panics on multi-byte characters, and in the parallel path that aborts the process.

Suggested fix, not tested

decode over as_bytes().

128. Low anchor account panics on supported IDL types
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
IdlType::U256 => todo!("Upon completion of u256 IDL standard"),
Why it matters

u256, i256 and generic array lengths crash the command.

Suggested fix, not tested

return descriptive errors instead.

129. Low Client output layout depends on how many programs were built
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
let multi_program = idl_paths.len() > 1;
Why it matters

a single-program build in a multi-program workspace switches the layout, and the clean step removes sibling clients.

Suggested fix, not tested

derive the layout from the workspace's program count.

130. Low Unpinned code generator run automatically on build
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
"npx".to_string(),
vec!["--yes".to_string(), "codama".to_string()],
Why it matters

the latest published package runs unattended on every build.

Suggested fix, not tested

pin exact versions.

131. Low Relative --idl output paths resolve after a directory change
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
Some(idl) => Some(PathBuf::from(idl)),
Why it matters

these options are plain strings, so the absolute-path conversion skips them. Files are then written relative to each program's directory.

Suggested fix, not tested

declare the options as PathBuf.

132. Low Relative IDL file path read after a directory change
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
with_workspace(cfg_override, |cfg| {
    let idl = fs::read(&idl_filepath)?;
Why it matters

run from a subdirectory, the command reads a different file or fails.

Suggested fix, not tested

use PathBuf so the path is made absolute.

133. Low Overflow-check guard passes when checks are disabled
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
.and_then(|profile| profile.overflow_checks)
.ok_or(anyhow!("`overflow-checks` is not enabled. ...
Why it matters

overflow-checks = false returns Ok(false), and the caller (lib.rs:2331) only uses ?, so the build proceeds.

Suggested fix, not tested

fail when the value is false.

Review: an explicit false is the developer's own setting

134. Low Test.toml extends cycle overflows the stack
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
Location: cli/src/config.rs:1226 (line corrected on review; the report cites :1227)
From the report
Evidence
current_toml.merge(_TestToml::from_path(&canonical_base)?);
Why it matters

a file that extends itself, directly or through others, recurses without end.

Suggested fix, not tested

track the paths already visited and report the cycle.

135. Low Custom cluster table depends on key order
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
if http_key != "http" || ws_key != "ws" {
Why it matters

{ ws = ..., http = ... } is rejected as an invalid key.

Suggested fix, not tested

deserialize into a struct with named fields.

137. Low anchor run joins arguments without quoting
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
let script_with_args = format!("{script_cmd} {}", script_args.join(" "));
Why it matters

arguments with spaces or shell characters break.

Suggested fix, not tested

pass them as positional parameters.

138. Low Migration output hidden on failure
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
std::process::Command::new(&command)
    .args(&args)
    ...
    .output()
Why it matters

the output of TypeScript migrations is captured and never shown, and a signal exit panics on unwrap (line 6524).

Suggested fix, not tested

inherit stdio or print the output on failure, and use unwrap_or(1).

Review: at 6498 captures; unwrap()` on the exit code at 6524)

139. Low Config values interpolated into generated JavaScript unescaped
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
const __connection = new web3.Connection("{cluster_url}", "processed");
Why it matters

Windows backslashes and quotes in paths or URLs break the generated script or change its code.

Suggested fix, not tested

embed values as JSON-encoded literals.

140. Low Network-suggested priority fee signed without a cap
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
let priority_fee = priority_fee
    .unwrap_or_else(|| get_recommended_micro_lamport_fee(client, write_locked_accounts));
Why it matters

a fee spike or a hostile RPC can make deploy, upgrade and close transactions burn a large part of the payer's balance. The averaging at line 1204 can also overflow.

Suggested fix, not tested

clamp the fee to a configurable maximum, and use checked arithmetic.

141. Low Signing keypair passed to a package fetched at run time
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
let mut command = Command::new("npx");
command.arg("--yes");
command.arg(format!("--package=@solana-program/program-metadata@{PMP_CLIENT_VERSION}"));
Why it matters
  • The upgrade-authority keypair path goes to code installed on the fly. Its transitive dependencies are not locked.
  • The RPC URL, which may contain an API key, is passed on the command line, where other processes can see it.
Suggested fix, not tested

vendor or lock the client with integrity hashes, and pass the URL through the environment.

142. Low Docs search endpoint fetches from a request-derived origin
First rating: Medium · Reviewed rating: Low · Review: could not be settled · new in this audit
From the report
Evidence
const url = process.env.MCP_INDEX_URL ?? `${origin}/docs/search-index.json`
cache.set(origin, await fetch(url).then((r) => r.json()))
Why it matters
  • Where the Host header is not pinned, callers choose what the server fetches.
  • The cache grows without limit.
  • A failed fetch throws on every tool call.
Suggested fix, not tested

use a configured base URL, check the response, and bound the cache.

Review: origin`, mcp.ts:102; whether the host can be chosen by the caller depends on the hosting setup, CANNOT-VERIFY; an unbounded cache and unchecked fetch are confirmed)

143. Low Nightly upload job has no branch or environment protection
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
upload-to-cloud-bucket:
  if: github.event.repository.fork == false
  permissions:
    id-token: write
Why it matters

a manual dispatch on any branch runs that branch's upload code with production bucket credentials, including latest.

Suggested fix, not tested

restrict the job to master, and add a protected environment.

Info after review (4)

5. Info Raw token-account field readers have no length or owner check
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
// Field parsers to save compute. All account validation is assumed to be done
// outside of these methods.
amount_bytes.copy_from_slice(&bytes[64..72]);
Why it matters

a short or foreign account causes a slice panic or a wrong value.

Suggested fix, not tested

return an error when the length is under 165 bytes or the owner is wrong, or document the precondition prominently.

27. Info Transaction confirmation polls every 500 ms
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
Location: client/src/lib.rs:894 (line corrected on review; the report cites :874)
From the report
Evidence
tokio::time::sleep(Duration::from_millis(500))
Why it matters

this polls even though a pubsub connection that could deliver signature notifications is available.

Suggested fix, not tested

use a signature subscription, and keep polling with backoff only as a fallback.

50. Info Cargo.lock hash is sliced by byte offset
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
let rev_prefix = &hash[..7];
Why it matters

a multi-byte character panics the debugger.

Suggested fix, not tested

use hash.get(..7).

65. Info Version maps compiled into the binary
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
const ANCHOR_SOLANA_MAP_TOML: &str = include_str!("../anchor-solana-map.toml");
Why it matters

updating the mapping data requires a new release.

Suggested fix, not tested

serve the maps as versioned remote data, and keep the embedded copy as a fallback.

Want this for your code?

Upload a ZIP or link a public GitHub repo, pick the areas and the depth, and get findings by severity with fixes.