# Security Vulnerabilities - index-CLiAcrMg.js

**URL:** <https://ghostforum.org/t/security-vulnerabilities-index-cliacrmg-js/191>\
**Category:** Submitted\
**Tags:** gst-extension-wallet\
**Created:** [October 23, 2026, 7:35am UTC](https://ghostforum.org/t/security-vulnerabilities-index-cliacrmg-js/191 "2026-10-23T07:35:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cosmos](https://ghostforum.org/user_avatar/ghostforum.org/cosmos/32/9_2.png) [@Cosmos](https://ghostforum.org/u/Cosmos)\
**Post date:** [October 23, 2026, 7:35am UTC](https://ghostforum.org/t/security-vulnerabilities-index-cliacrmg-js/191/1 "2026-10-23T07:35:20Z")

</div>

### 1a. `Unsafe call to import for argument 0` (line 7132)

The dynamic `import()` calls in this bundle take values that ultimately come from configuration:

```auto
// resolveCodecURI / ensureCodecStreams
async function ensureCodecStreams(format2, codecURI) {
  if (!codecStreams.has(format2) && codecURI) {
    setCodecStreams(format2, await import(/* @vite-ignore */ codecURI));
  }
}

```

and in the worker:

```auto
await import(n) // where n = codecURI from options

```

`codecURI` originates from `options.codecURI`, which a caller can supply when registering a codec / passing options to `ZipReader`/`ZipWriter`. In this extension, the only path that reaches it is the **JSON backup import** (`ImportAccounts` → `ZipReader`), which does **not** set `format`/`codecURI`. So today it is not attacker-controlled.

**Risk:** If a future code path ever lets a DApp or remote config set `codecURI`, this becomes arbitrary module execution in the extension origin.

**Recommendation:** hard-allowlist `codecURI` to extension-internal URLs (e.g. `chrome.runtime.getURL(...)`), and reject anything not matching `^chrome-extension://<your-id>/`.

### 1b & 1c. `Unsafe assignment to innerHTML` (walletPopup lines 1098, 1101)

These are the Radix ScrollArea viewport style injection:

```auto
jsxRuntimeExports.jsx("style", {
  dangerouslySetInnerHTML: {
    __html: `[data-radix-scroll-area-viewport]{...}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`
  },
  nonce
})

```

This is a **static string constant** from Radix UI - no user data flows into `__html`. It’s a false positive in the sense that there is no injection vector _here_. It’s flagged because the scanner can’t see the value is constant.

**Risk:** Low, but note MV3 CSP forbids inline `<style>` unless you pass a `nonce`. If you’re relying on `nonce` being populated correctly, verify it matches your manifest CSP. If `nonce` is ever derived from a message/query param, that _would_ be exploitable.

* * *

## 2. More Significant Findings in the Exposed Logic

These are worth flagging regardless of the scanner output:

### 2a. Signing approval trusts DApp-supplied `userSignedExtensions` (HIGH)

In `SignRequest`:

```auto
const cleanExtensions = JSON.parse(JSON.stringify(userSignedExtensions, ...));
await rpc.client.approveSignRequest(signRequestId, cleanExtensions, password);

```

`userSignedExtensions` is populated from the request (`request.userSignedExtensions.values` or via `UserSignedExtensionInputs` `onChange`). The serialization round-trip strips `bigint` → string, but there’s **no schema validation** on the shape before it reaches the signing RPC. If the RPC layer trusts keys like `CheckMortality`, `ChargeTransactionPayment`, or arbitrary extension identifiers, a malicious DApp could inject extensions (e.g. set tip = 0 while displaying a nonzero tip, or manipulate mortality) - a classic “blind signing” / display-vs-sign mismatch. **Recommendation:** validate `cleanExtensions` against the chain’s declared signed-extension schema, and render the final values the user actually signs.

### 2b. Address mismatch check is display-only (MEDIUM)

```auto
const isAddressMismatched = !!(request && activeAddress && request.address !== activeAddress);

```

This only gates the UI button (`isExecutionBlocked`). The actual `approveSignRequest` RPC is not shown to re-verify. If `rpc.client.approveSignRequest` doesn’t independently check the request’s `address`/`chainId` against the unlocked account, a race (user switches account between render and click) or a crafted request could sign for an unintended account.

**Recommendation:** enforce the address/chain binding server-side (in the RPC handler), not just in React state.

### 2c. `requestSecretSeed` reveal + clipboard behavior (MEDIUM)

```auto
const seed = await requestPassword(async (password) =>
  rpc.client.revealSecretSeed({ publicKey: accountTree.publicKey, password })
);
setSecretSeed(`0x${seed}`);

```

- The secret seed is placed in a `Textarea` `value` and a default “decoy” seed (`0xg00db0ybutwh4t...`) is used as a placeholder. That decoy string is fine, but the real seed lives in React state for 5s. Any XSS in the popup origin (see 2d) can read it.

- The seed is displayed in a `<Textarea>` with `readOnly` - but `readOnly` textareas can still be selected/copied by the user, which is expected. Ensure no `console.log`/error boundary serializes component state.

### 2d. `DecodedCallData` renders decoded call arguments (LOW/MEDIUM)

`DecodedValue` / `DecodedComplexValue` render strings from chain metadata + calldata. They go through React’s normal text escaping (they’re JSX children, not `dangerouslySetInnerHTML`), so no XSS. But **phishing** is possible: a DApp can craft calldata that decodes into misleading-looking values (e.g. a `str` argument containing “Approve 0 tokens” while the actual call does something else). The `Pallet :: Call` header plus raw `Args` is your only mitigation - consider also showing the raw call hex and a human-readable intent summary.

### 2e. Backup import writes into keystore with user-supplied JSON (MEDIUM)

`ImportAccounts` (jsonBackup tab):

```auto
const importedKeystore = JSON.parse(jsonText);
await rpc.client.extendKeystore({ includeDerivations, overwriteExisting, keystores: importedKeystore });

```

- `JSON.parse` of an attacker-controlled zip entry, then handed to `extendKeystore`. If `extendKeystore` doesn’t validate each keystore record (publicKey format, derivation paths, scheme), a malicious backup could inject accounts, overwrite existing ones (when `overwriteExisting: true`), or supply malformed seeds that later crash signing. **Recommendation:** validate schema (zod) on each keystore entry before the RPC call; enforce `overwriteExisting` default false (it is) and require explicit re-confirmation.

- The zip password is used only for the archive, not for keystore decryption - make sure the UI communicates that, or users may assume the password protects the imported keys.

### 2f. `ExportAccounts` encrypts the backup zip with an optional password (MEDIUM)

```auto
const zipWriter = new ZipWriter(zipBlobWriter, { password, zipCrypto: false });

```

`zipCrypto: false` → AES (good). But `password` is a free-text input with **no strength requirement** (unlike account passwords which have schema min length). An empty password produces an unencrypted backup. Add a minimum-length/strength check and warn on empty.

### 2g. `isNewerVersion` version check fetches from network (LOW)

`Settings` fetches `https://git.ghostchain.io/.../releases/latest` and compares versions with a hand-rolled parser. If the response is attacker-influenced (DNS, compromised host), the “update available” button links to `https://ghostchain.io/ghost-connect/` - a different origin. Fine, but verify that URL is the canonical download; otherwise a compromised release API could redirect users to a phishing download page. Consider pinning/verifying signatures of releases rather than version strings.

### 2h. `formatSupportByStream` caches `new StreamClass(format)` construction (LOW)

```auto
try { new StreamClass(format2); supported = true; } catch { supported = false; }

```

This probes codec support by constructing streams and discarding them. For `DecompressionStream`/`CompressionStream` this is cheap, but it constructs user-provided `CompressionStreamFallback` classes. If those have side effects on construction (they do - they allocate WASM buffers), repeated probing wastes resources. Not a security bug, but a DoS surface if `format` is attacker-controlled (it isn’t here).

### 2i. `DecodedCallData` uses SWR key `["getSignRequest"]` (INFO)

```auto
const { data: signRequests } = useSWR(
  signRequestId ? ["getSignRequest"] : null,
  () => rpc.client.getSignRequests()
);

```

The key doesn’t include `signRequestId`, so switching requests within the SWR dedup window may show stale data briefly. Ensure `approveSignRequest` uses the id from URL (`signRequestId`), not from `request`, to avoid signing a different payload than displayed. (It does use `signRequestId` - good - but the displayed `request` could momentarily be for a different id.)
