Back to skill

Security audit

Selva

Security checks for vulnerabilities and agentic risk

Overview

Selva is a coherent shopping skill, but it needs Review because it can place real orders and handles payment/API credentials in risky ways.

Review carefully before installing. Prefer the hosted settings-page card flow and do not pass card number, expiry, or CVV on the command line. Use a pinned, vetted CLI version, protect or rotate the local Selva API key, and require explicit human approval of the exact item, seller, total price, shipping details, and payment method before any purchase.

Vulnerability Patterns
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
src/cli.ts:184
Finding
Payment card credentials exposed through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `src/cli.ts:184-216` **Vulnerability Type**: Sensitive payment data exposure through process arguments **Risk Level**: High ### Vulnerable Code ```ts program .command("buy") .description("Buy a product") .argument("<selva_id>", "Selva product id") .requiredOption("--method <method>", "Payment method: card|saved") .option("--number <card_number>", "Card number for --method card") .option("--exp <exp>", "Card expiry MM/YY for --method card") .option("--cvv <cvv>", "Card CVV for --method card") .action( async ( selvaId: string, options: { method: string; number?: string; exp?: string; cvv?: string } ) => { const method = options.method === "saved" ? "saved" : options.method === "card" ? "card" : null; if (!method) { throw new Error("--method must be either 'card' or 'saved'."); } let paymentToken: string | undefined; if (method === "card") { if (!options.number || !options.exp || !options.cvv) { throw new Error("For --method card, provide --number, --exp, and --cvv."); } const stripeConfig = await stripePublishableKey(); const publishableKey = stripeConfig.stripe_publishable_key; if (!publishableKey) { throw new Error("Card tokenization requires STRIPE_PUBLISHABLE_KEY on the API."); } const tokenized = await tokenizeCard({ publishableKey, number: options.number, exp: options.exp, cvv: options.cvv }); ``` The same unsafe invocation pattern is explicitly documented at `SKILL.md:68`: ```text --method card --number <num> --exp <MM/YY> --cvv <code> ``` ### Technical Analysis The CLI accepts the full primary account number, expiration date, and CVV as command-line options. Although `src/stripe.ts` correctly sends these values directly to Stripe over HTTPS rather than to the Selva API, tokenization does not protect ...[truncated 1418 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove `--number`, `--exp`, and `--cvv` command-line options. 2. Prefer the existing Stripe-hosted settings-page flow so payment credentials are collected in a processor-controlled interface. 3. If terminal-based collection is unavoidable, use an interactive prompt that: - Disables terminal echo. - Reads payment fields from standard input rather than process arguments. - Prevents values from entering shell history. - Avoids logs, telemetry, crash reports, and error messages containing the input. 4. Keep card data only for the minimum time needed to tokenize it, then remove references promptly. 5. Never persist or return the raw Stripe response unless required; return only the token and minimal non-sensitive metadata. 6. Add tests confirming that payment credentials cannot be supplied through command-line arguments or printed in output. 7. Update `README.md` and `SKILL.md` to direct users exclusively to a secure hosted or interactive card-entry workflow. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
src/config.ts:25
Finding
Local API key file is created without explicitly restrictive permissions<![CDATA[ ## Vulnerability Details **File Location**: `src/config.ts:25-30` **Vulnerability Type**: Insecure local credential storage permissions **Risk Level**: Medium ### Vulnerable Code ```ts export async function writeConfig(next: SelvaCliConfig) { const filePath = configPath(); const dir = path.dirname(filePath); await mkdir(dir, { recursive: true }); await writeFile(filePath, JSON.stringify(next, null, 2), "utf8"); } ``` ### Technical Analysis Registration stores the Selva API key in plaintext at `~/selva/config.json`. The directory and file are created without explicit `mode` settings, so their effective permissions depend on the current umask and any pre-existing permissions. On a system with a permissive umask or an existing broadly accessible `~/selva` directory, another local account may be able to read the API key. The write operation also does not verify whether the destination is a regular file owned by the current user, leaving room for unsafe behavior around pre-existing filesystem objects. The API key authenticates requests that retrieve personal settings and orders, generate a settings-page link, modify account information, and initiate purchases. It therefore requires stronger protection than an ordinary configuration value. ### Attack Path 1. The user runs the registration command. 2. `writeConfig` writes the API key without enforcing file mode `0600` or directory mode `0700`. 3. A permissive umask or pre-existing directory permissions make the file readable by another local user. 4. The local attacker reads and copies the API key. 5. The attacker uses the key in the `x-api-key` header against the Selva API. 6. The attacker accesses or changes account data and may attempt purchase-related operations available to the compromised account. ### Impact Assessment A stolen API key may expose the victim's name, phone number, email address, shipping address, card issuer and last four digits, order history, and generated settings lin ...[truncated 241 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Create the configuration directory with mode `0700`. 2. Create and rewrite `config.json` with mode `0600`. 3. Explicitly correct permissions on existing configuration files before reading or writing sensitive values. 4. Use filesystem operations that reject symbolic links and verify that the destination is a regular file owned by the current user. 5. Prefer an operating-system credential manager or keychain instead of a plaintext JSON file. 6. Support API-key revocation and rotation, and instruct users to rotate keys if local disclosure is suspected. 7. Add automated tests that verify restrictive permissions on supported operating systems. 8. Avoid silently treating every read or parse error as an empty configuration; distinguish missing files from permission, ownership, and malformed-content errors. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:41
Finding
Unversioned npx commands can execute code different from the audited package<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:41-46` **Vulnerability Type**: Unpinned executable dependency and supply-chain drift **Risk Level**: Medium ### Vulnerable Code ```text 1. `npx selva-cli register` — generates an API key, stored locally at ~/selva/config.json 2. `npx selva-cli settings set-name --name "Jane Doe"` — required before buying 3. `npx selva-cli settings set-address --street "123 Main St" --line2 "Apt 4B" --city "Austin" --state "TX" --zip "78701" --country "US"` — required before buying (`--line2` optional) 4. Optionally set phone: `npx selva-cli settings set-phone --phone "+14155551234"` 5. Optionally set email for purchase receipts and approval notifications: `npx selva-cli settings set-email --email "you@example.com"` 6. Link a payment card and optionally set an approval threshold at the web settings page: `npx selva-cli settings page` ``` Unversioned `npx selva-cli` invocations are repeated throughout `SKILL.md` and `README.md`. ### Technical Analysis The audited package declares version `0.1.1`, but the instructions repeatedly invoke `npx selva-cli` without a version or integrity constraint. When the package is not already available locally, `npx` may resolve and execute the registry's current release instead of the reviewed source. No presently malicious dependency was identified in the supplied artifact. The vulnerability is that future registry releases, a compromised publisher account, or an unintended version may change the effective executable after the Skill has been reviewed. This is particularly consequential because the program handles API keys, personal addresses, payment tokens, card-entry commands, and purchase authority. ### Attack Path 1. The user or agent follows the Skill instructions and runs an unversioned `npx selva-cli` command. 2. No trusted local copy is available, so `npx` resolves the package from the npm registry. 3. A later compromised, malicious, or behaviorally incompatible releas ...[truncated 775 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin every documented invocation to the reviewed release, for example: ```bash npx --yes selva-cli@0.1.1 register ``` 2. Prefer installing an integrity-verified version once and invoking the trusted local binary thereafter. 3. Publish package provenance and provide verifiable release checksums or signatures. 4. Use exact dependency versions and maintain a committed lockfile for reproducible builds. 5. Require code review and protected multi-factor authentication for package publication. 6. Document a release-verification procedure and an incident-response process for package compromise. 7. Update both `SKILL.md` and `README.md` so no command implicitly downloads and executes an unaudited future version. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (64)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The description does not mention CLI execution or development endpoint configuration, which is a transparency problem, but the specific reference to local API endpoint configuration is not evidenced clearly in the provided SKILL.md text. This appears more like an overbroad analyzer inference than a concrete dangerous behavior shown here.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding
The description does not mention CLI execution or development endpoint configuration, which is a transparency problem, but the specific reference to local API endpoint configuration is not evidenced clearly in the provided SKILL.md text. This appears more like an overbroad analyzer inference than a concrete dangerous behavior shown here.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The description does not mention CLI execution or development endpoint configuration, which is a transparency problem, but the specific reference to local API endpoint configuration is not evidenced clearly in the provided SKILL.md text. This appears more like an overbroad analyzer inference than a concrete dangerous behavior shown here.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The description does not mention CLI execution or development endpoint configuration, which is a transparency problem, but the specific reference to local API endpoint configuration is not evidenced clearly in the provided SKILL.md text. This appears more like an overbroad analyzer inference than a concrete dangerous behavior shown here.

Missing User Warnings

High
Confidence
97% confidence
Finding
The buy function transmits purchase instructions and optional payment-related data directly to a remote endpoint, but this code contains no built-in confirmation, amount verification, or explicit user-consent gating before initiating a transaction. In an agent skill context, this increases the risk of unintended or prompt-influenced purchases, especially because the skill is designed to enable autonomous shopping on behalf of a user.

Missing User Warnings

High
Confidence
98% confidence
Finding
The CLI collects primary account number, expiry, and CVV via command-line options (`--number`, `--exp`, `--cvv`). Command-line arguments are commonly exposed through shell history, process listings, telemetry, audit logs, and CI/job logs, so sensitive payment data can be disclosed to other local users or retained in logs even if the code tokenizes the card before sending it onward.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding
The README instructs users to run `npx selva-cli` without pinning an exact package version, which causes code to be fetched and executed from the registry at runtime. If the package is updated maliciously, the maintainer account is compromised, or a dependency-chain attack occurs, users and agents following the instructions may execute unreviewed code with their local privileges.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding
This command uses `npx selva-cli` without a pinned version, so execution depends on whatever package version is current at install/run time. In an agent-shopping context, that is especially risky because the CLI handles identity, address, and payment-related workflows, amplifying the effect of any supply-chain compromise.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding
The README directs users to execute an unpinned `npx` package, which is a real supply-chain risk because package contents can change over time. Since this command sets physical address data used for purchases, a compromised package could exfiltrate personal information or alter downstream buying behavior.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding
Using `npx selva-cli` without a fixed version allows remote code execution from the latest published package at the time of invocation. Because the tool manages phone/contact details tied to purchases, compromise could expose sensitive personal data or enable fraudulent order workflows.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding
This unpinned `npx selva-cli` command is particularly dangerous because it precedes linking cards and purchase approvals, meaning a compromised package could phish for credentials, redirect users to malicious settings pages, or tamper with payment setup. The lack of version pinning turns routine onboarding into a supply-chain execution point.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding
The search command is still an unpinned runtime fetch and execute of `selva-cli`, making it vulnerable to malicious package updates or namespace abuse. Even seemingly low-risk actions like search can serve as the initial foothold for credential theft, environment exfiltration, or later purchase manipulation.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding
This details command executes an unpinned package from the registry, exposing users to the same supply-chain risk as the other examples. In a shopping agent context, a compromised CLI could falsify product details, manipulate purchase decisions, or harvest user/session data.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
The buy command combines unpinned package execution with the ability to place real orders, making this a high-consequence supply-chain vulnerability. If the package or publishing account is compromised, an attacker could alter order targets, skim card data provided on the command line, or trigger unauthorized purchases.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The README describes a real purchasing flow and explicitly accepts raw payment-card details via CLI flags, but it does not clearly warn that commands may trigger actual charges or that highly sensitive card data is being transmitted and potentially exposed. Passing PAN/CVV on the command line is especially dangerous because shell history, process listings, logs, telemetry, or agent transcripts may capture the values, creating serious payment-data leakage risk.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding
This line documents `--method card --number --exp --cvv` on an unpinned `npx` command, creating a severe compound risk: dynamic remote code execution plus direct handling of highly sensitive payment data. A compromised package could intercept and exfiltrate cardholder data immediately at runtime.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding
The orders command is another unpinned execution path that could be abused if the package supply chain is compromised. Because order status data can reveal purchasing behavior and may be used to drive approvals or fulfillment actions, tampering or exfiltration has meaningful security and privacy impact.

Rp1

Medium
Category
MCP Rug Pull
Confidence
92% confidence
Finding
The generic settings command is presented without an exact version, so users may execute whatever code is currently published as `selva-cli`. Since settings aggregate identity and account data, a compromised package could silently alter or steal sensitive profile information.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding
The settings page command is unpinned and likely opens or directs users to a web flow related to payment configuration, which increases the attack surface if the package is compromised. An attacker could redirect to a spoofed site, harvest credentials, or manipulate approval/payment settings for fraud.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding
This address-setting example uses an unpinned `npx` package, exposing physical address and profile data to any malicious package revision fetched at runtime. In a shopping workflow, address tampering could also redirect goods or facilitate fraud.

Rp1

Medium
Category
MCP Rug Pull
Confidence
92% confidence
Finding
The name-setting command is another unpinned execution path and therefore a true supply-chain vulnerability. While the individual field seems low sensitivity, in context it contributes to identity data used in purchase fulfillment and account operations.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding
This email-setting example runs an unpinned package that can access and modify contact details used for receipts and approval notifications. A compromised CLI could swap in attacker-controlled contact channels, enabling approval hijacking or concealment of fraudulent orders.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding
The phone-setting command is unpinned, making it vulnerable to supply-chain compromise at execution time. In this context, phone data may support account recovery, notifications, or approvals, so unauthorized modification or exfiltration can materially aid fraud.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill declares network-capable behavior through repeated CLI calls but does not define any explicit tool scope such as permissions or allowed-tools. This weakens containment and reviewability because an agent may invoke networked actions without a clear least-privilege boundary, which is especially sensitive in a commerce workflow.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill instructs the agent to register quietly and states that an API key will be generated and stored locally, but it does not require an upfront user-visible disclosure of that side effect. Silent credential creation and persistence can violate user expectations and create security exposure if the local environment is shared or insufficiently protected.

Static analysis

No suspicious patterns detected.