T09 · Insecure Skill Coding Practices
- Location
scripts/window.ps1:389- Finding
Closing One Window Can Force-Terminate Unrelated Application Instances
- Content
View full analysis
Vulnerability Details
File Location:
scripts/window.ps1:389-404
Vulnerability Type: Overbroad process termination
Risk Level: HighVulnerable Code
powershell $closed = $proc.WaitForExit(3000) ... if($closed){ Write-Output "Closed: ""$($win.Title)"" (PID=$($win.WinPID))" } else { $procName = $proc.ProcessName Write-Warning "Graceful close failed ($procName is UWP or has unsaved content?). Force-closing PID=$($win.WinPID)." taskkill /PID $($win.WinPID) /F /T 2>&1 | Out-Null Start-Sleep -Milliseconds 300 Get-Process -Name $procName -ErrorAction SilentlyContinue | Where-Object { $_.Id -ne $PID } | ForEach-Object { try { taskkill /PID $($_.Id) /F /T 2>&1 | Out-Null } catch {} } Start-Sleep -Milliseconds 400 }Technical Analysis
The
closeaction first requests graceful termination and waits for only three seconds. If the process does not exit during that interval, the script automatically escalates totaskkill /F /T, forcibly terminating the selected process and its process tree.After that, it enumerates every process with the same image name and force-terminates those processes as well. The only excluded PID is the PowerShell process running the Skill. There is no verification that the additional processes are descendants of, or otherwise associated with, the selected window.
A normal unsaved-content dialog, slow shutdown, or temporarily unresponsive application can therefore trigger termination of unrelated application instances. This behavior also conflicts with the documented rule requiring confirmation before destructive window or process operations.
Attack Path
- A user or Agent invokes the
closeaction for one application window. - The selected application displays an unsaved-content prompt, takes longer than three seconds to exit, or does not respond to the graceful close request.
- The script force-terminates the selected PID and its child processes.
- The script ...[truncated 787 chars]
- A user or Agent invokes the
- Remediation
View remediation
Remediation Suggestions
- Remove automatic forced termination from the ordinary
closeaction. - If graceful closure times out, return an error explaining that the application may have unsaved content.
- Introduce a separate, explicitly named
force-closeaction that requires clear user confirmation. - Remove the same-image-name cleanup logic entirely.
- If child-process cleanup is necessary, identify and terminate only verified descendants of the selected PID.
- Do not use executable-name equality as evidence that processes belong to the same application session.
- Increase observability by reporting the selected PID, window title, timeout, and pending confirmation before any forced termination.
- Preserve save prompts and allow the user to decide whether unsaved content should be discarded.
- Remove automatic forced termination from the ordinary
