Back to skill

Security audit

Exwind Monitor

Security checks for vulnerabilities and agentic risk

Overview

This skill appears to be a legitimate EXWIND update monitor, but its scheduled execution, Feishu posting, shell command wrapper, and shared /tmp state file need review before installation.

Install only if you want an automatic EXWIND monitor that periodically opens the site, writes local state, and sends Feishu messages. Review or harden the script first if this will run on a shared machine: move the state file out of /tmp, avoid shell=True, and confirm the Feishu destination and cron controls.

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
scripts/exwind_monitor.py:16
Finding

Predictable Shared Temporary State File Allows Symlink-Based File Overwrite

Content
View full analysis

Vulnerability Details

File Location: scripts/exwind_monitor.py, lines 16 and 59–61
Vulnerability Type: Insecure temporary-file handling and symlink following
Risk Level: Medium

Vulnerable Code

python
STATE_FILE = Path("/tmp/exwind_state.json")
python
def save_state(state: dict):
    state["seen_ids"] = state["seen_ids"][-500:]
    STATE_FILE.write_text(json.dumps(state, ensure_ascii=False, indent=2))

Technical Analysis

The monitor stores its state at a fixed, predictable path in the globally writable /tmp directory. Before writing, it does not verify the file type, ownership, permissions, or whether the path is a symbolic link. Path.write_text() follows symbolic links and truncates the resolved target.

On a multi-user system, another local user may create /tmp/exwind_state.json as a symbolic link to a file writable by the account running the monitor. A later scheduled execution calls save_state(), follows that link, and overwrites the target with JSON state data.

The same weakness also permits direct tampering with monitor state. An attacker able to control this path can insert article IDs to suppress notifications, remove IDs to cause duplicate notifications, or provide malformed JSON to force state reinitialization.

Attack Path

  1. A local attacker determines the predictable state path: /tmp/exwind_state.json.
  2. Before the monitor writes its state, the attacker creates that path as a symbolic link to another file writable by the monitor's operating-system account.
  3. The scheduled monitor parses EXWIND and invokes save_state().
  4. Path.write_text() follows the symbolic link and truncates or replaces the target file contents with state JSON.
  5. Depending on the selected target, this causes file corruption or modifies an Agent-owned configuration or data file.

Alternatively, the attacker creates or edits the state file directly and manipulates `seen ...[truncated 657 chars]

Remediation
View remediation

Remediation Suggestions

  1. Move the state file out of the shared temporary directory and into an application-specific private state directory, such as ~/.local/state/exwind-monitor/state.json.
  2. Create the parent directory with mode 0700 and verify that it is owned by the expected user.
  3. Reject symbolic links and unexpected file types before reading or replacing state.
  4. Use secure, atomic writes: create a temporary file in the same private directory with restrictive mode 0600, flush and synchronize it, and then call os.replace() to publish it atomically.
  5. Where supported, open files using os.open() with O_NOFOLLOW, O_CREAT, and appropriate exclusive-access flags.
  6. Validate loaded state against the expected schema, including requiring seen_ids to be a bounded list of valid article identifier strings.
  7. Run the monitor as an unprivileged, dedicated account so any file-write impact remains limited.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (4)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

This is a true tool-parameter abuse issue because a generic command runner executes shell commands and open_page() builds those commands using string interpolation. In an agent skill context, tool wrappers are especially sensitive: any future dynamic input, compromised config, or reused helper could let untrusted data steer shell execution and break out of the intended browser-only action.

Content

Scanner excerpt · scripts/exwind_monitor.py (reported line 23)May include surrounding context.

python
def run_cmd(cmd: str, timeout: int = 30) -> tuple[bool, str]:
    try:
        result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=timeout)
        return result.returncode == 0, result.stdout + result.stderr
    except Exception as e:
        return False, str(e)

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
97% confidence
Finding

The helper wraps subprocess.run with shell=True and accepts an arbitrary command string, which is then used by open_page() to interpolate a URL directly into a shell command. If the URL or future command inputs become attacker-controlled, this creates a command-injection path that can execute arbitrary OS commands with the script's privileges.

Content

Scanner excerpt · scripts/exwind_monitor.py (reported line 23)May include surrounding context.

python
def run_cmd(cmd: str, timeout: int = 30) -> tuple[bool, str]:
    try:
        result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=timeout)
        return result.returncode == 0, result.stdout + result.stderr
    except Exception as e:
        return False, str(e)

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The helper executes shell commands with subprocess.run(..., shell=True), and it is used to open and close an external browser agent. While shell execution is central to the implementation, the code provides no explicit warning or explanatory comment that it will invoke external commands on the user's system.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code writes persistent state to /tmp/exwind_state.json, which affects the local filesystem. Although the module docstring describes monitoring behavior, it does not disclose that the script creates and updates a state file, and there is no confirmation or nearby warning comment for this file write.

Content

No source excerpt is available for this finding.