Skip to content

security: fix command injection in open_url via malicious homepage URL#31

Merged
shanselman merged 1 commit intomainfrom
fix/sec-cmd-injection-open-url-v2
Mar 18, 2026
Merged

security: fix command injection in open_url via malicious homepage URL#31
shanselman merged 1 commit intomainfrom
fix/sec-cmd-injection-open-url-v2

Conversation

@shanselman
Copy link
Copy Markdown
Owner

Security Fix: Command injection via open_url

Severity: High (all 3 models agreed: Codex, Gemini, Opus)

The Vulnerability

open_url used cmd /c start "" <url> to open package homepages. On Windows, cmd.exe interprets &, |, > as command separators. A malicious package homepage like https://x.com&powershell -c malicious executes arbitrary code when the user presses o.

The Fix

  • Replace cmd /c start with explorer.exe on Windows (no shell metacharacter interpretation)
  • Validate URLs must start with http:// or https:// before opening
  • Show status message if URL validation fails

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@shanselman shanselman merged commit 85e6317 into main Mar 18, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant