Back to skill

Security audit

Meta AI Ads

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its Meta ads purpose, but it can send Plai credentials and ad-account data to an environment-controlled API endpoint, so it should be reviewed before installation.

Install only if you trust Plai with the connected ad accounts and are comfortable with commands that can create, activate, delete, and change budgets for campaigns. Keep `PLAI_BASE_URL` unset or pinned to the legitimate Plai endpoint, avoid running it through wrappers or CI jobs that can alter environment variables, and use a scoped, rotatable API key where possible.

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
scripts/plai-meta.js:11
Finding

Environment-Controlled API Endpoint Enables Credential and Advertising Data Exfiltration

Content
View full analysis

Vulnerability Details

File Location: scripts/plai-meta.js, lines 11–35
Vulnerability Type: Unvalidated destination for sensitive network requests
Risk Level: High

Vulnerable Code

js
const BASE_URL = process.env.PLAI_BASE_URL || "https://public.plai.io";
const API_KEY = process.env.PLAI_API_KEY;
const USER_ID = process.env.PLAI_USER_ID;

async function plai(endpoint, body = {}) {
  const url = `${BASE_URL}${endpoint}`;
  const res = await fetch(url, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": API_KEY,
      "x-request-source": "clawhub-meta-ads-skill",
    },
    body: JSON.stringify({ ...body, userId: USER_ID }),
  });

Technical Analysis

The API destination is taken from the environment variable PLAI_BASE_URL without validating its scheme, hostname, port, or trust level. Every API operation then sends the Plai API key in the x-api-key header and the Plai user ID in the request body to that destination.

Depending on the invoked command, the request body may also contain campaign details, audience identifiers, pixel IDs, lead-form metadata, media identifiers, product catalog information, URLs, targeting criteria, and OAuth connection parameters.

The network communication itself is necessary for the Skill's declared advertising-management functionality when the destination is the default Plai endpoint. However, allowing an unrestricted environment variable to redirect credential-bearing requests exceeds the minimum privilege needed for that functionality. The override can also specify a plaintext HTTP endpoint, exposing credentials and request data to network interception.

Exploitation requires an attacker, compromised launcher, malicious wrapper, or unsafe runtime configuration to influence the process environment before the CLI is invoked.

Attack Path

  1. The attacker gains the ability to influence the environ ...[truncated 1527 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the runtime override and pin production requests to the expected endpoint:

    js
    const BASE_URL = "https://public.plai.io";
    
  2. If custom endpoints are required for development or testing, parse the value with URL and enforce:

    • The https: scheme.
    • An explicit hostname allowlist.
    • Approved ports only.
    • No embedded username or password.
    • No fragments or unexpected path prefixes.
  3. Use a clearly development-specific opt-in, such as PLAI_ALLOW_CUSTOM_BASE_URL=true, and reject custom destinations in normal production execution.

  4. Keep development and production credentials separate. Test endpoints must never receive production API keys or user identifiers.

  5. Fail closed when URL validation fails rather than falling back to or attempting an untrusted destination.

  6. Document the endpoint trust boundary and warn operators that environment configuration controls where sensitive account data is transmitted.

  7. Consider server-side credential scoping and rotation so that exposed keys have only the minimum permissions and can be revoked promptly.

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

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/plai-meta.js <command> [options]

Static analysis

Detected: suspicious.env_credential_access

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/plai-meta.js:12