
| Audited | anza-xyz/wallet-adapter at commit 3663416165b9a1af734c451e588b40cacd7091c1 |
|---|---|
| Date | 11 October 2026 (audited again; first audit 11 October 2026) |
| How it ran | local run on our workstation, full audit, Standard review |
| Verdict after review | Pass with notes (Fail if a High finding remains after review, otherwise Pass with notes) |
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. 21 findings in the first audit; 21 still open (16 found again, 5 not reported again but still present). This audit has 29 findings after review, 11 of them new.
| First audit | Finding | Reviewed rating then | Now | In this audit |
|---|---|---|---|---|
| #1 | Example reports success for failed tx | Low | Still open | #4 |
| #2 | Sign fallback || transaction | Low | Still open | #5 |
| #3 | Sign-in example has no nonce/expiry | Info | Still open | #7 |
| #4 | No secure-context check | Info | Still open | #9 |
| #5 | Re-selected connected mobile wallet shown as disconnected | Medium | Still open | #10 |
| #6 | Detection polls every second forever | Low | Still open | #14, #15 |
| #7 | Solflare leaves accountChanged listener | Low | Still open | #18 |
| #8 | Ledger/Trezor leave device session open on failed connect | Medium | Still open | #12, #13 |
| #9 | Mobile decision memoised without readyState | Low | Still open | not reported again |
| #10 | connecting/disconnecting kept in ref + state | Low | Still open | not reported again |
| #11 | Generic localStorage keys, unvalidated JSON | Info | Still open | #17 |
| #12 | Changing storage key writes old value to new slot | Low | Still open | #11 |
| #13 | Second connect() resolves immediately | Low | Still open | #23, #21 |
| #14 | Example buttons can double-fire | Low | Still open | not reported again |
| #15 | Lifecycle code duplicated, has drifted | Low | Still open | #24 |
| #16 | Modal text hard-coded | Low | Still open | not reported again |
| #17 | Buffer polyfill copied 4 times | Low | Still open | #25 |
| #18 | Two "missing provider" message builders | Info | Still open | #26 |
| #19 | MathWallet message handler ignores sender | Low | Still open | #29 |
| #20 | Keystone signMessage un-awaited promise | Low | Still open | #3 |
| #21 | ConnectionProvider default config new each render | Low | Still open | not reported again |
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. 13 findings were first rated Medium or High; 3 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 (3)
From the report
useEffect(() => {
if (!adapter) return;
connected and publicKey are read from the adapter only on the first render (lines 44–45). When the selected adapter changes, the effect's cleanup sets both to disconnected, and nothing re-reads the new adapter. The mobile wallet adapter is deliberately not disconnected when the user switches away (WalletProvider.tsx line 93). If the user switches back to it, the provider shows "disconnected" while the adapter is connected. connect() then returns early on wallet?.adapter.connected (line 255), so the UI is stuck.
in the effect, after subscribing, call setPublicKey(adapter.publicKey) and setConnected(adapter.connected).
From the report
await wallet.init({
after init() succeeds, a failed public-key request (lines 116–122) leaves the initialised instance, its iframe and its listeners alive. The next connect() calls init() again on the already initialised instance. In addition, _disconnected calls wallet.dispose() without await (line 214), so a rejection escapes the surrounding try/catch as an unhandled rejection.
on every failure after init(), await wallet.dispose() inside a try/catch. Add await on line 214.
packages/core/base/src/signer.ts:46From the report
transaction = await this.signTransaction(transaction);
const rawTransaction = transaction.serialize();
return await connection.sendRawTransaction(rawTransaction, options);
in the base signer's versioned-transaction branch, the signers option is never applied, unlike the legacy branch (lines 61–65). Any versioned transaction that needs an extra signer, such as a new account keypair, is submitted without that signature and fails. The whole options object, signers included, is also passed to sendRawTransaction. This affects every adapter built on the base signer (Ledger, Trezor, Keystone, Torus, Particle, the unsafe burner, and others).
destructure signers before the branch, call transaction.sign(signers) when present before the wallet signs, and pass only the remaining send options to sendRawTransaction.
Low after review (19)
From the report
try {
return wallet.signTransaction(transaction);
} catch (error: any) {
the promise is returned without await, so if the wallet rejects, neither catch block runs:
- the error is not wrapped in
WalletSignTransactionError; - the adapter's
errorevent never fires; - the app's
onErrorhandler is never called, and callers get a raw, unclassified rejection.
The same applies to signAllTransactions (line 145) and signMessage (line 161).
use return await wallet.signTransaction(transaction); (and the same for the other two methods).
From the report
return wallet.signMessage(new TextDecoder().decode(message));
this line has three problems:
- It is not awaited, so a rejection bypasses error wrapping and the
errorevent. - The catch block throws
WalletSignTransactionErrorfor a message-signing failure. - The bytes are decoded to text with a lenient decoder, which replaces invalid UTF-8 sequences. A signature over non-text bytes therefore covers different data than the caller supplied.
return await; throw WalletSignMessageError. Pass the raw bytes if the wallet API allows it; otherwise reject non-UTF-8 input with new TextDecoder('utf-8', { fatal: true }).
From the report
try {
return keyring.signMessage(publicKey, message);
} catch (error: any) {
this is the same missing await as in finding 1. A rejected or failed hardware signature is neither wrapped nor emitted, and the catch block uses the transaction error class.
return await keyring.signMessage(...) and throw WalletSignMessageError.
From the report
await connection.confirmTransaction({ blockhash, lastValidBlockHeight, signature });
notify('success', 'Transaction successful!', signature);
confirmTransaction resolves even when the transaction was processed and failed on chain; the failure is only in value.err. The user is told the transaction succeeded when it did not. Developers copy this example, so the flaw spreads. The same pattern is in SendLegacyTransaction.tsx (line 43), SendV0Transaction.tsx (line 56) and RequestAirdrop.tsx (line 21).
read the result and throw when value.err is set, before showing success.
packages/wallets/phantom/src/adapter.ts:234 (also line 250)From the report
return (await wallet.signTransaction(transaction)) || transaction;
return (await wallet.signAllTransactions(transactions)) || transactions;
if a wallet ever resolves with nothing, for example on a silent cancel, the caller receives the original unsigned transaction as if it had been signed. The failure then surfaces later and less clearly, when the transaction is sent. The same fallback is in most injected-wallet adapters (solflare, torus, coinbase, trust, mathwallet, and others).
treat an empty result as a rejection (WalletSignTransactionError). For batches, also check that the result length matches the input.
From the report
if (wallet.publicKey.toString() === '11111111111111111111111111111111') throw new WalletAccountError();
if the wallet resolves connect() without an account, this throws a raw TypeError instead of the account error the other adapters raise.
check !wallet.publicKey first and throw WalletAccountError.
From the report
useEffect(() => {
if (isFirstRenderRef.current) {
the value is read from storage once, at mount, but the write effect also runs when key changes. If a consumer changes the key at runtime (for example localStorageKey on WalletProvider), the old key's value is written under the new key. When that value is null, the new key's saved value is deleted.
re-read storage when key changes and skip the write for that render, or document and enforce that the key is fixed.
From the report
publicKey = await getPublicKey(transport, this._derivationPath);
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
the HID transport opened on line 81 is never closed when reading the public key fails (wrong app open, locked device, user rejection). The page keeps holding the device. Retries and other tabs or apps can find the Ledger busy until the page is reloaded.
in that catch block, await transport.close() (ignoring its errors) before rethrowing.
packages/core/base/src/adapter.ts:143From the report
const interval =
// TODO: #334 Replace with idle callback strategy.
setInterval(detectAndDispose, 1000);
the interval is cleared only when the wallet is detected. Every adapter constructed for a wallet the user does not have keeps a 1-second timer for the life of the page. The timers also accumulate if adapters are re-created.
return a dispose function and stop after a bounded window, or back off after the load event.
From the report
wallet.on('disconnect', this._disconnected);
this._wallet = wallet;
this._publicKey = publicKey;
only the Phantom and Solflare adapters listen for account changes. In the others, if the user switches account inside the wallet, the adapter keeps reporting the old address. The app may then build transactions for one address while the wallet signs with another.
subscribe to the wallet's account-change event where one exists. Otherwise re-read and compare the key before signing.
From the report
wallet.off('disconnect', this._disconnected);
this._wallet = null;
disconnect() removes both listeners (line 167), but the externally triggered _disconnected path removes only one. Each such disconnect then leaves a stale accountChanged handler attached.
also call wallet.off('accountChanged', this._accountChanged) here.
From the report
this._connecting = true;
the flag is set only after the awaited SDK import (line 117). Two near-simultaneous connect() calls both pass the guard, create two SDK instances and open two approval prompts, and one instance is orphaned. Every other adapter sets the flag before its first await.
set this._connecting = true before the dynamic import, or keep and return the in-flight connect promise.
From the report
if (this.connected || this.connecting) return;
...
} finally { this._connecting = false; }
the early return sits inside the try whose finally resets the flag. The sequence is:
- A first
connect()is still pending. - A second call made during that time returns early, and its
finallysets_connectingback to false. - A third call then passes the guard and starts a parallel connect, which registers the wallet listeners twice.
The same shape is in about 33 adapters. The React provider has its own guard, but code that uses the adapters directly does not.
move the guard above the try, or store the in-flight promise and return it to repeat callers.
packages/wallets/nufi/src/adapter.ts:181From the report
sendOptions.preflightCommitment = sendOptions.preflightCommitment || connection.commitment;
const { signature } = await wallet.signAndSendTransaction(transaction);
the options are computed and then never passed to the wallet, so callers' skipPreflight, maxRetries and preflightCommitment are silently ignored. This is a direct result of the send logic being copied into each adapter instead of shared: the copies drift.
pass sendOptions to signAndSendTransaction. Move the shared send-preparation logic into the base adapter so each adapter keeps only its vendor-specific call.
From the report
if (isConnectingRef.current || isDisconnectingRef.current || wallet?.adapter.connected) return;
a second connect() resolves immediately while the first is still pending. Code that awaits it can continue as if the wallet were connected.
keep a ref to the in-flight promise and return it to later callers.
From the report
private _disconnected = () => {
const wallet = this._wallet;
these pieces are repeated in 20–35 adapters:
- the disconnect handler;
- the readiness-detection block;
- the wrapping of each sign call in a try/catch that emits an
errorevent.
Every fix has to be applied to each copy, and findings 1, 3, 18 and 22 show the copies already differ.
move the common pieces into the base adapter or a shared helper, and leave only the vendor-specific calls in each adapter.
From the report
if (typeof window !== 'undefined' && window.Buffer === undefined) {
(window as any).Buffer = Buffer;
}
identical copies also live in the coin98, keystone and trezor packages, so any change has to be made four times.
move the polyfill to one shared internal module and import it from all four.
packages/ui/react-ui/styles.css:1From the report
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');
every dApp that includes this stylesheet makes a request to a third-party font service and sends the visitor's IP address to it. The integrating app has no say in this.
bundle the font files with same-origin @font-face rules, or drop the import and rely on the system-font fallback. Confirm afterwards in a browser request log that no request goes to the font host.
From the report
const data = event.data;
if (data && data.origin === 'mathwallet_internal' && data.type === 'lockStatusChanged' && !data.payload) {
this._disconnected();
the handler checks only a field inside the message body, not who sent it. Any embedded frame, popup or third-party script on the page can post this message and force-disconnect the user's wallet session.
act only when event.source === window and event.origin matches the expected origin. Do not treat a self-declared field in the payload as proof of the sender.
Info after review (7)
From the report
const input: SolanaSignInInput = {
domain: window.location.host,
the sign-in input is built and verified entirely in the browser, with no nonce, issue time or expiry. As a pattern copied into a real app, the signed proof could be replayed. The same pattern is in the auto sign-in in ContextProvider.tsx (lines 91–98).
fetch a one-time nonce and expiry from the backend, include them in the input, and verify the output on the server. Label the client-only verification as a demo.
From the report
const message = new TextEncoder().encode(
the signed text contains only the host and the address. Any captured signature stays valid forever if the pattern is reused for login.
include a server-issued nonce and an expiry in the signed text, and verify on the server.
From the report
if (window?.isPhantomInstalled && (window.phantom?.solana?.isPhantom || window.solana?.isPhantom)) {
browser wallets refuse to inject into plain-HTTP pages other than localhost. A search of the packages found no protocol or secure-context check, so the wallet simply never appears and the developer gets no hint why.
when window.isSecureContext is false, log a clear warning or report the wallet as not ready with an explanatory message.
From the report
scopePollingDetectionStrategy(() => {
if (window?.isPhantomInstalled && (window.phantom?.solana?.isPhantom || window.solana?.isPhantom)) {
almost every legacy adapter polls instead of using a native signal. That costs work on every page and adds up to a second of detection latency.
prefer the Wallet Standard registration event or the wallet's own initialisation event. Keep polling only as a bounded fallback.
From the report
localStorageKey = 'walletName',
a bare key like walletName can collide with other code on the same origin. Nothing checks that the stored value is of the expected kind, and no storage listener handles other tabs. The example app also uses the bare key autoConnect.
use a prefixed default (for example solana-wallet-adapter:walletName), check on read that the value is a string, and decide explicitly how other tabs are handled.
From the report
setTimeout(() => setCopied(false), 400);
the timeout can fire after the component unmounts and update state that no longer exists. WalletModal.tsx (lines 43 and 105) has the same pattern.
keep the timeout id in a ref and clear it in an effect cleanup.
From the report
function constructMissingProviderErrorMessage(action: string, valueName: string) {
packages/core/react/src/useWallet.ts builds the same message separately, so the two can drift.
use one helper that takes the provider name, shared by both.