Back to skill

Security audit

Young Post Downloader

Security checks for vulnerabilities and agentic risk

Overview

The skill matches its stated article-to-PDF purpose, but it uses unsafe shell execution and under-scoped cloud upload behavior that users should review before installing.

Review this skill before installing. Its intended task is understandable, but it should replace os.system with safe subprocess arguments, restrict output paths, sanitize fetched article content before HTML/PDF rendering, and ask before uploading generated files to Feishu. Treat the current scripts as incomplete and not production-ready automation.

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

Error
Location
scripts/download_articles.py:72
Finding

Shell Command Injection Through Attacker-Controlled WORKSPACE Path

Content
View full analysis
{pdf_path}") cmd = f'google-chrome --headless --disable-gpu --print-to-pdf={pdf_path} --print-to-pdf-no-header --paper-size=A4 {html_path}' os.system(cmd) ``` The paths passed to `convert_to_pdf` are derived from `WORKSPACE`: ```python html_path = os.path.join(WORKSPACE, f"young-post-spark-{date_str}.html") pdf_path = os.path.join(WORKSPACE, f"young-post-spark-{date_str}.pdf") convert_to_pdf(html_path, pdf_path) ``` ### Technical Analysis The `WORKSPACE` environment variable is accepted without validation and incorporated into `html_path` and `pdf_path`. These values are then interpolated directly into a shell command executed by `os.system`. Because `os.system` invokes a command shell, shell metacharacters contained in the workspace path—such as semicolons, command substitutions, redirection operators, or comment characters—are interpreted as shell syntax rather than as literal path characters. Neither path is shell-escaped or passed as a distinct process argument. The earlier HTML file write does not reliably prevent exploitation. An attacker who can set the environment and create directories may create a literal directory whose name contains shell metacharacters, allowing the file write to succeed before those same characters are interpreted by the shell during PDF conversion. ### Attack Path 1. The attacker gains control over the `WORKSPACE` environment variable used to launch the skill. 2. The attacker creates a writable directory with a specially crafted name containing shell sy ...[truncated 1379 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/young_post_downloader.py:50
Finding

Unescaped Remote Article Data Embedded in Generated HTML

Content
View full analysis
str: """Generate HTML document content""" # Generate table of contents toc_items = [] for i, article in enumerate(articles, 1): title = article.get('title', f'Article {i}') toc_items.append(f'
  • {i}. {title}
  • ') toc_html = '\n'.join(toc_items) # Generate article list articles_html = [] for i, article in enumerate(articles, 1): article_html = f"""

    {i}. {article.get('title', 'Untitled')}

    URL: {article.get('url', 'N/A')}
    Download time: {datetime.now().strftime("%Y-%m-%d %H:%M")}
    {article.get('content', 'No content')}
    """ articles_html.append(article_html) ``` ### Technical Analysis The function directly interpolates the following article-controlled values into an HTML document: - `title`, in both the table of contents and heading. - `url`, in an `href` attribute and visible link text. - `content`, inside the document body. No HTML escaping, markup sanitization, URL-scheme validation, or source-host validation is performed. The documented workflow identifies website content as the source of these values, so the data crosses a remote-content trust boundary. A malicious or compromised article can close existing elements or attributes and inject arbitrary HTML. Injected content may include scripts, event handlers, embedded frames, forms, tracking resources, or links using unsafe schemes. Even where headless Chrome limits some behavior, opening the generated H ...[truncated 1854 chars]
    Remediation
    View remediation
    Vulnerability Patterns
    • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
    • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
    • Behavioral ASTexec() Call, eval() Call, Dynamic Import
    • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
    • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
    Findings (12)

    Tp4

    High
    Category
    MCP Tool Poisoning
    Confidence
    90% confidence
    Finding

    这是明显的描述与行为不符。声明描述的是一个可工作的下载、解析、汇总、转 PDF、上传飞书工具;而实际代码只是流程骨架。fetch_url 没有真正获取网页文本,parse_spark_page 没有解析 HTML,download_article 没有下载文章内容,generate_html 没有把 articles 内容渲染进文档,upload_to_feishu 也没有真正调用上传逻辑。虽然 convert_to_pdf 确实会调用 Chrome 生成 PDF,但生成的是空文章容器页面。不存在明显额外的未声明危险能力,但其核心承诺的大部分功能并未实际实现,因此应判定为 mismatch。

    Content

    No source excerpt is available for this finding.

    Tp4

    High
    Category
    MCP Tool Poisoning
    Confidence
    95% confidence
    Finding

    描述声称该技能能够自动访问网站、批量下载文章、生成 PDF 并上传飞书。实际代码中,虽然有用于从 HTML 提取文章链接和生成 HTML 文档的辅助函数,但 main() 并没有真正获取网页内容、解析实际页面、下载文章、写出 HTML 文件、调用 Chrome 生成 PDF,或执行飞书上传;它只是将这些步骤以日志和 print 形式展示出来,并明确提示“实际执行时需调用相应工具”。因此,代码实际行为与声明的核心能力存在实质差异:声明的是可执行的自动化下载/转换/上传工具,代码实现的却主要是流程示意与部分辅助函数,属于能力被明显夸大。

    Content

    No source excerpt is available for this finding.

    os.system() or os exec-family call

    High
    Category
    Dangerous Code Execution
    Confidence
    96% confidence
    Finding

    The code builds a shell command with f-string interpolation and executes it via os.system using html_path and pdf_path. Because those paths are derived from environment-controlled workspace data and are not safely quoted or passed as structured arguments, a crafted WORKSPACE value could trigger shell command injection and arbitrary command execution.

    Content

    Scanner excerpt · scripts/download_articles.py (reported line 72)May include surrounding context.

    python
    """使用 Chrome 将 HTML 转换为 PDF"""
        log(f"转换 PDF: {html_path} -> {pdf_path}")
        cmd = f'google-chrome --headless --disable-gpu --print-to-pdf={pdf_path} --print-to-pdf-no-header --paper-size=A4 {html_path}'
        os.system(cmd)
    
    def upload_to_feishu(file_path: str) -> bool:
        """上传文件到飞书云空间"""
    

    Undeclared Tool Scope

    Medium
    Category
    MCP Least Privilege
    Confidence
    91% confidence
    Finding

    The skill describes capabilities that involve network access, file creation, shell execution, and likely environment use, but it declares no explicit tool scope or permission boundary. This is dangerous because an agent may invoke broader-than-necessary capabilities without clear user visibility or policy enforcement, increasing the chance of unintended command execution, filesystem writes, or data exfiltration.

    Content

    No source excerpt is available for this finding.

    Missing User Warnings

    Medium
    Category
    Not specified by scanner
    Confidence
    94% confidence
    Finding

    The skill advertises uploading generated PDFs to Feishu without clearly warning that scraped article content will be transmitted to a third-party cloud service. This is dangerous because users may not realize content leaves the local/session context, which can create privacy, compliance, or copyright handling issues.

    Content

    No source excerpt is available for this finding.

    Missing User Warnings

    Medium
    Category
    Not specified by scanner
    Confidence
    89% confidence
    Finding

    The trigger examples imply automatic scraping and cloud upload as a routine response, but they do not warn about network access, bulk retrieval, or external file transfer. In this context, the automation makes the omission more dangerous because a user request phrased casually could initiate third-party access and data transmission without informed consent.

    Content

    No source excerpt is available for this finding.

    Context-Inappropriate Capability

    Medium
    Category
    Not specified by scanner
    Confidence
    87% confidence
    Finding

    The skill instructs use of a local headless Chrome subprocess for PDF generation, introducing shell/process execution beyond simple web retrieval and upload. This expands the attack surface because locally rendered HTML can trigger risky browser behavior, and shell-based execution is harder to constrain than a dedicated conversion tool.

    Content

    No source excerpt is available for this finding.

    Intent-Code Divergence

    Medium
    Category
    Not specified by scanner
    Confidence
    96% confidence
    Finding

    The module docstring says the tool automatically visits the site, downloads articles, generates PDFs, and uploads to Feishu. In code, fetch_url and download_article only log and return success placeholders, and parse_spark_page returns an empty list, so the advertised downloading behavior is not actually implemented.

    Content

    No source excerpt is available for this finding.

    Context-Inappropriate Capability

    Medium
    Category
    Not specified by scanner
    Confidence
    92% confidence
    Finding

    Using a local shell command for PDF conversion is dangerous here because the command string incorporates file paths without safe process invocation. In an agent/skill context, environment variables and workspace configuration may be influenced externally, making this more risky than a purely local script.

    Content

    No source excerpt is available for this finding.

    Missing User Warnings

    Medium
    Category
    Not specified by scanner
    Confidence
    85% confidence
    Finding

    This code invokes a subprocess via os.system to run headless Chrome and generate a PDF. Although there is a progress log, the script does not explicitly disclose the safety implications of launching an external browser process or document that shell execution will occur.

    Content

    No source excerpt is available for this finding.

    Missing User Warnings

    Medium
    Category
    Not specified by scanner
    Confidence
    91% confidence
    Finding

    The function uploads a local PDF to Feishu cloud storage, which transfers user-generated content off the local system. The current logging notes the action is happening, but there is no clear warning in the script documentation that generated documents will be uploaded to an external service.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Low
    Category
    Not specified by scanner
    Confidence
    95% confidence
    Finding

    The file’s natural-language description and all user-facing status messages are written in Chinese, and the generated HTML explicitly sets lang="zh-CN". This imposes a specific language/locale on users without any opt-in or documented justification, which matches the language/locale policy violation category.

    Content

    No source excerpt is available for this finding.

    Static analysis

    No suspicious patterns detected.