Back to skill

Security audit

Skrape

Security checks for vulnerabilities and agentic risk

Overview

Skrape is a coherent web-scraping guidance skill, but its included robots.txt enforcement code can allow scraping when permission was not actually verified.

Install only if you treat this as general scraping guidance, not a ready-to-use compliance-safe scraper. Before using the sample code, replace the robots.txt checker with a maintained RFC-compliant parser, fail closed or require explicit user approval when verification is unknown, and review each site's terms and data-handling obligations yourself.

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

T09 · Insecure Skill Coding Practices

Warning
Location
code.md:17
Finding
robots.txt Verification Fails Open on Retrieval and Parsing Errors<![CDATA[ ## Vulnerability Details **File Location**: `code.md`, lines 17–34 **Vulnerability Type**: Fail-open authorization and policy verification **Risk Level**: Medium ### Vulnerable Code ```javascript protocol.get(robotsUrl, (res) => { let data = ''; res.on('data', chunk => data += chunk); res.on('end', () => { try { const allowed = evaluateRobotsRules(data, agentLabel, parsed.pathname); resolve(allowed); } catch (e) { resolve(true); // Missing robots.txt = permitted } }); }).on('error', () => resolve(true)); }; fetchRobots(parsed.protocol === 'https:' ? https : http) .then(resolve) .catch(() => resolve(true)); ``` ### Technical Analysis The robots.txt verification routine treats every network, protocol, and parsing failure as authorization to continue. Both the request error handler and the outer rejection handler resolve to `true`. An exception raised while evaluating the response also resolves to `true`. The response status code and content type are not validated. Therefore, an HTTP error page, malformed response, interrupted request, or other non-policy response may be evaluated as though it were a valid robots.txt file. This behavior conflicts with the Skill's stated requirement to retrieve and review robots.txt before extraction and to halt when restrictions exist. The vulnerability is a fail-open policy-control defect: failure to determine whether access is permitted is incorrectly treated as affirmative permission. ### Attack Path 1. The scraper is configured to extract content from a target URL. 2. The target server, an intermediary, or a transient network condition causes the robots.txt request to fail, return malformed content, or return an HTTP error response. 3. The request error, parser exception, or rejected promise reaches a `resolve(true)` branch. 4. `runScraper` receives `permitted = true`. 5. The scraper requests the target resource without having successfully established the site's rob ...[truncated 780 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Replace the Boolean result with an explicit state such as `allowed`, `denied`, or `unknown`. - Fail closed when transport, TLS, timeout, parsing, or server errors prevent policy verification. - Validate the HTTP status before parsing: - Parse successful robots.txt responses. - Handle a confirmed `404 Not Found` according to a documented policy. - Treat redirects, authentication responses, rate limits, and server errors explicitly. - Validate that the response is a plausible robots.txt representation rather than an HTML error page. - Add response-size limits and request timeouts to the robots.txt retrieval function. - Require explicit operator approval before continuing from an `unknown` state. - Log the status code, final URL, verification outcome, and reason without representing a failed check as successful. - Add tests covering DNS failures, TLS failures, malformed policy files, HTTP 403/404/429/500 responses, redirects, and parser exceptions. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
code.md:38
Finding
Incomplete robots.txt Rule Evaluation Can Produce Incorrect Access Decisions<![CDATA[ ## Vulnerability Details **File Location**: `code.md`, lines 38–75 **Vulnerability Type**: Incorrect authorization-policy parsing **Risk Level**: Medium ### Vulnerable Code ```javascript function evaluateRobotsRules(content, agentLabel, path) { const lines = content.split('\n'); let activeAgent = null; let blockedPaths = []; let allowedPaths = []; for (const line of lines) { const trimmed = line.trim(); if (!trimmed || trimmed.startsWith('#')) continue; const [key, value] = trimmed.split(':', 2).map(s => s.trim()); if (key?.toLowerCase() === 'user-agent') { if (activeAgent !== null && agentMatches(activeAgent, agentLabel)) { for (const p of blockedPaths) { if (path.startsWith(p)) return false; } } activeAgent = value; blockedPaths = []; allowedPaths = []; } else if (key?.toLowerCase() === 'disallow') { if (value) blockedPaths.push(value); } else if (key?.toLowerCase() === 'allow') { if (value) allowedPaths.push(value); } } // Evaluate final user-agent block if (activeAgent !== null && agentMatches(activeAgent, agentLabel)) { for (const p of blockedPaths) { if (path.startsWith(p)) return false; } } return true; } ``` ### Technical Analysis The parser collects `Allow` directives in `allowedPaths`, but it never uses them when determining access. Its decision is based only on whether the requested path begins with a collected `Disallow` value. The implementation also processes user-agent blocks independently instead of correctly selecting and combining applicable groups and resolving competing rules by specificity. It does not implement wildcard matching or end-of-path anchors. These omissions can produce decisions inconsistent with standard robots.txt semantics, particularly for policies containing overlapping `Allow` and `Disallow` directives, multiple applicable groups, wildcard rules, or anchored rules. Although ...[truncated 1623 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Replace the custom parser with a maintained implementation conforming to RFC 9309. - If custom parsing is unavoidable, implement: - Correct selection and merging of applicable user-agent groups. - Longest-match precedence across applicable `Allow` and `Disallow` rules. - `Allow` precedence when equally specific rules conflict. - Wildcard and end-anchor semantics. - Appropriate URL path normalization and percent-encoding handling. - Correct handling of comments, line endings, malformed records, and empty directives. - Return an `unknown` or error state for unsupported or ambiguous syntax rather than assuming access is allowed. - Add conformance tests for overlapping directives, multiple user-agent groups, wildcard patterns, `$` anchors, encoded paths, empty `Disallow` values, and equal-specificity conflicts. - Log which group and rule determined the final decision so that policy enforcement can be audited. ]]>
Vulnerability Patterns
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (3)

Direct Prompt Extraction

High
Category
System Prompt Leakage
Content
function agentMatches(ruleAgent, requestAgent) {
  if (ruleAgent === '*') return true;
  return ruleAgent.toLowerCase() === requestAgent.toLowerCase();
}
```
Confidence
85% confidence
Finding
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The robots.txt gate fails open on parse errors, fetch errors, and network failures by resolving to permitted access. In a scraping skill whose stated safety boundary is robots exclusion adherence, this can cause unauthorized scraping whenever robots.txt is unavailable or malformed, undermining the core policy control.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The connection manager sets `acceptLanguage` to `en-US,en;q=0.9`, which forces an English locale for all requests without any user choice or opt-in. This is a natural-language/locale policy concern because the skill imposes a language preference globally rather than making it configurable or documenting a justified region-specific need.

Static analysis

No suspicious patterns detected.