Back to skill

Security audit

scraping-youtube-videos-by-keyword

Security checks for vulnerabilities and agentic risk

Overview

The skill’s YouTube scraping purpose is coherent, but its REST examples expose the Apify credential in URLs and lack credential-safety guidance.

Review before installing. Prefer the MCP or helper-script path if it keeps credentials out of URLs, and avoid using the REST examples as written with a real token. Store APIFY_TOKEN in a protected environment variable or secret manager, redact it from logs and screenshots, and rotate it if it has appeared in command history or shared output.

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:92
Finding

Apify API Token Exposed in URL Query Parameters

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 92–105
Vulnerability Type: Credential exposure through URL query parameters
Risk Level: Medium

Vulnerable Code

bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~youtube-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"searchKeywords": "<query>", "maxResults": 50}'
bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID?token=$APIFY_TOKEN" | grep '"status"'
bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN&format=json"

Technical Analysis

The documented REST fallback places APIFY_TOKEN directly in the request URL. While transmitting a token to Apify is necessary to use the authenticated service, query-string authentication exposes the credential more broadly than required.

URLs may be captured in shell history, process-command listings, terminal recordings, debugging output, HTTP client telemetry, proxies, and server-side access logs. TLS protects the request while it is in transit but does not prevent disclosure through these local and endpoint logging channels. Consequently, this pattern violates least-exposure principles for credentials.

The identified requests target the official api.apify.com domain, and the audit found no evidence that the token is deliberately sent to an unrelated party. The vulnerability is the insecure credential transport pattern rather than confirmed malicious exfiltration.

Attack Path

  1. A user follows the REST fallback instructions with a valid APIFY_TOKEN.
  2. The shell expands the token into the command-line URL.
  3. The authenticated URL is retained or observed through shell history, process inspection, terminal capture, diagnostic output, proxy telemetry, or access logs.
  4. An attacker with access to one of those sources extracts the token.
  5. The attacker reuses the token a ...[truncated 673 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace query-string authentication with Apify's supported authorization-header mechanism so the token is not embedded in the URL.
  2. Keep APIFY_TOKEN in a protected environment variable or secret manager and never print it or include it in generated output.
  3. Avoid verbose request tracing and redact authorization headers from application, proxy, and monitoring logs.
  4. Use narrowly scoped tokens where supported, restrict access to only the required actor and datasets, and rotate tokens regularly.
  5. Revoke and replace any token that may already have appeared in shell history, process captures, or logs.
  6. Add documentation warning users not to pass credentials in URLs and provide only a header-based REST example.
  7. If .env files are supported, require restrictive filesystem permissions and ensure they are excluded from version control.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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 (5)

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

The REST example transmits the APIFY_TOKEN in the URL query string, which is commonly exposed to shell history, process listings, proxy logs, browser/history tools, and server-side access logs. Even though the destination is the expected Apify API, placing secrets in URLs is an unsafe pattern that can leak the credential beyond the intended recipient.

Content

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

REST API fallback:

bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~youtube-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"searchKeywords": "<query>", "maxResults": 50}'

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 93)May include surrounding context.

REST API fallback:

bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~youtube-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"searchKeywords": "<query>", "maxResults": 50}'

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

This polling example again includes APIFY_TOKEN in the URL, repeating the same credential exposure problem across status-check requests. Reuse of this pattern increases the chance the token is captured in logs or shell history during normal operation.

Content

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

Save id as RUN_ID. Poll until status = SUCCEEDED:

bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID?token=$APIFY_TOKEN" | grep '"status"'

Fetch results:

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

The dataset retrieval example sends APIFY_TOKEN in the URL query string, which can leak through multiple operational channels even when using HTTPS. Because this step is likely to be run repeatedly while fetching results, it increases the practical exposure surface of the credential.

Content

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

Fetch results:

bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN&format=json"

Step 3: Handle Edge Cases

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill requires an APIFY_TOKEN and demonstrates passing it in commands, but it does not provide any guidance on protecting that credential from shell history, logs, screenshots, shared terminals, or accidental publication. While this is common documentation behavior, it still creates a real risk of credential mishandling because users may copy unsafe examples directly.

Content

No source excerpt is available for this finding.