Back to skill

Security audit

Docx

Security checks for vulnerabilities and agentic risk

Overview

This DOCX skill is mostly purpose-aligned, but it uses risky local execution patterns that could let shared temporary files or macros hijack LibreOffice runs.

Install only after reviewing or fixing the temporary-file and LibreOffice macro handling. Prefer an isolated environment, avoid shared /tmp execution, pin npm dependencies locally instead of global installs, and use extra caution with sensitive or untrusted documents and comment text.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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
Findings (4)

T07 · Tool Hijacking and Spoofing

Error
Location
scripts/office/soffice.py:41
Finding

Predictable Temporary LD_PRELOAD Library Allows Local Tool Hijacking

Content
View full analysis
bool: try: s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s.close() return False except OSError: return True def _ensure_shim() -> Path: if _SHIM_SO.exists(): return _SHIM_SO src = Path(tempfile.gettempdir()) / "lo_socket_shim.c" src.write_text(_SHIM_SOURCE) subprocess.run( ["gcc", "-shared", "-fPIC", "-o", str(_SHIM_SO), str(src), "-ldl"], check=True, capture_output=True, ) src.unlink() return _SHIM_SO ``` The returned path is subsequently assigned to `LD_PRELOAD`: ```python if _needs_shim(): shim = _ensure_shim() env["LD_PRELOAD"] = str(shim) ``` ### Technical Analysis The shared object is stored under a fixed, globally predictable path in the system temporary directory. `_ensure_shim()` considers the file trustworthy solely because it exists. It does not verify its owner, permissions, file type, cryptographic digest, source, or whether it is a symbolic link. On a multi-user system, an attacker can create `/tmp/lo_socket_shim.so` before the skill runs. When AF_UNIX socket creation fails and the compatibility path is activated, the existing attacker-controlled library is placed in `LD_PRELOAD`. The dynamic linker then loads it into the `soffice` process before normal application initialization. The source file `/tmp/lo_socket_shim.c` is also predictable. Concurrent invocations can overwrite, compile, or delete each other's source and output files, creating race conditions and further opportunities for tampering. ### Attack Path 1. The attacker has local access to the same host or can run another workload sharing the global te ...[truncated 1393 chars]
Remediation
View remediation

T07 · Tool Hijacking and Spoofing

Error
Location
scripts/accept_changes.py:16
Finding

Predictable LibreOffice Profile and Macro File Permit Macro Hijacking

Content
View full analysis
bool: macro_dir = Path(MACRO_DIR) macro_file = macro_dir / "Module1.xba" if macro_file.exists() and "AcceptAllTrackedChanges" in macro_file.read_text(): return True if not macro_dir.exists(): subprocess.run( [ "soffice", "--headless", f"-env:UserInstallation=file://{LIBREOFFICE_PROFILE}", "--terminate_after_init", ], capture_output=True, timeout=10, check=False, env=get_soffice_env(), ) macro_dir.mkdir(parents=True, exist_ok=True) try: macro_file.write_text(ACCEPT_CHANGES_MACRO) return True except Exception as e: logger.warning(f"Failed to setup LibreOffice macro: {e}") return False ``` The profile and macro are then used to execute a named LibreOffice macro: ```python cmd = [ "soffice", "--headless", f"-env:UserInstallation=file://{LIBREOFFICE_PROFILE}", "--norestore", "vnd.sun.star.script:Standard.Module1.AcceptAllTrackedChanges?language=Basic&location=application", str(output_path.absolute()), ] ``` ### Technical Analysis The LibreOffice profile is a fixed path under the global temporary directory. The implementation does not create an isolated, user-private profile for each invocation and does not validate ownership or permissions of the existing profile hierarchy. More critically, an existing `Module1.xba` is accepted when its text merely contains the string `AcceptAllTrackedChanges`. Thi ...[truncated 1986 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/comment.py:246
Finding

Unescaped Comment Metadata and Text Permit OOXML Structure Injection

Content
View full analysis
{text} """ ``` ```python _append_xml( comments, "w:comments", COMMENT_XML.format( id=comment_id, author=author, date=ts, initials=initials, para_id=para_id, text=text, ), ) ``` The generated fragment is reparsed as XML: ```python wrapper_dom = defusedxml.minidom.parseString(f"{content}") ``` ### Technical Analysis The `text`, `author`, and `initials` values are inserted directly into an XML fragment. No XML text-node or attribute escaping is performed before interpolation. `defusedxml` protects against several XML parser attacks, such as dangerous entity expansion, but it does not prevent structural XML injection when attacker-supplied input is deliberately embedded in markup before parsing. The documentation states that text should be pre-escaped XML. That shifts a context-sensitive security responsibility to callers and does not protect attribute contexts. For example, an author value containing a quote can terminate `w:author` and inject additional attributes. A text value can close `w:t`, insert arbitrary OOXML elements, and reopen the expected structure so the fragment remains well formed. ### Attack Path 1. An untrusted or partially trusted caller controls comment text, author, or initials. 2. The attacker sup ...[truncated 1536 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:58
Finding

Unpinned Global npm Installation Creates a Dependency Supply-Chain Risk

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (34)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Undeclared schema validation, repair, and broader Office-package processing enlarge the skill's effective capability beyond what the description advertises. That can lead to unsafe invocation and over-trust, especially because shell-driven processing of complex document formats can expose the system to malformed-file handling risks and unexpected side effects.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

Undeclared schema validation, repair, and broader Office-package processing enlarge the skill's effective capability beyond what the description advertises. That can lead to unsafe invocation and over-trust, especially because shell-driven processing of complex document formats can expose the system to malformed-file handling risks and unexpected side effects.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

Undeclared schema validation, repair, and broader Office-package processing enlarge the skill's effective capability beyond what the description advertises. That can lead to unsafe invocation and over-trust, especially because shell-driven processing of complex document formats can expose the system to malformed-file handling risks and unexpected side effects.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Undeclared schema validation, repair, and broader Office-package processing enlarge the skill's effective capability beyond what the description advertises. That can lead to unsafe invocation and over-trust, especially because shell-driven processing of complex document formats can expose the system to malformed-file handling risks and unexpected side effects.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Undeclared schema validation, repair, and broader Office-package processing enlarge the skill's effective capability beyond what the description advertises. That can lead to unsafe invocation and over-trust, especially because shell-driven processing of complex document formats can expose the system to malformed-file handling risks and unexpected side effects.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Undeclared schema validation, repair, and broader Office-package processing enlarge the skill's effective capability beyond what the description advertises. That can lead to unsafe invocation and over-trust, especially because shell-driven processing of complex document formats can expose the system to malformed-file handling risks and unexpected side effects.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Undeclared schema validation, repair, and broader Office-package processing enlarge the skill's effective capability beyond what the description advertises. That can lead to unsafe invocation and over-trust, especially because shell-driven processing of complex document formats can expose the system to malformed-file handling risks and unexpected side effects.

Content

No source excerpt is available for this finding.

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 418)May include surrounding context.

CRITICAL: Use smart quotes for new content. When adding text with apostrophes or quotes, use XML entities to produce smart quotes:

xml
<!-- Use these entities for professional typography -->
<w:t>Here&#x2019;s a quote: &#x201C;Hello&#x201D;</w:t>

| Entity | Character |

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 499)May include surrounding context.

xml
<w:p>
  <w:pPr>
    <w:numPr>...</w:numPr>  <!-- list numbering if present -->
    <w:rPr>
      <w:del w:id="1" w:author="Claude" w:date="2025-01-01T00:00:00Z"/>
    </w:rPr>

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/office/soffice.py (reported line 25)May include surrounding context.

python
def get_soffice_env() -> dict:
    env = os.environ.copy()
    env["SAL_USE_VCLPLUGIN"] = "svp"

    if _needs_shim():

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill clearly instructs use of shell commands, file reads/writes, and likely environment-dependent tooling, but it does not declare any explicit tool scope such as allowed-tools or permissions. That creates an authorization and review gap: downstream systems or operators cannot easily constrain what the skill is expected to access, increasing the chance of unintended command execution or file modification.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger text includes very broad terms like 'report', 'memo', 'letter', and 'template', which can cause the skill to activate for many ordinary requests that do not actually require DOCX manipulation. Over-broad invocation increases the chance that a powerful shell/file-manipulating skill is selected unnecessarily, expanding attack surface and creating opportunities for prompt routing mistakes.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The instruction to use 'Claude' as the author by default embeds an identity choice into document modifications without user opt-in. That can misattribute edits or comments, create audit-integrity problems, and leak implementation details about the agent rather than preserving neutral or user-specified authorship.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/accept_changes.py (reported line 68)May include surrounding context.

python
]

    try:
        result = subprocess.run(
            cmd,
            capture_output=True,
            text=True,

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/accept_changes.py (reported line 99)May include surrounding context.

python
return True

    if not macro_dir.exists():
        subprocess.run(
            [
                "soffice",
                "--headless",

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code performs a direct file write to the DOCX XML payload, modifying user data on disk. While the module docstring describes the transformation, there is no confirmation prompt, visible logging/print statement, or explicit warning near the write about the in-place modification behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code performs a direct file write to the document XML, modifying user data in place. Although the module docstring explains the purpose, there is no runtime confirmation, warning, or visible user disclosure at the point of mutation, and the operation could affect document revision history irreversibly.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest says this skill should be used for creating, reading, editing, or manipulating Word documents (.docx files). This module explicitly packs directories into .docx, .pptx, or .xlsx files, so the implemented behavior includes PowerPoint and Excel packaging that is outside the stated DOCX scope.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Within the context of this skill, the inline module documentation advertises broader Office-file support than the skill manifest permits. That creates an intent mismatch between the code documentation and the declared purpose of the skill, which is limited to Word documents.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documentation frames the shim as a compatibility helper, but the injected C code forcibly terminates the target process via _exit(0) when a listener socket is closed. That hidden behavior can suppress cleanup, bypass normal control flow, and make failures or side effects harder to reason about, which is risky in a document-processing component.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This module goes beyond ordinary document handling by dynamically compiling and injecting an LD_PRELOAD shim into another process. In a DOCX skill, that expanded capability increases risk because it introduces native-code execution, compiler invocation, and process-manipulation behaviors that are unnecessary for many document tasks and enlarge the attack surface.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/office/soffice.py (reported line 37)May include surrounding context.

python
def run_soffice(args: list[str], **kwargs) -> subprocess.CompletedProcess:
    env = get_soffice_env()
    return subprocess.run(["soffice"] + args, env=env, **kwargs)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code writes C source into a temporary directory and invokes gcc to compile a shared object, but the operation has no confirmation prompt, print/log statement, or inline warning near the action itself. Although the module docstring explains the shim behavior at a high level, it does not clearly disclose that the helper will write files and execute a compiler subprocess on the user's system.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
93% confidence
Finding

The code writes attacker-reachable source and output files into a shared temporary directory and then compiles and later LD_PRELOADs the resulting shared object. Using predictable filenames in /tmp creates a race/symlink attack surface that can lead to overwriting files, compiling attacker-controlled content, or preloading a malicious library into the spawned LibreOffice process.

Content

Scanner excerpt · scripts/office/soffice.py (reported line 59)May include surrounding context.

python
src = Path(tempfile.gettempdir()) / "lo_socket_shim.c"
    src.write_text(_SHIM_SOURCE)
    subprocess.run(
        ["gcc", "-shared", "-fPIC", "-o", str(_SHIM_SO), str(src), "-ldl"],
        check=True,
        capture_output=True,

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module-level behavior and usage text advertise Office-wide unpacking for DOCX, PPTX, and XLSX, which exceeds the documented purpose of a Word-document skill. In an agent setting, undeclared extra file-handling capabilities are dangerous because they can be invoked to extract or transform data from more sensitive or unexpected document types than users or policy expect.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.