Back to skill

Security audit

HF Daily Papers (OFR Edition)

Security checks for vulnerabilities and agentic risk

Overview

This skill coherently fetches public paper metadata and generates Chinese OFR paper reports, with disclosed optional Telegram sending and no evidence of hidden persistence, credential theft, destructive behavior, or agent hijacking.

Install only if you want a Chinese OFR-focused paper digest that contacts Hugging Face and arXiv. Configure TELEGRAM_TARGET deliberately before using run_and_send.sh or any cron job, because it can post generated report content to that Telegram target without an interactive confirmation. Review generated Markdown links if report integrity matters, since arXiv metadata is fetched over HTTP and titles are not escaped before rendering.

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

Warning
Location
generator.py:119
Finding
Plaintext arXiv Metadata Retrieval Enables Generated Markdown Content Injection<![CDATA[ ## Vulnerability Details **File Location**: `generator.py:119-123`, `generator.py:144-145`, and `generator.py:207-210` **Vulnerability Type**: Unauthenticated transport and unsafe Markdown generation **Risk Level**: Medium ### Vulnerable Code The arXiv feed is retrieved over plaintext HTTP: ```python url = ( f'http://export.arxiv.org/api/query?' f'search_query=cat:cs.CV&sortBy=submittedDate' f'&sortOrder=descending&max_results={max_results}' ) ``` The externally supplied title is accepted with no Markdown-specific validation or escaping: ```python title = entry.find('atom:title', ns).text.strip().replace('\n', ' ')[:120] summary = entry.find('atom:summary', ns).text.strip().replace('\n', ' ')[:600].lower() ``` The title is subsequently inserted directly into a Markdown link label: ```python lines.append( f'- {src_tag} [{p["title"]}]({p["url"]})' f'{up_str}\n' ) ``` ### Technical Analysis The arXiv API request uses unencrypted HTTP. Consequently, its XML response has neither transport confidentiality nor server authenticity. An attacker capable of intercepting the network connection—including a compromised network gateway, hostile Wi-Fi access point, or maliciously configured proxy—can modify paper metadata before it reaches the application. The application parses the modified title and places it directly inside a Markdown link label. Truncating the title to 120 characters and replacing newline characters does not neutralize Markdown metacharacters such as `]`, `[`, `(`, and `)`. A forged title can therefore terminate the intended link label and introduce additional rendered Markdown content, including a misleading attacker-controlled link. The generated URL itself remains constructed from the parsed paper identifier and an expected host, but the unescaped title permits visual content and link spoofing within the report. This issue does not provide a direct local command-execution primitive. ### Attack Path 1. A user or ...[truncated 1239 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Retrieve the arXiv feed exclusively through HTTPS: ```python url = ( f'https://export.arxiv.org/api/query?' f'search_query=cat:cs.CV&sortBy=submittedDate' f'&sortOrder=descending&max_results={max_results}' ) ``` 2. Escape all externally supplied text before placing it into Markdown. At minimum, neutralize backslashes, square brackets, parentheses, and control characters: ```python def escape_markdown_label(value): value = re.sub(r'[\x00-\x1f\x7f]', ' ', value) return ( value.replace('\\', '\\\\') .replace('[', '\\[') .replace(']', '\\]') .replace('(', '\\(') .replace(')', '\\)') ) ``` Apply this function to every remote title before formatting the Markdown output. 3. Continue constructing destination URLs from validated identifiers rather than accepting URLs from remote metadata. Validate paper identifiers against a strict pattern such as: ```python if not re.fullmatch(r'\d{4}\.\d{4,5}', pid): continue ``` 4. Restrict generated links to approved HTTPS hosts, such as `arxiv.org` and `huggingface.co`. 5. Add automated tests containing hostile titles with Markdown delimiters, control characters, and attempted nested links to verify that generated reports cannot alter the intended document structure. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (9)

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The skill's natural-language instructions and operational guidance are presented entirely in Chinese, which effectively forces a specific language on users. The policy allows locale constraints only when users are given a choice or the restriction is clearly documented and justified, neither of which appears here.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The module description and all user-facing output strings indicate the skill is tailored to Chinese-language reporting ('OFR 定制版', '科研日报', Chinese status messages) with no option for users to select another language. This is a natural-language locale constraint that is not presented as opt-in or justified as a region-specific compliance requirement.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The script automatically transmits generated content to an external Telegram recipient specified by environment variable, with no interactive confirmation, disclosure at send time, or restriction on destination. Even though the message content is derived from local markdown rather than obvious secrets, this creates an exfiltration/channel-abuse risk because the skill can send data off-host to any configured target.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The header comment describes the script as automatically generating a PDF recommendation report. In reality, the script defaults to fetching Hugging Face papers, extracting metadata, sorting it, and printing a Markdown output path; PDF generation only occurs conditionally when the --pdf flag is supplied and is delegated to another script.

Missing User Warnings

Low
Confidence
87% confidence
Finding
The script reads HF_DAILY_PAPERS_PROXY and sets HTTP_PROXY/HTTPS_PROXY automatically, affecting how external requests are routed. There is no user-facing notice that proxy settings may be applied to network traffic, which is relevant to privacy and system behavior.

Missing User Warnings

Low
Confidence
81% confidence
Finding
The function fetches data from huggingface.co over the network, which transmits system-originated requests externally. Although there are progress print statements, they only describe fetching activity and do not clearly warn users that the skill contacts third-party services and may disclose network metadata such as IP/proxy usage.

Intent-Code Divergence

Low
Confidence
97% confidence
Finding
The inline comment `# PDF (optional)` and the `--pdf` flag handling imply that invoking this option will produce a PDF output. However, the implementation merely imports `FPDF` and then states that PDF generation is not implemented, which directly contradicts the advertised behavior of that code path.

Natural-Language Policy Violations

Low
Confidence
83% confidence
Finding
This plain-text recommendation file uses Chinese headings and labels throughout, such as the title and section names, which can impose a specific language on users. Under the policy criteria, forcing a language without user opt-in or documented justification is a natural-language policy concern.

Natural-Language Policy Violations

Low
Confidence
96% confidence
Finding
This shell script includes natural-language comments and console output in Chinese, such as the description on L03 and status message on L19, but provides no indication that the skill is intentionally region-specific or that users may choose another language. That creates a language/locale policy concern under the rule for forced language without opt-in.

Static analysis

No suspicious patterns detected.