T09 · Insecure Skill Coding Practices
- Location
scripts/excel_converter.py:145- Finding
Spreadsheet Formula Injection in Markdown-to-Excel Conversion
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This WPS Office skill mostly matches its stated purpose, but it needs review because it can modify local documents, drive the GUI, use optional WPS cloud credentials, and has unsafe conversion paths for untrusted files.
Install only if you are comfortable with an agent launching WPS, typing into the active desktop, and modifying office files. Keep WPS 365 credentials out of shared/project files when possible, leave cloud credentials blank unless needed, avoid using it on untrusted Markdown or Office files, and make backups or specify separate output paths before batch conversion or image/layout edits.
scripts/excel_converter.py:145Spreadsheet Formula Injection in Markdown-to-Excel Conversion
scripts/main.py:252Active HTML Injection in Legacy Markdown Conversion
{content}
\n' if in_list: html += '\n' html += '\n' return html ``` ### Technical Analysis The converter inserts Markdown-derived text directly into HTML elements without HTML escaping or sanitization. Chara ...[truncated 1816 chars]scripts/main.py:169RTF Control-Word Injection Followed by Automatic Document Opening
scripts/main.py:50Path Traversal Outside the Configured Document Directory
config.json:1WPS Application Secret Stored in a Plaintext Project Configuration File
The skill metadata describes document automation and layout features, but the documented behavior also includes cloud API authentication with app_id/app_secret, token handling, and broad access to online forms, docs, sheets, flows, and mind maps. This is dangerous because users may supply credentials or enable the skill without realizing it can reach remote services and access or modify cloud-hosted organizational data.
The skill metadata describes document automation and layout features, but the documented behavior also includes cloud API authentication with app_id/app_secret, token handling, and broad access to online forms, docs, sheets, flows, and mind maps. This is dangerous because users may supply credentials or enable the skill without realizing it can reach remote services and access or modify cloud-hosted organizational data.
The skill metadata describes document automation and layout features, but the documented behavior also includes cloud API authentication with app_id/app_secret, token handling, and broad access to online forms, docs, sheets, flows, and mind maps. This is dangerous because users may supply credentials or enable the skill without realizing it can reach remote services and access or modify cloud-hosted organizational data.
The trigger list is very broad and includes common terms such as 'word', 'excel', '文档', '表格', and generic document-editing phrases. This can cause the skill to activate for many ordinary user requests, increasing the chance that an exec-capable automation skill is invoked unexpectedly and performs file-modifying or GUI-driving actions outside the user's specific intent.
The markdown file documents a batch conversion feature that operates over an entire directory, which can affect large numbers of user documents. The README provides usage examples but does not include any warning about reviewing the target directory, output behavior, or possible file overwrites/data-impact before running it.
The skill advertises substantial capabilities including local file operations, shell/subprocess execution, GUI automation, and networked API access, but it does not declare any explicit tool scope or permissions boundary. This increases the chance that an agent or user will invoke the skill with broader privileges than expected, enabling unintended file modification, command execution, or remote data access.
The natural-language instructions, warnings, features, installation, and usage guidance are predominantly presented in Chinese, which effectively forces a specific language on users. The file does not indicate that Chinese is optional or provide an alternate language path, so it may violate language/locale policy requirements.
The manifest description mentions document creation, Markdown conversion, and image-text layout for WPS Office automation, but this module also provides a reverse conversion capability from Excel files back into Markdown. That is a distinct behavior not reflected in this file’s own module description and broadens the practical scope beyond a one-way Markdown-to-office conversion helper.
The helper overwrites the input workbook by default when no output path is supplied, which can silently destroy or alter user data. In an automation skill context, this is risky because upstream callers may invoke the function on sensitive documents expecting a non-destructive transformation.
This helper also saves back to the original Excel file by default, causing implicit in-place modification of user documents. In document automation workflows, accidental overwrites can lead to integrity loss, unexpected content changes, and irreversible corruption of important files.
insert_image_to_doc defaults output_path to docx_path, causing the function to overwrite the input document in place when no destination is provided. In an automation skill, this can silently destroy or alter original user documents, creating integrity and recovery risks if invoked on important files or through chained workflows.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
else:
cmd = [app, filepath]
subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
# 如果有内容,等待 WPS 打开后输入
if content:
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
else:
cmd = [app, filepath]
subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
# 如果有内容,等待 WPS 打开后输入
if content:
Automated keystroke injection via pyautogui sends attacker- or user-controlled text to whatever window currently has focus, not necessarily the intended WPS document. In an agent environment this can cause unintended commands, data leakage, or modification of other applications, making the feature materially riskier than ordinary document creation.
The _md_to_docx docstring says it converts Markdown to a Word document, yet in the non-Darwin branch it creates an .html file and returns that as output. This is an active contradiction between the documented intent and the implemented behavior, not merely an omitted detail.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
f.write(rtf_content)
# 用 WPS 打开 RTF 文件
subprocess.Popen(['open', '-a', 'WPS Office', rtf_file],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
return {
The file implements substantial WPS 365 cloud and sharing functionality that is not disclosed by the skill metadata, which only advertises local document automation and conversion. Hidden or under-disclosed capabilities increase the chance that an agent or user will transmit data remotely or create online shares without understanding the broader security boundary.
This code performs outbound requests to WPS Open Platform using configured credentials, expanding the trust boundary from local automation to remote data transmission. In the context of a skill advertised mainly for local document creation and conversion, that mismatch can cause sensitive filenames, document metadata, or submitted content to be sent to a third party without sufficiently clear disclosure.
The access-token request transmits configured credentials to a remote service without any user-facing disclosure at the action level. In a skill framed as local office automation, silent credentialed network access increases the risk of users misunderstanding when secrets and associated account context are being used externally.
This generic API wrapper can transmit arbitrary parameters and JSON payloads to a remote WPS endpoint with no user-visible warning or consent checkpoint. Because it is a reusable primitive for multiple remote actions, it broadens the chance of sensitive document or form data being sent off-host unexpectedly.
The skill can create shareable online document links, which is a data-sharing capability materially different from local editing or conversion. In an agent context, generating public or semi-public share links without prominent disclosure can lead to unintentional exposure of document content or collaboration endpoints.
The code hardcodes 宋体 as the default font and the file-level descriptions and comments are entirely Chinese, indicating a built-in locale preference without any opt-in or documented justification. Under the language/locale policy, forcing a specific locale behavior without user choice can be problematic for users expecting other language or font defaults.
The converter saves directly to a caller-controlled output path and can overwrite existing files without any confirmation, safety check, or atomic-write strategy. In an automation skill context, this can cause unintended destruction of user documents or replacement of important files if a path is mis-specified or influenced by untrusted input.
The manifest describes document creation, Markdown conversion, and image-text layout for WPS Office automation, which aligns with generating Word documents from Markdown. However, this file also provides a full Word-to-Markdown converter, adding reverse conversion behavior that is not reflected in the manifest description.
The Markdown export path is written to directly with no warning or overwrite protection, creating the same unsafe file-clobbering condition as the Word export path. If output_path is user-supplied or derived from external input, an automation flow could silently replace existing files and cause data loss.
No suspicious patterns detected.