Back to skill

Security audit

Niri IPC

Security checks for vulnerabilities and agentic risk

Overview

This Niri control skill is coherent, but it gives an agent broad compositor control, raw IPC access, and shell-spawn capability without strong safeguards.

Install only if you want an agent to control your active Niri desktop session. Treat raw IPC, close-window, config reload, output changes, and spawn-sh as high-impact operations; review commands before they run and prefer window IDs or exact matches for destructive actions.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The code is clearly related to Niri IPC control and is not doing anything unrelated or suspicious. However, the declared description claims a broader capability set than the provided code chunk actually implements. This chunk only supports window/workspace listing and a limited set of actions: focus window, close window, move window to workspace, and focus workspace. It does not implement outputs queries, focused-window queries, command spawning, config reload, or a generic raw IPC interface within this file. Because the evaluation asks whether the description accurately represents what the supplied code chunk actually does, this is a description-behavior mismatch due to materially overbroad declared functionality for the specific code shown.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises and instructs use of shell commands, environment-dependent IPC access via $NIRI_SOCKET, and command-spawning functionality, but it declares no explicit tool scope or permission boundaries. In an agent setting, that omission weakens policy enforcement and can allow the skill to be invoked with broader shell/environment access than a reviewer or orchestrator expects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly documents state-changing and potentially destructive actions such as closing windows, moving windows, reloading configuration, and spawning commands, yet provides no caution, confirmation guidance, or approval boundary. In an autonomous agent context, this increases the risk of accidental disruptive actions, data loss from closing unsaved applications, or abuse of the spawn interfaces to execute arbitrary commands in the user's session.

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/niri.py (reported line 90)May include surrounding context.

python
if ns.cmd == "event-stream":
        # Stream mode: do not attempt to parse; forward lines.
        cmd = ["niri", "msg", "--json", "event-stream"]
        p = subprocess.Popen(cmd, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        assert p.stdout is not None
        count = 0
        try:

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/niri.py (reported line 35)May include surrounding context.

python
def run_json(cmd: list[str]) -> Any:
    p = subprocess.run(cmd, text=True, capture_output=True)
    if p.stderr.strip():
        print(p.stderr.rstrip(), file=sys.stderr)
    if p.returncode != 0:

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/niri_ctl.py (reported line 32)May include surrounding context.

python
def run_json(cmd: list[str]) -> Any:
    p = subprocess.run(cmd, text=True, capture_output=True)
    if p.stderr.strip():
        print(p.stderr.rstrip(), file=sys.stderr)
    if p.returncode != 0:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The close command performs a destructive action immediately after a potentially broad substring match, with no confirmation prompt, dry-run mode, or stronger targeting requirement. In an agent-controlled context, ambiguous matches or prompt manipulation could cause unintended closure of the wrong window, leading to user disruption or data loss in unsaved applications.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.