Back to skill

Security audit

Docx Cn 1.0.1

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly for Word document workflows, but it uses under-disclosed LibreOffice macro/profile and native preload behavior that creates review-worthy local execution and persistence risk.

Review before installing. Use this only in an isolated workspace for documents you trust, avoid global npm installation where possible, and be aware that accepting tracked changes uses LibreOffice macro/profile state under /tmp and conversion may use LD_PRELOAD native code. Treat outputs as document mutations and keep backups of important files.

Vulnerability Patterns
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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
Findings (5)

T07 · Tool Hijacking and Spoofing

Error
Location
scripts/office/soffice.py:24
Finding
Predictable shared LD_PRELOAD library enables local tool hijacking<![CDATA[ ## Vulnerability Details **File Location**: `scripts/office/soffice.py:24-31, 41-65` **Vulnerability Type**: Unsafe temporary file handling and dynamic-library preloading **Risk Level**: High ### Vulnerable Code ```python def get_soffice_env() -> dict: env = os.environ.copy() env["SAL_USE_VCLPLUGIN"] = "svp" if _needs_shim(): shim = _ensure_shim() env["LD_PRELOAD"] = str(shim) return env _SHIM_SO = Path(tempfile.gettempdir()) / "lo_socket_shim.so" 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 ``` ### Technical Analysis The code stores a native shared library at the fixed path `/tmp/lo_socket_shim.so`. If that path already exists, `_ensure_shim()` trusts it without checking its owner, permissions, file type, resolved path, or contents. When AF_UNIX socket creation is unavailable, the existing file is assigned to `LD_PRELOAD` and loaded into the LibreOffice process. `LD_PRELOAD` libraries execute native initialization code in the target process before normal application execution. Consequently, accepting an attacker-controlled file at this location creates a direct local code-execution primitive. The source file `/tmp/lo_socket_shim.c` is also predictable and written non-atomically. The implementation does not reject symbolic links or protect the check-then-use sequence from replacement races. ### Attack Path 1. A local attacker who can write to the shared temporary directory creates `/tmp/lo_socket_shim.so` as a malicious shared library, or replaces the file between validation and LibreOffice execution. 2. The Skill runs in an environment where `_needs_shim()` returns `True`. 3. `_ensure_shim()` det ...[truncated 814 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Create a new private temporary directory for each invocation using `tempfile.TemporaryDirectory()`. - Ensure the directory is owned by the current user and has mode `0700`. - Compile the library to a unique path inside that directory rather than under a shared fixed filename. - Create files atomically and reject symbolic links and non-regular files. - Never reuse a pre-existing library solely because it exists. - If caching is required, verify ownership, restrictive permissions, and a cryptographic hash of the expected binary before using it. - Set `LD_PRELOAD` only for the specific LibreOffice child process and remove the temporary directory in a `finally` block. - Consider removing native interposition entirely and failing safely when the environment does not support the required LibreOffice socket behavior. ]]>

T06 · System Persistence

Error
Location
scripts/accept_changes.py:14
Finding
Shared persistent LibreOffice profile permits macro and configuration poisoning<![CDATA[ ## Vulnerability Details **File Location**: `scripts/accept_changes.py:14-15, 57-63, 91-115` **Vulnerability Type**: Predictable persistent application profile and insufficient macro validation **Risk Level**: High ### Vulnerable Code ```python LIBREOFFICE_PROFILE = "/tmp/libreoffice_docx_profile" MACRO_DIR = f"{LIBREOFFICE_PROFILE}/user/basic/Standard" ``` ```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()), ] ``` ```python def _setup_libreoffice_macro() -> 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 ``` ### Technical Analysis The Skill uses a fixed LibreOffice profile under `/tmp` and retains it across executions. That profile can contain macros, application configuration, extensions, recovery data, and other LibreOffice state. The existing `Module1.xba` file is considered trusted if its text merely contains the string `AcceptAllTrackedChanges`. The complete macro content is not compared against the expected template, and ownership, permissions, regular-file status, and syml ...[truncated 1647 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Generate a new private LibreOffice profile for every operation. - Place the profile in a `TemporaryDirectory` owned by the current user with mode `0700`. - Write the expected macro unconditionally to a newly created regular file using atomic creation. - Reject symlinks and verify that every resolved profile path remains inside the private temporary directory. - If macro reuse is unavoidable, compare the complete content against a cryptographic hash of the expected macro rather than searching for a marker string. - Remove the profile in a `finally` block after LibreOffice exits or times out. - Avoid storing unrelated LibreOffice state in the same profile. - Add locking if concurrent operations can access shared resources. - Treat a timeout as an indeterminate failure and verify the output document before reporting success. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/comment.py:35
Finding
Unescaped comment fields allow OOXML injection<![CDATA[ ## Vulnerability Details **File Location**: `scripts/comment.py:35-53, 86-95, 238-249` **Vulnerability Type**: XML injection through string interpolation **Risk Level**: Medium ### Vulnerable Code ```python COMMENT_XML = """\ <w:comment w:id="{id}" w:author="{author}" w:date="{date}" w:initials="{initials}"> <w:p w14:paraId="{para_id}" w14:textId="77777777"> <w:r> <w:rPr><w:rStyle w:val="CommentReference"/></w:rPr> <w:annotationRef/> </w:r> <w:r> <w:rPr> <w:color w:val="000000"/> <w:sz w:val="20"/> <w:szCs w:val="20"/> </w:rPr> <w:t>{text}</w:t> </w:r> </w:p> </w:comment>""" ``` ```python def _append_xml(xml_path: Path, root_tag: str, content: str) -> None: dom = defusedxml.minidom.parseString(xml_path.read_text(encoding="utf-8")) root = dom.getElementsByTagName(root_tag)[0] ns_attrs = " ".join(f'xmlns:{k}="{v}"' for k, v in NS.items()) wrapper_dom = defusedxml.minidom.parseString(f"<root {ns_attrs}>{content}</root>") for child in wrapper_dom.documentElement.childNodes: if child.nodeType == child.ELEMENT_NODE: root.appendChild(dom.importNode(child, True)) output = _encode_smart_quotes(dom.toxml(encoding="UTF-8").decode("utf-8")) xml_path.write_text(output, encoding="utf-8") ``` ```python _append_xml( comments, "w:comments", COMMENT_XML.format( id=comment_id, author=author, date=ts, initials=initials, para_id=para_id, text=text, ), ) ``` ### Technical Analysis The `text`, `author`, and `initials` values can originate from command-line input and are interpolated directly into XML markup. The generated string is then parsed as XML, meaning supplied markup is interpreted structurally rather than encoded as text. Requiring callers to pre-escape XML is not a security control. It makes correct escaping dependent on every caller and intentionally permits well-formed in ...[truncated 1604 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Stop constructing XML with formatted strings. - Build the complete comment using DOM APIs. - Create comment text with `createTextNode()` so XML metacharacters are escaped automatically. - Assign author, initials, IDs, and dates through `setAttribute()` or namespace-aware equivalents. - Reject invalid XML control characters and enforce reasonable length limits. - Change the API contract so callers provide ordinary Unicode text, not pre-escaped XML. - Add tests using values containing `&`, `<`, `>`, single and double quotes, namespace prefixes, and attempted closing tags. - Validate the resulting OOXML package before repacking it. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:61
Finding
Unpinned global npm installation creates supply-chain exposure<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:61, 482` **Vulnerability Type**: Mutable and globally installed third-party dependency **Risk Level**: Medium ### Vulnerable Code ```markdown Generate .docx files with JavaScript, then validate. Install: `npm install -g docx` ``` ```markdown - **docx**: `npm install -g docx` (new documents) ``` ### Technical Analysis The setup guidance installs the latest package version resolved under the name `docx`. No exact version, lockfile, integrity value, or provenance requirement is specified. npm packages may run lifecycle scripts during installation. A mutable latest release can therefore execute code with the installing user's privileges before the Skill processes any document. Installing globally also modifies user-wide or system-wide package state and can affect unrelated projects. The package name appears consistent with the declared document-generation dependency; there is no evidence in the audited project that it is intentionally malicious. The vulnerability is the unsafe, non-reproducible installation method. ### Attack Path 1. A user follows the Skill's setup instruction. 2. `npm install -g docx` contacts the configured npm registry and resolves the current release. 3. npm downloads a version that may differ from the version originally reviewed. 4. Package lifecycle scripts execute during installation unless separately disabled. 5. A compromised release, registry account, dependency, or registry configuration executes code as the installing user. 6. The global installation remains available to other projects and later sessions. ### Impact Assessment A compromised dependency can execute arbitrary code with the privileges of the user running npm. It may access user-owned files, environment variables, documents, and network resources available in that environment. If a user runs the command with administrative privileges to permit global installation, the impact may extend to system-wi ...[truncated 166 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Install the package locally within a dedicated project directory rather than globally. - Pin an audited exact version in `package.json`. - Commit a reviewed `package-lock.json`. - Use `npm ci` for reproducible installation. - Verify lockfile integrity metadata and package provenance. - Disable lifecycle scripts with `--ignore-scripts` when the package does not require them. - Run dependency auditing and review transitive dependencies before publishing updates. - Execute document generation in a restricted environment with minimal filesystem and network access. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/office/unpack.py:52
Finding
Office archives are extracted without decompression resource limits<![CDATA[ ## Vulnerability Details **File Locations**: - `scripts/office/unpack.py:52-54` - `scripts/office/validate.py:72-74` - `scripts/office/validators/redlining.py:59-64` - `scripts/office/validators/base.py:798-802` - `scripts/office/validators/docx.py:187-189` **Vulnerability Type**: Unbounded archive extraction and ZIP bomb denial of service **Risk Level**: Medium ### Vulnerable Code From `scripts/office/unpack.py`: ```python with zipfile.ZipFile(input_path, "r") as zf: zf.extractall(output_path) ``` From `scripts/office/validate.py`: ```python if path.is_file() and path.suffix.lower() in [".docx", ".pptx", ".xlsx"]: temp_dir = tempfile.mkdtemp() with zipfile.ZipFile(path, "r") as zf: zf.extractall(temp_dir) unpacked_dir = Path(temp_dir) ``` From `scripts/office/validators/redlining.py`: ```python with tempfile.TemporaryDirectory() as temp_dir: temp_path = Path(temp_dir) try: with zipfile.ZipFile(self.original_docx, "r") as zip_ref: zip_ref.extractall(temp_path) ``` ### Technical Analysis DOCX, PPTX, and XLSX files are ZIP archives and may be supplied by untrusted users. The extraction paths process every archive member without enforcing: - A maximum number of entries - A maximum uncompressed size per entry - A maximum aggregate uncompressed size - A maximum compression ratio - Disk-space safeguards - Processing-time limits A highly compressed archive can have a small input size while expanding to gigabytes of data. Subsequent recursive XML discovery and parsing can further amplify CPU and memory consumption. The reviewed Python extraction calls use standard `extractall()` behavior. The confirmed issue is resource exhaustion; no separate archive path-traversal exploit is asserted here. ### Attack Path 1. An attacker creates a DOCX, PPTX, or XLSX archive containing extremely compressible data or a very large number of entries. 2. The attacker submits the file for unpacking or validation. ...[truncated 805 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Inspect every `ZipInfo` entry before extraction. - Reject archives exceeding configured limits for: - Entry count - Individual uncompressed size - Aggregate uncompressed size - Compression ratio - Maximum path length and nesting depth - Stream each member to disk while tracking actual bytes written rather than relying only on metadata. - Check available disk space before and during extraction. - Apply process-level CPU, memory, file-size, and execution-time limits. - Extract only expected OOXML paths and reject unexpected executable or oversized members. - Use `TemporaryDirectory` consistently so partial extractions are removed automatically. - Centralize hardened archive extraction in one helper and replace every direct `extractall()` call. ]]>
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 (33)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding
The declared description focuses specifically on Word document processing (.docx) with user-facing capabilities like creating, reading, editing, formatting, tables, and images. The supplied code is a lower-level packaging utility that rebuilds Office files from an unpacked directory, condenses XML, and optionally validates/auto-repairs against schemas and redlining rules. It also supports .pptx and .xlsx outputs, which exceed the stated Word-only scope. While .docx support overlaps partially, the primary behavior is materially different from the declared purpose, so this is a mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The declared description says this skill processes Word documents directly (.docx creation, reading, editing, formatting, tables, images). However, the supplied code chunk is not document-processing logic. It is infrastructure code for running LibreOffice safely in sandboxed environments by detecting blocked AF_UNIX sockets, compiling a native shim, and preloading it into the soffice process. While this may support document conversion or office automation indirectly, the primary behavior shown is environment/runtime manipulation and subprocess execution, not Word document operations. That is a materially different purpose and includes undeclared capabilities such as runtime native compilation and LD_PRELOAD-based process injection.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding
The declared description suggests a general Word document manipulation skill focused on .docx content and features like formatting, tables, and images. The supplied code instead is a utility for unpacking Office Open XML containers and normalizing their internal XML representation. Its primary purpose is archive extraction and XML preprocessing, not direct document authoring or editing. It also supports PowerPoint and Excel files, which are outside the declared Word-only scope. While the DOCX-specific XML cleanup could support document editing workflows, the actual behavior is materially narrower and lower-level than the declared purpose, so this is a mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared description says this skill processes Word documents by creating, reading, and editing them, with support for formatting, tables, and images. The supplied code instead provides a CLI tool for validating Office document internals, including unpacking Office zip containers, running DOCX/PPTX schema validation, optional redlining validation, and limited XML auto-repair. This is a materially different primary purpose from document authoring/editing. It also extends beyond the declared Word-only scope by handling PPTX and XLSX file types. Therefore the description does not accurately represent the code’s actual behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding
The declared description focuses on Word document manipulation features: creating, reading, editing, formatting, tables, and images for .docx files. The actual code chunk is an __init__.py for validator modules, exporting BaseSchemaValidator, DOCXSchemaValidator, PPTXSchemaValidator, and RedliningValidator. This indicates a validation-oriented component, not a document-processing implementation. It also references PPTX and redlining, which are outside the stated Word/.docx-only scope. While this may be part of a larger office-processing package, the supplied code chunk itself materially differs from the declared purpose.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The declared description says the skill creates, reads, and edits Word .docx documents, emphasizing document authoring/manipulation features like formatting, tables, and images. The supplied code does not implement document creation or general editing. Instead, it is a validator for unpacked OOXML packages, with checks for XML well-formedness, namespaces, unique IDs, references, relationship IDs, content types, and XSD compliance. It also covers not just Word but also PowerPoint and Excel structures via schema mappings and namespaces. A small repair function exists, but it only adds xml:space='preserve' where needed, which is far narrower than general Word document editing. Therefore the code's primary purpose is materially different from the declared purpose.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared description suggests a broad end-user Word document processing feature set (create/read/edit .docx, formatting, tables, images). The code chunk instead provides a narrow validator for DOCX XML contents and schema-like constraints, plus a small repair routine for durableId values. While it is related to Word documents and .docx internals, its primary purpose is validation of document structure rather than document authoring or editing. This is a material description-behavior mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
There is a clear description-behavior mismatch. The declared purpose says the skill handles Word documents (.docx) for creation, reading, and editing with support for formatting, tables, and images. The supplied code is specifically a PPTXSchemaValidator for PowerPoint files, working on unpacked presentation XML and validating slide-related relationships and schema rules. Its primary purpose is validation of PowerPoint presentation package structure, not Word document manipulation. This is a materially different file type, domain, and capability set from what was declared.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding
The description promises a broad Word document processing skill for creating, reading, and editing .docx files, including formatting, tables, and images. The supplied code does not implement those general document operations. Instead, it specifically validates tracked changes in WordprocessingML by parsing document.xml, checking <w:ins>/<w:del> elements for a given author, unpacking the original .docx ZIP, normalizing/removing that author's tracked changes, comparing resulting text, and optionally invoking git diff for diagnostics. This is a materially different primary purpose: redlining validation rather than general Word document processing. While it is related to Word documents, the implemented capability is narrower and different enough that the declared description does not accurately represent the actual behavior.

Hidden Instructions

High
Category
Prompt Injection
Content
**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 |
Confidence
70% confidence
Finding
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Hidden Instructions

High
Category
Prompt Injection
Content
```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>
Confidence
70% confidence
Finding
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Context-Inappropriate Capability

High
Confidence
93% confidence
Finding
The skill embeds and executes a LibreOffice Basic macro to operate on documents, adding executable macro capability to a feature advertised as normal Word document processing. Executing application macros on the host significantly increases risk because it introduces script execution inside a complex desktop suite and may enable persistence, profile abuse, or interaction with untrusted documents in ways users would not expect from the stated scope.

Env Variable Harvesting

High
Category
Data Exfiltration
Content
def get_soffice_env() -> dict:
    env = os.environ.copy()
    env["SAL_USE_VCLPLUGIN"] = "svp"

    if _needs_shim():
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.

Lp3

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding
The skill clearly instructs use of shell commands, file reads/writes, and document unpack/repack workflows, but it declares no explicit tool scope or allowed-tools. That creates unnecessary ambient authority and reduces reviewability, making it easier for the skill to invoke powerful capabilities without operator awareness.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger words include very broad everyday terms like 'Word' and '文档', which can cause the skill to activate in unrelated conversations and gain access to file/shell workflows unexpectedly. Overbroad activation increases the chance of accidental invocation on sensitive content or in contexts where document-manipulation tools should not run.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
The instruction to use a fixed author name ('Claude') for tracked changes and comments alters document provenance without user consent. In legal, HR, academic, or audit-sensitive workflows, this can misattribute edits, undermine trust, and create integrity or compliance issues.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
]

    try:
        result = subprocess.run(
            cmd,
            capture_output=True,
            text=True,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Description-Behavior Mismatch

Medium
Confidence
89% confidence
Finding
The script modifies the host LibreOffice user profile under /tmp and installs a macro as part of ordinary document handling, which exceeds straightforward DOCX read/edit behavior and introduces persistent host-side state. That broadens the attack surface and can create cross-run interference, especially in shared or multi-tenant environments where another process could tamper with the profile or benefit from the installed macro.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
return True

    if not macro_dir.exists():
        subprocess.run(
            [
                "soffice",
                "--headless",
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Missing User Warnings

Medium
Confidence
86% confidence
Finding
The script writes a macro file into a LibreOffice profile and copies/modifies the output DOCX without any explicit consent or warning beyond normal function behavior. Silent host-state modification is dangerous in agent or automation contexts because operators may assume the tool only transforms the target document, not that it also installs executable artifacts on the system.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The function writes modified XML back to the input path in place, changing document contents without any confirmation prompt, visible log/print, or explicit warning in this file about the destructive nature of the operation. Because this alters user document data directly, users may not realize the original file contents are being overwritten.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
Setting LD_PRELOAD causes the target process to load attacker-influenceable native code before its normal libraries. In this file, the preload target is a shared object placed in the temp directory, making the document-processing path significantly more dangerous because compromise of that file yields code execution whenever soffice runs.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
def run_soffice(args: list[str], **kwargs) -> subprocess.CompletedProcess:
    env = get_soffice_env()
    return subprocess.run(["soffice"] + args, env=env, **kwargs)
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
Generating C code and compiling it during normal execution is dangerous because it expands the trust boundary from Python to the system compiler, loader, and writable temp storage. In this skill context, the compiled artifact is immediately used for process injection, so any tampering of the temp source or shared object can turn document processing into arbitrary native code execution.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
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,
Confidence
95% confidence
Finding
The code writes C source to a world-writable temporary directory and invokes gcc to compile a shared object that is later injected with LD_PRELOAD. Even though the embedded source is constant, using predictable temp-file paths creates a race/symlink attack surface where a local attacker could replace the source or output path and obtain arbitrary code execution in the soffice process context.

Static analysis

No suspicious patterns detected.