Back to skill

Security audit

Toutiao GEO Draft Assistant

Security checks for vulnerabilities and agentic risk

Overview

This skill is a clearly scoped Toutiao content-drafting assistant with visible browser automation and human-controlled publishing, though its example script should tighten file path checks and dependency pinning.

Install and run this only in a normal user account and review all generated content before clicking save or publish. Consider pinning Playwright versions and tightening the example script so it only reads resolved files inside output/toutiao before using it in a real workflow.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/draft_to_toutiao.example.py:16
Finding

Path Containment Check Can Be Bypassed

Content
View full analysis

Vulnerability Details

File Location: scripts/draft_to_toutiao.example.py, lines 16-23
Vulnerability Type: Improper path validation
Risk Level: Medium

python
def load_local_article(filepath):
    """Only files under the current project output directory may be read."""
    base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
    expected_path = os.path.abspath(filepath)
    
    # Path traversal security check
    if not expected_path.startswith(base_dir):
        raise SecurityError("Reading files outside the project directory is prohibited!")

Technical Analysis

The function uses a string-prefix comparison to determine whether expected_path is inside base_dir. A matching string prefix does not prove filesystem containment.

For example, if the project directory is /opt/project, a path such as /opt/project-backup/secret.txt starts with /opt/project and therefore passes the check despite being outside the project. The validation also does not resolve symlinks before enforcing the boundary. A symlink inside the project can consequently refer to a file outside it.

In addition, the function's documentation claims that only files in the output directory are permitted, but the implemented boundary is the entire project root. Any project file is therefore readable if its path is supplied.

The current program invokes this function with a fixed article path, so exploitation through the supplied entry point is limited. The flaw becomes exploitable if the function is reused with a user-controlled path, the article path becomes configurable, or an attacker can place a symlink at an accepted location.

Attack Path

  1. The attacker gains control over the filepath argument or can create a symlink in an accepted project location.
  2. The attacker supplies either:
    • A sibling path whose textual prefix matches the project directory; or
    • An in-project symlink that resolves to an external file.
  3. `os.path.a ...[truncated 833 chars]
Remediation
View remediation

Remediation Suggestions

  1. Define the precise permitted directory rather than using the project root:
python
from pathlib import Path

ALLOWED_DIR = (
    Path(__file__).resolve().parent.parent
    / "examples"
    / "output"
    / "toutiao"
).resolve()
  1. Resolve the candidate path before checking containment:
python
def load_local_article(filepath):
    candidate = Path(filepath).resolve(strict=True)

    if not candidate.is_relative_to(ALLOWED_DIR):
        raise SecurityError("The requested file is outside the allowed output directory.")

    if not candidate.is_file():
        raise SecurityError("The requested path is not a regular file.")

    with candidate.open("r", encoding="utf-8") as file:
        lines = file.readlines()
  1. For older Python versions, use os.path.commonpath() rather than startswith():
python
if os.path.commonpath([str(ALLOWED_DIR), str(candidate)]) != str(ALLOWED_DIR):
    raise SecurityError("The requested file is outside the allowed output directory.")
  1. If symlinks are not required, explicitly reject them before opening the file.
  2. Prefer a fixed, internally constructed article path instead of accepting arbitrary path input.
  3. Add tests for sibling-prefix paths, .. traversal, absolute external paths, and symlinks targeting external files.

T08 · Insecure Dependencies

Note
Location
README.md:42
Finding

Unpinned Playwright Package and Browser Installation

Content
View full analysis

Vulnerability Details

File Location: README.md, lines 42-44
Vulnerability Type: Unpinned third-party dependency installation
Risk Level: Low

bash
pip install playwright
playwright install
python scripts/draft_to_toutiao.example.py

Technical Analysis

The installation procedure retrieves the latest Playwright release available at execution time and then downloads browser binaries selected by that release. The project provides no dependency lockfile, exact version constraint, package hash verification, or documented trusted package index.

Consequently, installations are not reproducible and the code reviewed during this audit may run against materially different future dependency or browser versions. This is primarily a supply-chain hardening weakness; the audit found no evidence that the currently named playwright package is malicious or that a deliberately unsafe package source is configured.

Attack Path

  1. A user follows the documented installation instructions.
  2. pip resolves playwright dynamically from the user's configured package index.
  3. A future compromised release, compromised package repository, unsafe mirror, or incompatible release is selected.
  4. The package and associated browser binaries are installed under the user's privileges.
  5. The user runs the automation script, loading the installed package and launching the downloaded browser component.
  6. A compromised component could execute with the permissions of the user running the script.

This attack path depends on an upstream or package-source compromise; no such compromise was identified in the audited project.

Impact Assessment

A compromised dependency could access files, network resources, browser activity, and other resources available to the current operating-system user. It would not inherently obtain elevated administrator privileges unless installation or execution were performed with such privileges.

More likely non-malicious effects i ...[truncated 111 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin an audited Playwright version in a dependency file:
text
playwright==<reviewed-version>
  1. Generate and verify package hashes, for example with a locked requirements file:
text
playwright==<reviewed-version> \
    --hash=sha256:<verified-package-hash>
  1. Install dependencies in an isolated virtual environment rather than globally.
  2. Use a documented trusted package index and avoid unreviewed mirrors.
  3. Record the expected Playwright and browser revisions so installations are reproducible.
  4. Add an update process that reviews release notes and tests new versions before changing the pin.
  5. Advise users not to run the installation commands with administrator or root privileges.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • 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 (21)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The README states that Toutiao content '文字必须通俗易懂(大白话)', which imposes a specific language/register requirement as a mandatory behavior. Under the policy, forcing a language or locale style without user opt-in can be a natural-language policy violation unless clearly justified as a region-specific constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The document is written entirely in Chinese and provides no indication that users may choose another language or that the skill is intentionally limited to a Chinese-speaking audience. Under the policy criteria, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file’s operative instructions and policy requirements are expressed exclusively in Chinese, which can force a specific language on users or maintainers who do not share that locale. Under the stated policy, language constraints should either be optional, user-selected, or explicitly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file contains user-facing FAQ content entirely in Chinese, and there is no indication that users can choose another language or that the skill is intentionally limited to a Chinese-speaking audience. Under the language/locale policy rule, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The natural-language instructions define the system role as preparing material for Toutiao and the objective as creating a Toutiao article, which imposes a specific platform and locale context. Because the prompt does not offer any user opt-in or alternative language/locale choice, it can violate a language or locale policy requiring user choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The prompt specifies the system role and objective entirely in Chinese and targets a specific Chinese platform context, which effectively constrains the interaction to a single language/locale. Under the policy criteria, language or locale restrictions should either offer user choice or be clearly documented as a justified regional constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The required user-facing questions and style options are written entirely in Chinese, which directs the interaction into a specific language. The file does not offer opt-in, alternatives, or explain that the skill is intentionally region- or language-specific, so it creates a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The prompt is written entirely in Chinese and directs the assistant to act as a planner for a Chinese platform, which effectively imposes a specific language/locale behavior. The file does not offer user opt-in or an explicit statement that the skill is intentionally region-specific, so this matches the natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The prompt requires the assistant to act as an expert for 今日头条“微头条” and all content requirements are written to produce Chinese-language posts. This imposes a specific language/locale behavior without any user opt-in or documented justification that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The system role is written as a direct instruction in Chinese, which imposes a specific language/locale behavior without indicating user choice or opt-in. Under the policy, language constraints should either be optional or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The natural-language instructions require the assistant to act as a Toutiao headline expert and all task guidance is written in Chinese, effectively constraining output language and locale. Under SQP-3, forcing a specific language without user opt-in is a policy concern unless the constraint is explicitly justified or optional.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The system role and writing guidelines require the assistant to write in Chinese style and phrasing (e.g., '必须使用大白话'), which imposes a specific language/locale. The file does not offer user opt-in or explain that the skill is intentionally limited to a Chinese-language, region-specific use case.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code claims it only reads files from the project's output directory, but the actual check only enforces that the path stays somewhere under the project root. That means any file within the repository tree could be read if the filepath becomes user-controlled or is later reused elsewhere, creating a broader file-read capability than the documented security boundary.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The template content and instructions are entirely in Chinese and require the summary to be produced in that language, but there is no indication that the user can opt into another language or that the skill is explicitly limited to a Chinese-language context. This is a natural-language locale policy concern because it imposes a specific language by default.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file contains end-user-facing natural-language content entirely in Chinese, but it does not state that the skill is intended for Chinese-speaking users only or offer any language/locale choice. Under the language/locale policy rule, forcing a specific language without opt-in can be a policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file presents all user-facing content exclusively in Chinese, with no indication that other languages are supported or that the language choice is optional. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file consists entirely of Chinese-language content and does not indicate that other languages are supported or that Chinese is an intentional user-selected locale. Under the policy rule for natural-language violations, forcing a specific language without opt-in can be a locale policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The entire markdown content is written in Chinese and provides no indication that other languages are supported or that the Chinese-only format is a deliberate, justified regional constraint. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This file’s natural-language content is exclusively in Chinese, and there is no indication that the skill is region-specific or that users can opt into this locale. Under the language/locale policy, forcing a specific language without user choice can be a policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

This is a markdown file, so SQP-2 applies to omissions in the skill description about behaviors affecting user data or system state. The prompt specifies an output target file path, implying the skill will write content to disk, but the description does not warn the user that a file will be created or overwritten.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown template requires output in Chinese and provides no natural-language indication that the user can choose another language or that the template is intended only for a Chinese-language context. That can violate the language/locale policy when a skill forces a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.