Skip to content

Security: dusk-network/wallet

docs/SECURITY.md

Security

Threat model and security considerations for Dusk Wallet.

Overview

Dusk Wallet is a self-custody wallet — users control their own keys. This document outlines security measures, known limitations, and recommendations.


Threat Model

Assets to Protect

Asset Sensitivity Storage
Mnemonic phrase Critical Encrypted in vault
Private keys Critical Derived in-memory from mnemonic
Shielded notes High IndexedDB (per-network)
Contacts Medium Platform storage, AES-GCM-256 per wallet; the key is HKDF-SHA-256 over the seed, held by the engine while unlocked
dApp permissions Medium Platform storage
User settings Low Platform storage

Threat Actors

  1. Malicious websites — XSS, phishing, fake dApps
  2. Browser extensions — Malicious or compromised extensions
  3. Local attackers — Physical access to device
  4. Network attackers — MITM, malicious nodes
  5. Supply chain — Compromised dependencies

Security Measures

Cryptographic Dependencies

@noble/curves and @noble/hashes execute in key derivation and signing paths, so their direct dependency versions are pinned exactly to make upgrades an explicit review decision. The lockfile already fixes versions for npm ci; exact manifest pins also constrain resolution when a lockfile is created or updated. Pins and integrity checks do not replace dependency review.

1. Mnemonic Protection

Encryption at Rest

Platform Algorithm Parameters
Extension PBKDF2 + AES-GCM-256 900,000 iterations
Tauri Stronghold + Argon2 OS-level encrypted storage
// Extension vault encryption
const key = await crypto.subtle.deriveKey(
  { name: "PBKDF2", salt, iterations: 900000, hash: "SHA-256" },
  passwordKey,
  { name: "AES-GCM", length: 256 },
  false,
  ["encrypt", "decrypt"]
);

Every recovery phrase on the device is sealed under the same password, each with its own IV, wallets added with the salt of one already there (dusk_vault_v2, see ARCHITECTURE.md). Adding a wallet, removing one and changing the password each ask for the password the wallets were unlocked with, and every change is read back and checked before it's kept. Nothing the password doesn't open is changed or removed, except by Reset.

Memory Lifecycle

  • Every unlocked wallet's mnemonic held in JavaScript heap after unlock, so a switch of wallet needs no password
  • All cleared on explicit lock or auto-lock timeout
  • Limitation: Cannot guarantee memory zeroization in JavaScript

Recommendations

  • Keep PBKDF2 iterations aligned with industry guidance (currently 900,000)
  • Keep rate limiting on unlock attempts (exponential backoff)

2. Auto-Lock

The wallet automatically locks after a configurable timeout:

Setting Options
Auto-lock timeout 1, 5, 15, 30, 60 minutes
Default 5 minutes

Implementation uses chrome.alarms API for reliable timing even when service worker sleeps. The last activity timestamp is persisted in extension session storage when available (falling back to local storage outside extension contexts), so a restarted background service worker does not immediately lock an otherwise active unlocked wallet.

Password on big sends

Settings can ask for the password again on any send above an amount chosen, off by default. It covers everything that moves money out, the wallet's own sends and a site's in its approval window. What counts is what goes out with the most its fee can be; what comes back counts only its fee; and a token's transfer or allowance, or a call of a contract the network's file doesn't name, asks on any amount, as it can't be counted in DUSK.

The background checks the password against the vault, for the wallet that's open, before anything of the send is made, under the unlock's own backoff: a page's say-so isn't enough. A wallet's own send carries a ticket the background gave for that send, once; a site's request stays waiting until its window gives the password. Changing the amount takes the password too. The amount is kept on its own (dusk_send_password_v1); no provider method reads or changes it, and the background refuses those messages from anything but the wallet's own pages. The engine answers only the background.

3. dApp Permissions

Origin-Based Access Control

  • Each origin must explicitly request connection
  • User approves via popup before granting access
  • Permissions stored per wallet, then per origin, with the selected profile/account index and grants
  • A site connected to one wallet sees nothing of another unless it's connected there too
  • A site that disconnects itself is disconnected from every wallet
  • A connection can be set to end after 1, 7 or 30 days, for a site or for new sites: past its end the site is as if never connected, and what it had waiting is refused
// Permission record, under its wallet's ID (its first public account)
{
  "2Z8m...": {
    "https://dapp.example.com": {
      profileId: "account:0:...",
      accountIndex: 0,
      grants: {
        publicAccount: true,
        shieldedReceiveAddress: false
      },
      connectedAt: 1706400000000,
      updatedAt: 1706400000000,
      // Only for one set to end
      lastsMs: 604800000,
      expiresAt: 1707004800000,
    }
  }
}

The wallet also keeps a record per site (dusk_site_records_v1), for Settings: when it last used its connection, and what it asked for and how that was answered, with a contract call's function name. Never an amount, recipient, memo, message, contract or hash. It's bounded (30 requests a site, 50 sites a wallet, what was approved kept longest), stays once a site is disconnected until it's forgotten, and goes with its wallet or a reset. No provider method reads it.

RPC Method Security

Method Permission Required Unlock Required
dusk_getCapabilities No No
dusk_requestProfiles No (grants it) Yes (prompt)
dusk_profiles Yes (returns [] otherwise) Yes (returns [] otherwise)
dusk_requestShieldedAddress No (grants or upgrades it) Yes (prompt)
dusk_chainId No (null until connected) No
dusk_switchNetwork Yes No
dusk_getPublicBalance Yes Yes
dusk_estimateGas Yes No
dusk_sendTransaction Yes Yes
dusk_watchAsset Yes Yes
dusk_signMessage Yes Yes
dusk_signTypedData Yes Yes
dusk_signAuth Yes Yes
dusk_disconnect No No
dusk_openPaymentLink No (a network's own web wallet, its own Send's link, on a press) No (Send asks to unlock)

dusk_signMessage and dusk_signAuth sign domain-separated Moonlight memo envelopes. They are not raw BLS digest-signing methods and must not be used for on-chain verification against a caller-supplied digest. Raw-digest signing is tracked in wallet issue #90.

User Approval for Transactions

All dusk_sendTransaction calls require explicit user approval via a popup window. Users can:

  • Review transaction details
  • Adjust gas settings
  • Approve or reject

Every approval is for one wallet: the one unlocked when the site asked, or, asked while locked, the one its window shows first. Its window shows no other, and what it approves is granted, signed or sent only while that wallet is the one unlocked. The wallet's own screens act for the wallet they were drawn for: a send goes only from its Review's wallet, profile and network, and a change to a wallet's profile, contacts, tokens or connected sites is refused once another wallet is open.

4. Content Security Policy

Extension

Manifest V3 enforces strict CSP by default:

  • No inline scripts
  • No eval()
  • No remote code execution

Tauri

The public repository does not currently include a native Tauri wrapper, so there is no checked-in tauri.conf.json to audit here.

5. Network Security

Node Communication

  • All node communication over HTTPS
  • Users can configure custom node URLs
  • No hardcoded API keys or secrets
  • Nothing a node serves runs: the wallet core is the copy packaged with the wallet, never w3sper's download from the node
  • A node can't name its network: Mainnet, Testnet and Devnet are only the exact addresses in @dusk-network/networks; anything else is Custom, with its host showing
  • A node can't choose the chain ID that's signed: a known address's comes from @dusk-network/networks, a custom node's is read once when it's added and fixed, and w3sper's builders get that one (pinNodeInfo in walletEngine.js). A node that later answers another chain ID gets no signature
  • A custom node can answer a .dusk name check with whatever it likes: wherever a name is taken for a payment (Send, Review, a site's approval window, the contact form, a contact's check) the wallet says which node checked it, and its answers are kept apart from those of the network's own node

Prover Communication

  • Prover receives transaction circuits (no private keys)
  • Timeouts prevent hanging connections
  • Fallback to node URL if prover fails

6. Extension Isolation

Content Script Isolation

  • Content scripts run in isolated world
  • Cannot access page JavaScript context
  • Provider injected via script tag with controlled interface

Page Bridge

The in-page postMessage transport is visible to other scripts in the same page. Its request IDs, wallet routing ID and event.source check do not authenticate a response against such scripts. The first matching response consumes a request; changing whether the pending entry is deleted before or after resolving/rejecting its Promise does not make a later genuine response win. Applications must independently verify returned signatures, signer identity and expected context; a resolved provider Promise is not proof of authenticity.

Service Worker

  • No DOM access (by design)
  • Wallet engine runs in offscreen document
  • Message passing with validation

Known Limitations

1. JavaScript Memory

JavaScript does not provide memory zeroization guarantees. Private keys and mnemonic remain in heap memory until garbage collected.

Mitigation: Lock wallet when not in use; rely on OS-level protections.

2. Browser Extension Trust

Users must trust:

  • The extension itself (install from official source)
  • Other installed extensions (could attempt to steal data)

Mitigation: Keep requested permissions minimal and review host_permissions regularly (broad host access increases blast radius).

3. IndexedDB Encryption

Shielded notes are stored in IndexedDB without encryption.

Risk: Local attacker with file system access could read notes.

Mitigation: Consider encrypting IndexedDB contents; rely on OS-level encryption.

4. PBKDF2 Iteration Count

Current iteration count is 900,000.

Risk: Brute-force resistance still depends on password strength.

Mitigation: Maintain a high iteration count and monitor guidance for updates.

5. No Hardware Wallet Support

Dusk uses BLS12-381 signatures, which Ledger/Trezor do not support.

Status: Not possible with current hardware wallet firmware.


Security Checklist

For Users

  • Use a strong, unique password for the wallet
  • Write down mnemonic phrase and store securely offline
  • Enable auto-lock with short timeout
  • Verify transaction details before approving
  • Only connect to trusted dApps
  • Keep browser and extensions updated

For Developers

  • Never log sensitive data (mnemonic, private keys)
  • Validate all message inputs
  • Use strict CSP in any native wrapper builds
  • Keep dependencies updated
  • Run security-focused code review for crypto code

Incident Response

If Mnemonic is Compromised

  1. Immediately transfer funds to a new wallet
  2. Create new wallet with fresh mnemonic
  3. Revoke all dApp permissions on compromised wallet

If Extension is Compromised

  1. Uninstall extension immediately
  2. Assume mnemonic is compromised
  3. Follow mnemonic compromise steps above

Security Audits

Status: No external audit completed yet.

Recommendation: Before production release, conduct:

  1. Cryptographic implementation review
  2. Smart contract interaction audit
  3. Browser extension security audit

Reporting Vulnerabilities

If you discover a security vulnerability, please:

  1. Do not open a public GitHub issue
  2. Report it privately through GitHub Security Advisories: https://github.com/dusk-network/wallet/security/advisories/new
  3. Include detailed reproduction steps
  4. Allow reasonable time for fix before disclosure

References

There aren't any published security advisories