Back to skill

Security audit

keyco

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent for managing Keyco, but it exposes sensitive account actions and a setup script that can install an unpinned npm package with sudo.

Review before installing. Use this only for a Keyco account where you are comfortable letting an agent run CLI commands that can change business records, groups, notifications, and API keys. Prefer installing the Keyco CLI yourself through a trusted, non-sudo method, avoid running the setup script's sudo fallback, and require explicit confirmation before any create, delete, revoke, clear, or assignment-changing command.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (1)

T08 · Insecure Dependencies

Warning
Location
scripts/setup-keyco.sh:34
Finding

Unpinned Global npm Package Installation with Root-Level Fallback

Content
View full analysis

Vulnerability Details

File Location: scripts/setup-keyco.sh, lines 34–45
Vulnerability Type: Unpinned third-party dependency installation with privilege escalation
Risk Level: Medium

Vulnerable Code

bash
if command -v keyco >/dev/null 2>&1; then
  CURRENT_VERSION="$(keyco --version 2>/dev/null || echo unknown)"
  info "Keyco CLI already installed (${CURRENT_VERSION})"
else
  info "Installing @keyco/cli globally via npm..."
  if ! npm install -g @keyco/cli; then
    warn "Global install failed. Retrying with sudo (you may be prompted for your password)..."
    sudo npm install -g @keyco/cli
  fi
  info "Installed: $(keyco --version 2>/dev/null || echo @keyco/cli)"
fi

The automatic execution of this setup path is also documented in SKILL.md, lines 27–37:

markdown
1. Check if `keyco` is on PATH: `which keyco`
2. Check configuration: `keyco status`
3. **If either check fails, run the setup script** — it handles install + configure in one shot:
   ```bash
   bash scripts/setup-keyco.sh

The script will:

  • Install @keyco/cli globally via npm if missing (falling back to sudo npm if needed)
text

### Technical Analysis

The setup script installs `@keyco/cli` without specifying an exact version, lockfile, expected integrity digest, package provenance requirement, or explicit trusted registry. Consequently, npm resolves whichever version and source are selected by the active npm configuration at execution time.

npm installations may execute package lifecycle scripts. If the ordinary global installation fails, the script retries the installation through `sudo`, potentially executing package-controlled code with root privileges. A compromised package release, registry account, transitive dependency, or redirected npm registry could therefore turn the setup operation into arbitrary privileged code execution.

The issue is classified primarily as an insecure dependency because the initial trust failure arises from dynamica
...[truncated 1480 chars]
Remediation
View remediation

Remediation Suggestions

  1. Pin @keyco/cli to a reviewed exact version rather than installing the latest registry-selected release:

    bash
    npm install -g --ignore-scripts @keyco/cli@X.Y.Z
    
  2. Verify the package against an expected integrity digest or trusted signed provenance before installation. Establish a controlled update process for changing the approved version and digest.

  3. Enforce the intended npm registry instead of inheriting an arbitrary user or environment configuration. Validate the effective registry before downloading any package.

  4. Remove the automatic sudo npm install -g fallback. Prefer one of the following:

    • A project-local, pinned dependency.
    • A user-scoped npm prefix.
    • A vetted standalone binary installed into a user-owned directory.
    • A managed system package installed by an administrator through an approved deployment process.
  5. Avoid package lifecycle scripts where the CLI does not require them by using --ignore-scripts. If lifecycle scripts are required, review them and their transitive dependencies before approving installation.

  6. Require explicit informed user confirmation before downloading or installing external software. Clearly display the exact version, registry, destination, and requested privilege level.

  7. After installation, verify that the resolved executable belongs to the expected package and matches the approved version and checksum before invoking it.

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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (12)

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

API key creation and revocation are high-impact credential-management operations that are not justified by the stated user-facing purpose of managing assets and workflows. If an agent can access these commands, it could mint persistent access for itself or revoke legitimate credentials, leading to account compromise, denial of service, or lateral access expansion.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill supports state-changing operations such as creating lifecycle events, managing users, notifications, groups, and API keys, but it does not require an explicit confirmation step before performing those actions. In an agent setting, this can lead to unintended remote changes from ambiguous or mistaken user requests, especially because the skill encourages direct command execution flows.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
95% confidence
Finding

The skill instructs use of a local setup script that may fall back to sudo npm for global package installation, which combines elevated privileges with package-manager execution. This is dangerous because it expands the blast radius of a compromised script, dependency, or package and can result in full host compromise or unauthorized system modification.

Content

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

bash scripts/setup-keyco.sh

text
The script will:
- Install `@keyco/cli` globally via npm if missing (falling back to `sudo npm` if needed)
- Skip install if already present
- Walk the user through `keyco configure` if no valid API key is set
- Verify connectivity at the end

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% 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 39)May include surrounding context.

md
- Walk the user through `keyco configure` if no valid API key is set
   - Verify connectivity at the end

   Always offer to run this script before failing — don't ask the user to manually install or configure.

## Core Workflow

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The reference documents auth login with email/password and auth logout, which are authentication-session management capabilities rather than asset-management operations. While some authentication support may be an implementation detail, exposing direct credential-handling commands in the skill reference goes beyond what the manifest says about the skill's purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

This markdown file documents commands such as keyco auth logout that clear credentials and nearby API key management commands including revocation, but provides no warning about their impact on access or irreversibility. For markdown files, user-facing descriptions should disclose behaviors that can affect user data, credentials, or system integrity.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The command reference exposes administrative capabilities such as group management, notifications state changes, and API key administration that go beyond the skill's stated asset-management and reporting purpose. In an agent setting, broader documented capabilities can enable privilege expansion or unintended high-impact actions if the agent is allowed to invoke commands based on this reference.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

Documenting a destructive group deletion command without any warning increases the chance that an agent or user invokes it without understanding the operational impact. In an autonomous or semi-autonomous tool context, missing cautions around destructive actions materially raises the risk of accidental data or configuration loss.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

API key creation and revocation are sensitive credential-management operations, and documenting them without security warnings normalizes high-risk actions in an agent-consumable reference. This is especially dangerous because API keys can provide persistent access and revocation can disrupt production integrations or lock out legitimate automation.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
89% confidence
Finding

The script escalates to root with sudo npm install -g @keyco/cli if the unprivileged global install fails. Installing an npm package as root executes package lifecycle scripts with full privileges, so a compromised package, dependency, registry response, or network path could lead to full system compromise. In a setup helper for an external vendor CLI, this increases risk because it encourages privileged installation of third-party code during routine onboarding.

Content

Scanner excerpt · scripts/setup-keyco.sh (reported line 40)May include surrounding context.

sh
else
  info "Installing @keyco/cli globally via npm..."
  if ! npm install -g @keyco/cli; then
    warn "Global install failed. Retrying with sudo (you may be prompted for your password)..."
    sudo npm install -g @keyco/cli
  fi
  info "Installed: $(keyco --version 2>/dev/null || echo @keyco/cli)"

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
89% confidence
Finding

This line performs sudo npm install -g @keyco/cli, which combines privilege escalation with execution of untrusted package install hooks. Because npm packages can run arbitrary scripts during installation, doing this under sudo can grant an attacker root-level code execution if the package or supply chain is compromised. The setup context makes this especially risky because users may follow prompts without scrutinizing the security implications of granting admin rights.

Content

Scanner excerpt · scripts/setup-keyco.sh (reported line 41)May include surrounding context.

sh
info "Installing @keyco/cli globally via npm..."
  if ! npm install -g @keyco/cli; then
    warn "Global install failed. Retrying with sudo (you may be prompted for your password)..."
    sudo npm install -g @keyco/cli
  fi
  info "Installed: $(keyco --version 2>/dev/null || echo @keyco/cli)"
fi

Vague Triggers

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The manifest says to use the skill when the user asks about "asset management," "workflow automation," or related topics, which are common cross-domain phrases and not limited to Keyco-only requests. Although Keyco-specific terms are also present, the trigger scope is broad enough to risk unintended invocation when users discuss generic inventory or workflow tasks.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.