Back to skill

Security audit

Apify Scraper

Security checks for vulnerabilities and agentic risk

Overview

The skill's scraping purpose is clear, but it tells agents to run an unaudited local script outside the package while using an Apify API key.

Install only if you trust the local apify-run.py script and the Apify account configuration. Prefer a version that bundles the runner, uses a relative package path, documents only APIFY_API_KEY, and uses a limited Apify key with spending controls.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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)

T07 · Tool Hijacking and Spoofing

Warning
Location
SKILL.md:31
Finding

Unaudited External Script Execution and Disclosure of Credential Metadata

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 31–39
Vulnerability Type: Execution of an unbundled external tool with access to a sensitive API credential
Risk Level: Medium

Vulnerable Code Snippet:

markdown
## Setup

- **API Key:** `op://OpenClaw/Apify API Credentials/credential` (also in gateway plist as `APIFY_API_KEY`)
- **Dashboard:** https://console.apify.com (account: redditech)
- **Plan:** FREE ($5/mo credit)
- **Script:** `python3 scripts/apify-run.py <actor> <input_json>`

## Running an Actor

```bash

The command immediately following this range invokes the script through the absolute path /Users/loki/.openclaw/workspace/scripts/apify-run.py.

Technical Analysis

The Skill does not contain the referenced apify-run.py implementation. Instead, it directs the Agent to execute a mutable script outside the audited project. Consequently, the code that receives actor names, scraping inputs, target URLs, and potentially the APIFY_API_KEY cannot be reviewed or integrity-checked as part of this Skill.

This creates a tool-hijacking boundary: a legitimate-looking Skill invocation can execute attacker-controlled logic if the external script is replaced or modified. The documentation also discloses the precise 1Password item path, environment-variable name, gateway plist location, local username/path, and Apify account identifier. These details are not API-key values themselves, but they reduce the effort needed to locate and target the credential.

The intended connection to api.apify.com is necessary for the declared cloud-scraping functionality. The security concern is not the declared Apify transmission itself, but the absence of an auditable implementation and enforceable destination restriction for the executable handling that transmission.

Attack Path

  1. An attacker obtains write access to /Users/loki/.openclaw/workspace/scripts/apify-run.py, replaces ...[truncated 1892 chars]
Remediation
View remediation

Remediation Suggestions

  1. Bundle apify-run.py inside the Skill package so the executable implementation is included in security review and version control.
  2. Invoke the bundled script through a repository-relative, canonicalized path rather than a user-specific absolute path.
  3. Protect the script from unauthorized modification using restrictive file permissions and package integrity or signature verification.
  4. Remove the 1Password item path, gateway plist reference, local username, absolute filesystem path, and account identifier from distributable documentation. Retain only the declared APIFY_API_KEY environment-variable requirement.
  5. Pass the API key only through the process environment or a narrowly scoped secret provider. Never include it in command-line arguments, logs, error messages, datasets, or actor inputs.
  6. Create a dedicated Apify key with the minimum permissions necessary to run approved actors. Configure spending limits, key rotation, revocation procedures, and usage monitoring.
  7. Restrict outbound connections from the runner to the required Apify API hostname over HTTPS. Reject redirects or unexpected destinations where feasible.
  8. Validate actor identifiers against an explicit allowlist and parse input as JSON without shell interpolation. Apply limits to item counts, timeouts, and submitted data sizes.
  9. Warn users not to submit credentials, private URLs, session tokens, or sensitive personal data to cloud actors, because actor inputs and results are processed on Apify infrastructure.
  10. Pin or explicitly approve actor identifiers and document that third-party actor implementations remain outside the audited package and may change independently.
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • 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
Findings (1)

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

md
## Setup

- **API Key:** `op://OpenClaw/Apify API Credentials/credential` (also in gateway plist as `APIFY_API_KEY`)
- **Dashboard:** https://console.apify.com (account: redditech)
- **Plan:** FREE ($5/mo credit)
- **Script:** `python3 scripts/apify-run.py <actor> <input_json>`

Static analysis

No suspicious patterns detected.