Back to skill

Security audit

Ebook Search

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it says, but its downloader disables HTTPS verification, so an intercepted connection could swap in unsafe ebook links.

Before installing, be aware that the skill contacts jbiaojerry.github.io, stores a local ebook catalog cache, and shows third-party download links. The TLS verification bypass should be fixed before use, especially on shared, corporate, public, or otherwise untrusted networks; treat all displayed download links as untrusted until verified.

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/ebook-db.py:34
Finding

Disabled TLS Certificate and Hostname Verification

Content
View full analysis

Vulnerability Details

File Location: scripts/ebook-db.py, lines 34–36
Vulnerability Type: Improper certificate validation (CWE-295)
Risk Level: High

Vulnerable Code

python
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

This context is subsequently used for the database request:

python
with urllib.request.urlopen(req, context=ctx, timeout=120) as resp:
    data = resp.read()

Technical Analysis

The script creates a standard TLS context but then explicitly disables both hostname checking and certificate verification. Although DATABASE_URL uses HTTPS, these settings remove server authentication. Consequently, the client will accept an invalid, self-signed, expired, or attacker-controlled certificate.

The downloaded JSON is written directly to ~/.cache/ebook-search/all-books.json and treated as trusted catalog data. Its externally controlled fields—including titles, authors, categories, formats, and download links—are later displayed to users. No signature, trusted digest, schema validation, or download-link domain allowlist provides a secondary integrity control.

This does not directly execute remote code. It enables catalog and link substitution through a man-in-the-middle attack.

Attack Path

  1. The victim invokes a command that refreshes the catalog, such as update, or runs another command after the cache expires.
  2. An attacker with a network interception capability redirects or intercepts the connection to the configured database host.
  3. The attacker presents an arbitrary TLS certificate.
  4. Because certificate and hostname verification are disabled, the script accepts the attacker’s endpoint.
  5. The attacker returns a modified JSON catalog containing attacker-selected metadata and download URLs.
  6. The script saves that response in the local cache.
  7. Subsequent searches display the attacker-controlled links as ebook download links.
  8. A user who follows ...[truncated 750 chars]
Remediation
View remediation

Remediation Suggestions

Use Python’s default verified TLS behavior and do not disable certificate or hostname validation:

python
ctx = ssl.create_default_context()

with urllib.request.urlopen(req, context=ctx, timeout=120) as resp:
    data = resp.read()

Alternatively, omit the explicit context so that urllib uses the platform’s trusted certificate configuration:

python
with urllib.request.urlopen(req, timeout=120) as resp:
    data = resp.read()

Apply the following defense-in-depth controls:

  1. Ensure the runtime has an up-to-date CA trust store; fix certificate deployment problems rather than bypassing validation.
  2. Validate the response content type, maximum size, JSON structure, and expected field types before replacing the cache.
  3. Restrict displayed download links to explicitly trusted HTTPS hosts if the catalog is expected to reference a defined set of providers.
  4. If the publisher can provide one, verify a cryptographic signature or a securely distributed digest for the catalog.
  5. Parse and validate the downloaded data before atomically replacing the last known-good cache.
  6. Add an automated test confirming that connections using invalid certificates or mismatched hostnames are rejected.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (5)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill performs network access and local file writes but does not declare any explicit tool scope or permissions boundaries. This weakens policy enforcement and reviewability, making it easier for an agent to invoke capabilities users or operators did not clearly authorize.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger phrases are broad enough to activate on generic requests like finding books or recommendations, even when the user did not ask to use this specific source. Over-broad routing can cause unintended use of a skill that fetches remote data and surfaces third-party download links, increasing the chance of policy bypass, irrelevant invocation, or exposure to untrusted content.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code explicitly disables TLS hostname verification and certificate validation before downloading the ebook database. This allows a man-in-the-middle attacker or hostile network/device to substitute a malicious or tampered JSON database, causing the tool to trust unverified remote content and potentially distribute attacker-controlled links or metadata to users.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill states that it downloads remote data and caches it locally, but it does not present this as a user-facing safety or privacy consideration. Users may be unaware that invoking the skill causes background network access and writes persistent data to the local filesystem, which can matter in restricted or sensitive environments.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The formatted output includes Chinese text such as '《》' and '下载' unconditionally, regardless of user locale or preference. This is a natural-language policy issue because the skill enforces a specific language in user-facing output without offering a choice or documenting a justified region-specific limitation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.