T05 · Unauthorized Access and Privilege Escalation
- Location
- scripts/desktop_ctrl.py:184
- Finding
- Numeric PID Input Bypasses the Process Termination Allowlist<![CDATA[ ## Vulnerability Details **File Location**: `scripts/desktop_ctrl.py:184-196` **Vulnerability Type**: Process termination authorization bypass **Risk Level**: High ### Vulnerable Code ```python protected_pids = [0, 4] if name_or_pid.isdigit(): if int(name_or_pid) in protected_pids: return {"success": False, "error": "Termination of system processes is prohibited"} ps = f'Stop-Process -Id {name_or_pid} -Force -ErrorAction Stop' else: name_lower = name_or_pid.lower().replace('.exe', '') if name_lower not in ALLOWED_PROCESSES: return { "success": False, "error": f"Only allowlisted processes may be terminated: {', '.join(ALLOWED_PROCESSES)}" } ps = f'Stop-Process -Name "{name_or_pid}" -Force -ErrorAction Stop' subprocess.run( ["powershell", "-ExecutionPolicy", "Bypass", "-NoProfile", "-Command", ps], check=True, timeout=10 ) ``` The messages above are translated into English for reporting; the control flow and executable statements correspond to lines 184-196. ### Technical Analysis The documented process-name allowlist is enforced only when the argument is not numeric. When a PID is supplied, the implementation checks only whether it is PID 0 or PID 4. It does not resolve the PID to its executable and verify that executable against `ALLOWED_PROCESSES`. Consequently, the caller can use the `processes` command to discover PIDs and then forcibly terminate any accessible process other than the two explicitly protected PIDs. PowerShell executes with the current Skill process token; this does not itself elevate privileges, but it exceeds the documented and intended process-control boundary. ### Attack Path 1. Invoke `python scripts/desktop_ctrl.py processes` to enumerate running processes and PIDs. 2. Select the PID of an application, service, security product, or other process outside the name allowlist. 3. Invoke `python scripts/desktop_ctrl.py kill <PID>`. 4. The numer ...[truncated 643 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not treat numeric PIDs as independently authorized targets. - Resolve the PID to its executable name and normalized executable path before termination. - Apply the same allowlist to both process names and PIDs. - Explicitly deny critical Windows processes, services, security products, and processes owned by other users. - Prefer exact executable-path allowlisting rather than process-name-only allowlisting. - Require explicit user confirmation containing the resolved process name, PID, owner, and path before termination. - Avoid `-Force` unless it is necessary for the declared operation. - Run the Skill without administrative privileges and record process-termination attempts in an audit log. ]]>
