T09 · Insecure Skill Coding Practices
- Location
scripts/pdf2md.py:7- Finding
Unrestricted Remote PDF Retrieval Enables Server-Side Request Forgery and Resource Exhaustion
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly matches its PDF conversion purpose, but it includes under-scoped remote fetching and an undocumented script that reads another OpenClaw workspace path.
Review carefully before installing. Use this only in an isolated virtual environment with trusted local PDFs or trusted URLs, avoid running it on hosts with access to sensitive internal network services, and remove or disable decode_files.py unless you explicitly need that workspace metadata utility. Pin dependencies before installation.
scripts/pdf2md.py:7Unrestricted Remote PDF Retrieval Enables Server-Side Request Forgery and Resource Exhaustion
scripts/pdf2md.py:14Predictable Temporary PDF Path Permits a Local Symlink Race
SKILL.md:102Unpinned Third-Party Dependency Installation Creates Supply-Chain Exposure
decode_files.py:4Undocumented Script Reads Metadata from an External OpenClaw Workspace
The declared description centers on PDF ingestion and knowledge extraction workflows. The supplied code does not open or parse PDFs, convert content to Markdown, repair CJK spacing, or extract knowledge from document bodies. Instead, it merely enumerates existing .md files in a specific hardcoded directory and prints a few metadata values from their headers. This is a materially different and much narrower behavior than the declared purpose, so it is a clear mismatch.
该代码块的主要功能是对Markdown文本进行规则抽取,而不是处理PDF。声明描述强调这是一个“PDF知识提取技能”,并列出四项功能,其中前两项(PDF转Markdown、CJK间距修复)在代码中完全没有体现;输入参数也是.md文件路径,说明实际资源访问对象与声明不一致。虽然规则提取与部分行业标准文档分析相关,和声明中的第(3)项有明显重合,但整体描述的核心能力范围大于代码实际行为,且关键PDF相关能力缺失,因此构成描述与行为不匹配。
Part of the description is accurate: the script does convert PDF text to Markdown and includes CJK spacing cleanup. It also has some industry-standard-specific handling through filename/URL pattern matching for standard IDs and categories. However, the more substantive claimed capabilities—'knowledge rule batch extraction' and broader structured knowledge extraction/analysis—are not present in this code. The script processes a single PDF input, extracts plain text per page, adds simple metadata, and outputs Markdown. That is a narrower behavior than the declared purpose, so this is a description-behavior mismatch.
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
if rule not in rules[rtype]:
rules[rtype].append(rule)
return rules
def rules_to_markdown(rules, title, standard_id):
"""将规则转为Markdown格式"""
All user-facing documentation in this file is presented only in Chinese, with no indication that the skill supports other languages or that Chinese-only usage is an intentional, justified regional constraint. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation.
The skill advertises operations that imply shell execution, filesystem reads/writes, and network access, but it does not declare any explicit tool scope or permission boundaries. In an agent environment, this can cause the runtime to grant broader capabilities than users expect, increasing the chance of unintended file access, arbitrary downloads, or command execution through downstream scripts.
The manifest description and title are written entirely in Chinese and present the skill as a Chinese/PDF knowledge extraction workflow, but they do not state that the skill is limited to Chinese-language users or provide any language-choice option. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation.
The manifest describes PDF text extraction, CJK spacing repair, rule extraction, and structured processing, but this script is specifically tied to harvesting URLs from a fixed external CDN path and orchestrating conversion by spawning another Python script. External source coupling and subprocess orchestration are implementation capabilities beyond the user-stated document-processing purpose in the manifest.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
fname = url.split('/')[-1]
print(" Converting: %s ..." % fname[:50])
try:
r = subprocess.run(cmd, capture_output=True, timeout=180)
if r.returncode == 0:
sz = os.path.getsize(out) // 1024 if os.path.exists(out) else 0
print(" [OK] %s_%s.md (%dKB)" % (seq, sid, sz))
The script's user-facing messages are presented in Chinese, and elsewhere it emits Chinese report headings and Chinese default metadata values. Because this is a general-purpose extractor script and the file does not state that it is limited to a Chinese-only or region-specific workflow, the hard-coded locale behavior appears to enforce a specific language without user opt-in.
The manifest describes a PDF knowledge-extraction skill for processing PDF files, but this implementation accepts a URL and performs network retrieval with requests.get before processing. Network fetching is a broader behavior than local PDF extraction and is not mentioned in the manifest description.
This script can retrieve content from any URL beginning with 'http', which introduces a general network access capability. The manifest focuses on extracting text, fixing CJK spacing, and structuring industry-standard PDF documents; it does not state that the skill should browse or fetch remote resources.
The usage examples show the tool accepting HTTPS URLs as input, which implies outbound network requests to fetch remote PDF content. The README does not include any user-facing warning about network access, remote fetching, or associated privacy/integrity considerations.
The file begins with a Chinese-only natural-language docstring describing the script. Under the policy rule for language/locale, forcing a specific language without offering user choice or documenting a justified locale restriction can be a policy concern.
The script can make outbound network requests and write a generated Markdown file to disk without an explicit warning or confirmation, which may surprise users in agent-driven or automated contexts. While not a direct exploit primitive, this can cause unintended network access or overwrite an existing file path supplied on the command line, making the behavior risky in environments where side effects must be explicit.