Back to skill

Security audit

Find Marketing Agency

Security checks for vulnerabilities and agentic risk

Overview

The skill’s agency-search purpose is coherent, but its REST fallback tells the agent to source a local .env.local file, which can execute workspace-controlled shell code.

Review before installing. Prefer the MCP/OAuth path described by the skill. If using REST, do not let the agent source .env.local from a project workspace; export SERVICEGRAPH_API_KEY through a trusted environment or secret manager, and approve paid unlock calls only after confirming the listed firms and credit cost.

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

Error
Location
SKILL.md:80
Finding

Arbitrary Command Execution Through Unsafe .env.local Sourcing

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 80–86
Vulnerability Type: Unsafe execution of a local environment file
Risk Level: High

Vulnerable Code

bash
1. **Just try the call** through a shell wrapper that sources
   `.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' )
   ```

Technical Analysis

The Skill instructs the agent to load .env.local using the POSIX shell . command. This does not treat the file as passive configuration; it evaluates its entire contents as shell code.

Because .env.local is located relative to the current working directory, any party able to create or modify that file can insert shell commands. Those commands execute before the ServiceGraph request and with the same operating-system identity and permissions as the agent's shell. The subshell limits environment changes after completion but does not restrict filesystem access, network access, process creation, or command execution inside it.

The ServiceGraph operation only needs access to one environment variable. Executing an entire local file therefore exceeds the minimum privilege necessary for authentication.

Attack Path

  1. An attacker gains influence over the project workspace or supplies a project containing a crafted .env.local.
  2. The file contains an apparently valid assignment and an additional command, for example:
    bash
    SERVICEGRAPH_API_KEY=vk_example
    malicious_command
    
  3. A user invokes the Skill without independently inspecting .env.local.
  4. The agent follows the documented authentication procedure:
    bash
    . ./.env.local
    
  5. The shell evaluates every statement in the file, including malicious_command.
  6. The injected command runs with the agent process's ...[truncated 921 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove all instructions that source .env.local or any other repository-controlled configuration file.
  2. Prefer the documented ServiceGraph MCP/OAuth integration so credentials remain in the harness credential sandbox and do not enter model or shell context.
  3. For REST usage, require SERVICEGRAPH_API_KEY to be exported by a trusted user or injected through the execution environment:
    bash
    test -n "${SERVICEGRAPH_API_KEY:-}" || {
      printf '%s\n' 'SERVICEGRAPH_API_KEY is not configured' >&2
      exit 1
    }
    
    curl --fail-with-body --silent --show-error \
      -H "Authorization: Bearer ${SERVICEGRAPH_API_KEY}" \
      'https://api.servicegraph.co/v1/datasets/pro_services/fields'
    
  4. If file-based configuration is unavoidable, use a non-evaluating parser that accepts only an exact SERVICEGRAPH_API_KEY record and validates the expected token format. Do not use source, ., eval, command substitution, or interpolation of arbitrary file contents.
  5. Store credential files outside attacker-controlled repositories, restrict their filesystem permissions, and reject symbolic links or files with unexpected ownership.
  6. Run network clients in a least-privileged sandbox with narrowly scoped filesystem access and an outbound allowlist limited to api.servicegraph.co.
  7. Continue instructing users not to paste API keys into chat, and ensure logs do not record authorization headers.
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
81% confidence
Finding

The skill instructs the agent to source .env.local in a shell wrapper before making requests. Even though the text says to keep the token out of LLM context, reading a local env file from an agent-controlled shell can expose secrets to a broader execution context than necessary, and creates a path for accidental leakage through command output, debugging, process inspection, or reuse by other shell steps.

Content

Scanner excerpt · SKILL.md (reported line 84)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 86)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 unauthorized, prompt the user (don't accept the key in chat):