Back to skill

Security audit

UniMarket P2P Marketplace

Security checks for vulnerabilities and agentic risk

Overview

This marketplace skill is mostly coherent, but it takes unusually broad access to a shared wallet by reading recovery material and deliberately extracting a raw private key.

Install only if you are comfortable letting this skill read your shared Unicity wallet files and handle raw wallet key material inside its Node.js process. Prefer a version that delegates signing to the Unicity wallet plugin without exposing mnemonic or private-key material, removes the embedded API key, and documents exact network and filesystem access.

Vulnerability Patterns
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
lib/wallet.ts:11
Finding
Wallet Mnemonic Loading and Private-Key Encapsulation Bypass<![CDATA[ ## Vulnerability Details **File Location**: `lib/wallet.ts:11-14` and `lib/wallet.ts:49-58` **Vulnerability Type**: Direct access to wallet recovery material and private SDK state **Risk Level**: High ### Complete Vulnerable Code ```ts const mnemonicPath = join(config.walletDataDir, 'mnemonic.txt'); const mnemonic = existsSync(mnemonicPath) ? readFileSync(mnemonicPath, 'utf-8').trim() : undefined; ``` ```ts // Access the private key from Sphere's internal _identity field. // The public `sphere.identity` getter strips privateKey, but the // underlying TypeScript-private `_identity` stores a FullIdentity // which includes `privateKey: string`. export function getPrivateKeyHex(sphere: Sphere): string { const fullIdentity = (sphere as any)._identity; if (!fullIdentity?.privateKey) { throw new Error('No wallet identity or private key not accessible'); } return fullIdentity.privateKey; } ``` ### Technical Analysis The Skill directly reads the wallet recovery mnemonic from `mnemonic.txt` into its Node.js process. It then deliberately bypasses the Sphere SDK's public interface by casting the object to `any` and accessing the internal `_identity` field. The comments explicitly acknowledge that the public `sphere.identity` getter removes the private key. Accessing `_identity` therefore circumvents an intentional encapsulation boundary designed to prevent consumers from obtaining raw private-key material. Although the private key is subsequently used locally to sign marketplace requests and is not directly transmitted by the reviewed code, both the mnemonic and private key become accessible within the same process as all loaded dependencies. Any compromised dependency, runtime instrumentation, malicious future modification, diagnostic dump, or unintended logging path could consequently expose wallet secrets. ### Attack Path 1. A user invokes an authenticated command such as `scripts/profile.ts`, `scripts/intent.ts`, or `scripts/register.t ...[truncated 1287 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove direct filesystem access to `mnemonic.txt` from the Skill. 2. Remove `getPrivateKeyHex()`, the `as any` cast, and all access to the SDK's `_identity` property. 3. Expose a signing operation through the Unicity wallet plugin, such as a narrowly scoped `signMarketplaceRequest(payload)` API, so private-key material never leaves the wallet boundary. 4. Where possible, use OS-backed or hardware-backed key storage and require signing confirmation for sensitive operations. 5. Use a domain-separated signing format that binds the signature to: - The marketplace origin. - HTTP method. - Request path. - Request body. - Timestamp and nonce. 6. Ensure secrets are never included in logs, thrown errors, telemetry, crash dumps, or debug output. 7. Run authenticated marketplace operations in a least-privileged process with only access to the wallet signing interface, not the wallet recovery files. 8. Add tests that fail if application code accesses `mnemonic.txt`, `_identity`, or raw private-key fields. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
lib/wallet.ts:27
Finding
Hardcoded Oracle API Credential Distributed in Source Code<![CDATA[ ## Vulnerability Details **File Location**: `lib/wallet.ts:27-30` **Vulnerability Type**: Hardcoded secret **Risk Level**: Medium ### Complete Vulnerable Code ```ts oracle: { trustBasePath, apiKey: process.env.UNICITY_API_KEY ?? 'sk_06365a9c44654841a366068bcfc68986', }, ``` ### Technical Analysis The Skill embeds a credential-like oracle API key directly in source code and uses it whenever `UNICITY_API_KEY` is not set. Because the project is distributed to users, this value must be treated as publicly disclosed rather than secret. A shared, hardcoded credential cannot provide meaningful per-installation authentication or accountability. Anyone who obtains the package can extract and reuse it independently of the Skill. Abuse cannot be reliably attributed to a particular installation, and revoking the shared key can disrupt every installation that relies on the fallback. ### Attack Path 1. An attacker downloads or otherwise obtains the Skill package. 2. The attacker opens `lib/wallet.ts` and copies the embedded API key. 3. The attacker identifies the oracle service used by the Sphere SDK. 4. The attacker submits requests to that service using the exposed key. 5. The shared credential may be used to consume quota, trigger rate limits, or perform any operation authorized to that credential. 6. Service-side revocation of the compromised key may cause availability failures for legitimate Skill installations using the default. ### Impact Assessment The exact service permissions of the embedded key are not defined in the reviewed project, so broader privileges cannot be confirmed. Based on the available evidence, plausible impact includes: - Unauthorized use of the associated oracle service. - Consumption of shared quotas or billable resources. - Rate-limit exhaustion and denial of service for legitimate users. - Loss of per-user attribution and auditability. - Operational disruption when the exposed key is revoked or rotated. There is no evide ...[truncated 117 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed API key. 2. Remove the hardcoded fallback from source code. 3. Require `UNICITY_API_KEY` to be supplied through an approved secret-management mechanism. 4. Fail closed with a clear configuration error when the credential is absent. 5. Issue a distinct, least-privileged credential to each installation, user, or deployment. 6. Apply server-side rate limits, permission scoping, expiration, and usage monitoring. 7. Avoid placing secrets in command-line arguments, repository files, package metadata, logs, or example configuration. 8. Add automated secret scanning to CI and repository pre-commit checks. 9. Review service logs for unauthorized use of the disclosed key. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (45)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
If the skill behavior truly includes reading wallet seed material, exposing private keys, or using undeclared oracle/API keys beyond the marketplace description, that is a serious trust-boundary violation. The danger is amplified by the skill's trading context because it is explicitly connected to a shared wallet and remote servers, so hidden key-handling behavior could lead to theft or identity compromise.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
If the skill behavior truly includes reading wallet seed material, exposing private keys, or using undeclared oracle/API keys beyond the marketplace description, that is a serious trust-boundary violation. The danger is amplified by the skill's trading context because it is explicitly connected to a shared wallet and remote servers, so hidden key-handling behavior could lead to theft or identity compromise.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding
If the skill behavior truly includes reading wallet seed material, exposing private keys, or using undeclared oracle/API keys beyond the marketplace description, that is a serious trust-boundary violation. The danger is amplified by the skill's trading context because it is explicitly connected to a shared wallet and remote servers, so hidden key-handling behavior could lead to theft or identity compromise.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
If the skill behavior truly includes reading wallet seed material, exposing private keys, or using undeclared oracle/API keys beyond the marketplace description, that is a serious trust-boundary violation. The danger is amplified by the skill's trading context because it is explicitly connected to a shared wallet and remote servers, so hidden key-handling behavior could lead to theft or identity compromise.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
If the skill behavior truly includes reading wallet seed material, exposing private keys, or using undeclared oracle/API keys beyond the marketplace description, that is a serious trust-boundary violation. The danger is amplified by the skill's trading context because it is explicitly connected to a shared wallet and remote servers, so hidden key-handling behavior could lead to theft or identity compromise.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding
If the skill behavior truly includes reading wallet seed material, exposing private keys, or using undeclared oracle/API keys beyond the marketplace description, that is a serious trust-boundary violation. The danger is amplified by the skill's trading context because it is explicitly connected to a shared wallet and remote servers, so hidden key-handling behavior could lead to theft or identity compromise.

Ae1

High
Category
analysis-evasion
Content
npx tsx scripts/register.ts --name "YourAgentName" --nostr <your-nostr-pubkey>
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
npx tsx scripts/intent.ts post --type sell --desc "Offering web scraping service, any site" --category services --price 5
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
npx tsx scripts/intent.ts post --type sell --desc "Offering web scraping service, any site" --category services --price 5
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
npx tsx scripts/intent.ts post --type sell --desc "Offering web scraping service, any site" --category services --price 5
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
npx tsx scripts/intent.ts post --type sell --desc "Offering web scraping service, any site" --category services --price 5
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
This code intentionally reaches into Sphere's internal `_identity` field to recover and expose the raw private key, bypassing the public API's protection that strips it. For a marketplace/trading skill, direct exfiltration-capable access to the signing key is unnecessary and highly dangerous because any downstream caller can steal the wallet identity, sign arbitrary transactions, and irreversibly drain assets.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
}
```

### DELETE /api/intents/:id (authenticated)

Close an intent. Agent must own the intent.
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill declares no explicit tool scope even though its documented behavior requires network access and reads configuration and wallet-related paths from the environment/filesystem. In an agent setting, missing permission boundaries increases the risk of unintended capability use, especially because the skill interacts with remote services and a shared wallet context.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding
Using `npx tsx` without pinning an exact package version creates a supply-chain risk because the executed package may change over time or resolve to a compromised release. In this skill, those commands are part of setup/registration flows tied to wallet identity, so a malicious dependency could exfiltrate credentials or alter transaction behavior.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding
Using `npx tsx` without pinning an exact package version creates a supply-chain risk because the executed package may change over time or resolve to a compromised release. In this skill, those commands are part of setup/registration flows tied to wallet identity, so a malicious dependency could exfiltrate credentials or alter transaction behavior.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding
Using `npx tsx` without pinning an exact package version creates a supply-chain risk because the executed package may change over time or resolve to a compromised release. In this skill, those commands are part of marketplace search flows but still execute external code in the user's environment. Because the broader skill is connected to wallet-backed identity and network operations, compromise could pivot into sensitive actions.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding
Using `npx tsx` without pinning an exact package version creates a supply-chain risk because the executed package may change over time or resolve to a compromised release. In this skill, those commands are part of marketplace search flows but still execute external code in the user's environment. Because the broader skill is connected to wallet-backed identity and network operations, compromise could pivot into sensitive actions.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding
Using `npx tsx` without pinning an exact package version creates a supply-chain risk because the executed package may change over time or resolve to a compromised release. In this skill, those commands are part of marketplace search flows but still execute external code in the user's environment. Because the broader skill is connected to wallet-backed identity and network operations, compromise could pivot into sensitive actions.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding
Using `npx tsx` without pinning an exact package version creates a supply-chain risk because the executed package may change over time or resolve to a compromised release. Here the command is used for posting marketplace intents, which can influence outbound network behavior and potentially wallet-linked actions. An attacker controlling the resolved package could run arbitrary code under the agent's privileges.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding
Using `npx tsx` without pinning an exact package version creates a supply-chain risk because the executed package may change over time or resolve to a compromised release. Here the command is used for listing/closing intents and still executes external code in an environment connected to identity, tokens, and network APIs. That makes the blast radius larger than a simple local utility.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding
Using `npx tsx` without pinning an exact package version creates a supply-chain risk because the executed package may change over time or resolve to a compromised release. Even for category retrieval, the command executes unpinned remote code in the same environment that references wallet directories and remote marketplace infrastructure.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
This code silently loads the wallet mnemonic from local storage with no user-facing disclosure, consent flow, or indication that highly sensitive wallet material is being accessed. In the context of an agent skill, hidden access to wallet secrets is risky because users may believe they are only performing marketplace discovery or negotiation, not authorizing secret handling tied to their funds.

Missing User Warnings

Medium
Confidence
82% confidence
Finding
The skill initializes external network/oracle providers using wallet-related configuration and an API key without any visible disclosure that wallet operations may contact third-party services. In a P2P marketplace skill, undisclosed transmission to external infrastructure increases privacy and supply-chain risk, especially when combined with local wallet loading and debug transport settings.

Context-Inappropriate Capability

Medium
Confidence
91% confidence
Finding
The code hardcodes a fallback oracle API key in source, which creates a secret-management issue and may route production requests through an embedded credential not controlled by the user. While not as severe as private key extraction, embedding credentials in code enables unintended service use, credential leakage, abuse by third parties, and makes external dependencies less transparent to operators.

Static analysis

No suspicious patterns detected.