Back to skill

Security audit

Use User Controlled Wallets

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent wallet-integration guidance, but its reusable examples expose sensitive wallet credentials and leave important authorization and transaction controls under-specified.

Review before installing or using in production. The skill may be useful for Circle wallet prototypes, but do not copy the storage, token-minting, or transfer examples as-is. Require authenticated server-side sessions, derive wallet user identity on the backend, keep wallet credentials out of localStorage and JavaScript-readable cookies, validate and authorize every transaction parameter server-side, default to testnet, and pin reviewed dependency versions.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
Findings (6)

T09 · Insecure Skill Coding Practices

Error
Location
references/create-wallet-pin.md:201
Finding

Wallet credentials persisted in browser localStorage in the PIN workflow

Content
View full analysis
{ if (!userId) return; const response = await fetch(`${apiBaseUrl}/api/wallet/get-token`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ userId }), }); const data = await response.json(); setCredentials({ userToken: data.userToken, encryptionKey: data.encryptionKey }); localStorage.setItem("userToken", data.userToken); localStorage.setItem("encryptionKey", data.encryptionKey); }; ``` ### Technical Analysis The example persists both `userToken` and `encryptionKey` in `localStorage`. Any JavaScript running under the application's origin can read these values. This includes injected scripts resulting from cross-site scripting, compromised third-party frontend packages, malicious analytics scripts, and potentially hostile browser extensions. These credentials are subsequently passed to `sdk.setAuthentication()` and are therefore security-sensitive wallet authorization material. Although `SKILL.md` warns that `localStorage` should not be used in production, the reference presents this behavior as part of a directly reusable implementation. ### Attack Path 1. A user authenticates through the PIN workflow. 2. The application saves the Circle `userToken` and `encryptionKey` in `localStorage`. 3. An attacker obtains same-origin script execution through an XSS vulnerability or compromised frontend dependency. 4. The attacker reads: ```js localStorage.getItem("userToken"); localStorage.getItem("encryptionKey"); ``` 5. The attacker exfiltrates the credentials and attempts to initialize the wallet SDK or execute available wallet challenges before the credentials expire. ### Impact Assessment Successful exploitation exp ...[truncated 377 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
references/create-wallet-email-otp.md:151
Finding

Wallet credentials persisted in browser localStorage in the email OTP workflow

Content
View full analysis
{ if (error) { setStatus("Login failed: " + ((error as Error).message || "Unknown error")); return; } const loginRes = result as LoginResult; setLoginResult(loginRes); localStorage.setItem("userToken", loginRes.userToken); localStorage.setItem("encryptionKey", loginRes.encryptionKey); setStatus("Email verified. Ready to initialize user."); }; ``` ### Technical Analysis After successful OTP verification, the code writes the resulting `userToken` and `encryptionKey` to origin-wide browser storage. `localStorage` has no `HttpOnly` protection and remains available across page reloads until explicitly removed. The example does not implement logout cleanup for these values. The OTP verifies the user at login time, but persistent exposure of the resulting credentials weakens the security gained from that verification. A later same-origin script compromise can retrieve the authenticated session material without repeating the OTP process. ### Attack Path 1. The victim completes email OTP verification. 2. The callback stores the resulting wallet credentials in `localStorage`. 3. Before the credentials are removed or expire, attacker-controlled JavaScript executes in the application origin. 4. The script reads and transmits the stored `userToken` and `encryptionKey`. 5. The attacker attempts to replay the credentials against wallet SDK or backend operations. ### Impact Assessment An attacker may obtain the authenticated wallet session material of users who completed OTP verification. Potential consequences include disclosure of wallet metadata and balances, creation of wallet-operation challenges, or attempts to execute sensitive operations within t ...[truncated 66 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
references/create-wallet-social-login.md:143
Finding

Social-login wallet credentials stored in JavaScript-readable cookies

Content
View full analysis
{ if (cancelled) return; if (error) { setStatus("Login failed: " + ((error as Error).message || "Unknown error")); return; } const { userToken, encryptionKey } = result as { userToken: string; encryptionKey: string }; setCookie("userToken", userToken); setCookie("encryptionKey", encryptionKey); }; ``` The same workflow also stores device credentials without explicit security attributes: ```tsx setCookie("deviceToken", data.deviceToken); setCookie("deviceEncryptionKey", data.deviceEncryptionKey); ``` ### Technical Analysis Cookies created by frontend JavaScript cannot be marked `HttpOnly`. Consequently, any JavaScript executing in the origin can read the wallet session and encryption credentials. The calls also do not specify `Secure`, `SameSite`, path, domain, or expiration controls. This directly conflicts with the security rule in `SKILL.md` that recommends `HttpOnly` cookies. `react-cookie` is suitable for browser-managed state, but it cannot safely create an `HttpOnly` credential cookie because that attribute must be set by the server. ### Attack Path 1. The victim completes the social OAuth flow. 2. The login callback writes wallet credentials to JavaScript-readable cookies. 3. An attacker exploits XSS or compromises a frontend dependency. 4. The attacker reads `document.cookie` or uses the cookie library to retrieve the credentials. 5. The stolen credentials are replayed while valid to attempt wallet access or challenge execution. If the application is served without enforced HTTPS and cookies lack the `Secure` attribute, transport exposure may also be possible. ### Impact Assessment The exposed data includes user authentication and e ...[truncated 296 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
references/create-wallet-pin.md:65
Finding

Caller-controlled user identity can be exchanged for wallet session credentials without demonstrated authorization

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
references/send-transaction.md:102
Finding

Transaction helper passes unvalidated transfer parameters to the wallet API

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:18
Finding

Mutable latest dependency versions undermine reproducible security review

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (10)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/create-wallet-email-otp.md (reported line 25)May include surrounding context.

md
## Prerequisites

1. **Circle Developer Console**:
   - Get API key from Project Settings
   - Navigate to Wallets -> User Controlled -> Configurator
   - Copy the App ID from the configurator
   - No additional configuration needed -- PIN works out of the box

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/create-wallet-pin.md (reported line 20)May include surrounding context.

md
## Prerequisites

1. **Circle Developer Console**:
   - Get API key from Project Settings
   - Navigate to Wallets -> User Controlled -> Configurator
   - Copy the App ID from the configurator
   - No additional configuration needed -- PIN works out of the box

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/create-wallet-social-login.md (reported line 21)May include surrounding context.

md
## Prerequisites

1. **Circle Developer Console**:
   - Get API key from Project Settings
   - Navigate to Wallets -> User Controlled -> Configurator
   - Copy the App ID from the configurator
   - No additional configuration needed -- PIN works out of the box

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The trigger list includes broad terms like 'userToken', 'deviceToken', 'challenge execution', and generic wallet/auth phrases that could cause the skill to activate for loosely related requests. In a wallet and authentication context, over-broad matching increases the chance the agent applies sensitive wallet guidance in the wrong context, which can lead to unsafe implementation advice or inappropriate handling of transaction/authentication flows.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · SKILL.md (reported line 112)May include surrounding context.

md
- NEVER hardcode, commit, or log secrets (API keys, encryption keys). ALWAYS use environment variables or a secrets manager. Add `.gitignore` entries for `.env*` and secret files when scaffolding.
- ALWAYS implement both backend and frontend. The API key MUST stay server-side -- frontend-only builds would expose it.
- ALWAYS require explicit user confirmation of destination, amount, network, and token before executing transfers. NEVER auto-execute fund movements on mainnet.
- ALWAYS warn when targeting mainnet or exceeding safety thresholds (e.g., >100 USDC).
- ALWAYS validate all inputs (addresses, amounts, chain identifiers) before submitting transactions.
- ALWAYS warn before interacting with unaudited or unknown contracts.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The frontend stores userToken and encryptionKey in localStorage, which is readable by any JavaScript running in the origin, including injected scripts from an XSS vulnerability or compromised third-party dependencies. In this wallet context, those values are authentication material for challenge execution, so theft could enable unauthorized wallet actions or account takeover within the SDK session model.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The frontend example stores userToken and encryptionKey in localStorage, which is readable by any JavaScript running in the page origin, including injected script from XSS or compromised third-party dependencies. Because these values are used to authenticate wallet operations in the Web SDK, exposure can enable unauthorized wallet actions during the token lifetime.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

Sensitive wallet credentials are written to browser localStorage without any warning or justification, normalizing an unsafe storage pattern for developers who may copy the example verbatim. In a wallet context, this is especially dangerous because the stored values directly support authenticated challenge execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The example sends userId and later userToken to backend API endpoints as part of wallet creation and initialization flows. While this is functionally expected, the markdown does not disclose to users that personally identifying and authentication data will be transmitted between frontend, backend, and Circle services.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The example explicitly persists highly sensitive wallet authentication material (deviceToken, deviceEncryptionKey, userToken, and encryptionKey) in browser cookies to survive OAuth redirects. If those cookies are accessible to client-side JavaScript or are not strictly protected with secure attributes, any XSS, browser extension, shared-device access, or misconfiguration could expose material sufficient to impersonate the user or authorize wallet operations. In a non-custodial wallet context, storing key-related secrets in cookies is especially dangerous because compromise can directly lead to unauthorized wallet access or transaction approval flows.

Content

No source excerpt is available for this finding.