Back to skill

Security audit

Free Novel Search

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent free-novel search purpose, but its bundled search and license-checking scripts have security-relevant flaws that can mislead users or expose/tamper with searches.

Install only if you are comfortable treating this as a convenience search/reference skill, not a trustworthy legal or safety verifier. Avoid entering private search terms or sensitive URLs until TLS verification and URL validation are fixed, and manually verify copyright/licensing on the source sites.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/search_novels.py:73
Finding

TLS Certificate Verification Disabled for External API Requests

Content
View full analysis

Vulnerability Details

File Location: scripts/search_novels.py, lines 73–84 and 104–110
Vulnerability Type: Improper certificate validation
Risk Level: High

Vulnerable Code

python
def search_gutenberg(query, limit=20):
    """Search Project Gutenberg via Gutendex API."""
    try:
        import urllib.request
        import ssl

        # Disable SSL verification for gutendex
        context = ssl._create_unverified_context()
        url = f"{PLATFORMS['gutenberg']['base_url']}?search={quote_plus(query)}"
        url += f"&languages=en"

        req = urllib.request.Request(url)
        req.add_header('Accept', 'application/json')

        with urllib.request.urlopen(req, context=context, timeout=10) as response:

The same insecure pattern is used for Open Library:

python
        context = ssl._create_unverified_context()
        req = urllib.request.Request(url)

        with urllib.request.urlopen(req, context=context, timeout=10) as response:
            data = json.loads(response.read().decode())
            docs = data.get("docs", [])[:limit]
            return [format_openlibrary_result(doc) for doc in docs]

Technical Analysis

ssl._create_unverified_context() disables certificate-chain and hostname verification. Although the endpoints use HTTPS, the client does not authenticate the remote servers. Any certificate presented by an intermediary will be accepted.

The affected responses are parsed as JSON and used to construct search results and URLs. A network-positioned attacker can therefore impersonate Gutendex or Open Library and provide attacker-controlled metadata.

Attack Path

  1. A user runs search_novels.py against Gutendex or Open Library.
  2. An attacker gains a network interception position, such as through a malicious Wi-Fi access point, compromised proxy, DNS manipulation, or upstream network compromise.
  3. The attacker redirects or intercepts the HTTPS request and presents an untrusted certific ...[truncated 965 chars]
Remediation
View remediation

Remediation Suggestions

Remove every use of ssl._create_unverified_context() and rely on Python’s verified default TLS context:

python
with urllib.request.urlopen(req, timeout=10) as response:
    data = json.loads(response.read().decode("utf-8"))

If an explicit context is required, create a verified one:

python
import ssl

context = ssl.create_default_context()
with urllib.request.urlopen(req, context=context, timeout=10) as response:
    data = json.loads(response.read().decode("utf-8"))

Additional hardening should include:

  1. Do not fall back to insecure TLS when verification fails.
  2. Keep the operating system and Python CA certificate stores current.
  3. Validate the response Content-Type before parsing it as JSON.
  4. Apply a reasonable maximum response size to reduce resource-exhaustion risk.
  5. Validate returned fields and generated URLs before exposing them to users or downstream systems.
  6. Add automated tests confirming that self-signed certificates and hostname mismatches are rejected.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/check_license.py:58
Finding

Trusted Platform Validation Can Be Bypassed with Crafted Hostnames

Content
View full analysis

Vulnerability Details

File Location: scripts/check_license.py, lines 58–68
Vulnerability Type: Improper URL and hostname validation
Risk Level: Medium

Vulnerable Code

python
    url_lower = url.lower()
    url_clean = re.sub(r'^https?://(www\.)?', '', url_lower)

    # Check known legitimate platforms
    for domain, info in LEGITIMATE_PLATFORMS.items():
        if domain in url_clean:
            return {
                "status": "known_legitimate",
                "domain": domain,
                "license": info["license"],
                "type": info["type"],
                "confidence": "high"
            }

Technical Analysis

The checker determines whether a URL belongs to a trusted platform by searching for a known domain as a substring anywhere in the normalized URL. It does not parse and validate the URL’s hostname.

Consequently, an attacker-controlled URL can include a trusted domain string without belonging to that domain. Examples include:

text
https://gutenberg.org.attacker.example/
https://attacker.example/path/openlibrary.org
https://attacker.example/?redirect=archive.org

Each URL may satisfy the substring test and be reported as known_legitimate with high confidence.

The exploitability of this validation issue is currently limited by a separate syntax defect at line 54, which prevents the script from executing as shipped. However, merely correcting that syntax error without repairing hostname validation would expose this vulnerability.

Attack Path

  1. An attacker registers or controls a domain whose hostname or URL contains a trusted platform string, such as gutenberg.org.attacker.example.
  2. The attacker hosts phishing, unauthorized, or malicious content on that domain.
  3. The crafted URL is submitted to the checker after its syntax defect is corrected.
  4. The checker removes only the leading scheme and optional www.
  5. The expression domain in url_clean matches gutenberg.org.
  6. T ...[truncated 786 chars]
Remediation
View remediation

Remediation Suggestions

Parse the URL and compare normalized hostnames using exact equality or a controlled subdomain boundary:

python
from urllib.parse import urlparse

def is_same_or_subdomain(hostname, trusted_domain):
    hostname = hostname.rstrip(".").lower()
    trusted_domain = trusted_domain.rstrip(".").lower()
    return hostname == trusted_domain or hostname.endswith("." + trusted_domain)

parsed = urlparse(url)
hostname = parsed.hostname

if parsed.scheme not in {"http", "https"} or not hostname:
    return {
        "status": "invalid",
        "message": "A valid HTTP or HTTPS URL is required",
        "confidence": "high",
    }

for domain, info in LEGITIMATE_PLATFORMS.items():
    normalized_domain = domain.removeprefix("www.")
    normalized_host = hostname.removeprefix("www.")

    if is_same_or_subdomain(normalized_host, normalized_domain):
        return {
            "status": "known_legitimate",
            "domain": domain,
            "license": info["license"],
            "type": info["type"],
            "confidence": "high",
        }

Further hardening should include:

  1. Decide explicitly whether subdomains are trusted; otherwise require exact hostname equality.
  2. Normalize internationalized domain names consistently with IDNA rules.
  3. Reject malformed URLs, embedded credentials, unsupported schemes, and missing hostnames.
  4. Do not inspect paths, query strings, or fragments when establishing domain identity.
  5. Add negative tests for domains such as gutenberg.org.attacker.example and attacker.example/?q=gutenberg.org.
  6. Correct the separate function-definition syntax error before deployment, but deploy that correction together with secure hostname validation.

other

Note
Location
scripts/check_license.py:54
Finding

License Checker Is Inoperable Due to Invalid Function Definition

Content
View full analysis

Vulnerability Details

File Location: scripts/check_license.py, line 54
Vulnerability Type: Security-control availability failure
Risk Level: Low

Vulnerable Code

python
def check_platform legitimacy(url):
    """Check if a platform is likely legitimate."""

The intended function is later called under a different valid identifier at line 149:

python
result = check_platform_legitimacy(args.url)

Technical Analysis

Python identifiers cannot contain spaces. The function declaration causes a SyntaxError during parsing, before any command-line logic or platform validation can execute.

As a result, the advertised license and platform-legitimacy checker provides no security decision at all. This is primarily a functional defect, but it affects a security-relevant control intended to help users distinguish legitimate resources from questionable ones.

Attack Path

No direct attacker-controlled exploitation is required:

  1. A user invokes scripts/check_license.py to assess a platform.
  2. Python parses the source file.
  3. Parsing fails at the invalid function definition.
  4. No URL validation or warning is produced.
  5. The user may proceed without the expected legitimacy assessment or may substitute an unverified manual judgment.

Impact Assessment

The defect does not provide code execution, data access, or privilege escalation. Its impact is limited to denial of the checker’s advertised functionality and the loss of a security-relevant advisory control.

Because the validation routine never runs, users receive no warning for suspicious URLs. The overall risk is low because the checker is advisory and the failure is visible rather than silently producing a successful result.

Remediation
View remediation

Remediation Suggestions

Rename the function so its definition matches the call site:

python
def check_platform_legitimacy(url):
    """Check if a platform is likely legitimate."""

Before releasing the corrected script:

  1. Repair the substring-based hostname validation described in the separate finding.
  2. Add a compilation check such as:
bash
python -m py_compile scripts/check_license.py
  1. Add unit tests that invoke the CLI and verify expected exit codes and output.
  2. Return a nonzero exit code when validation cannot be performed.
  3. Integrate syntax checks and tests into continuous integration so inoperable security tools cannot be shipped.
Vulnerability Patterns
  • 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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (6)

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring says it will 'Check if a website/novel platform offers truly free and legal content,' and the CLI description similarly implies verification of a platform/URL. In practice, the code only matches the input URL against hardcoded domain lists and regex patterns, with no HTTP fetch or site-content retrieval, so it cannot actually determine whether a website offers legal content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The Gutenberg search hard-codes languages=en, restricting results to English regardless of user preference. This is a natural-language/locale policy concern because the skill enforces a specific language without offering a choice or explaining why the limitation is required.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The manifest description includes Chinese text ('免费小说资源') inline with English, which introduces a language-specific presentation without stating that multilingual output is optional or user-selected. This can conflict with language/locale policy expectations when a skill implicitly forces or assumes a language choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The markdown explicitly tags resources by language, including EN and JP, but does not explain whether users should be offered a choice based on their preferred language or locale. This can be read as steering users toward specific language-localized resources without an explicit opt-in mechanism.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The docstring states 'Check if website mentions DMCA compliance,' which implies examining a website. The function actually accepts a text string and searches it for indicators, so the documentation overstates the function's behavior and source of evidence.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

This code prints the full user-supplied URL directly to stdout. For code files, user-facing disclosure can satisfy the warning requirement, but here the disclosure happens only at the moment of output and there is no prior comment, docstring, or warning that the tool will echo potentially sensitive URLs a user provides.

Content

No source excerpt is available for this finding.