Severity:

HIGH RISK

(7.1)

Command Injection (CWE-77) via webbrowser.open URLs

CVE-2026-4786

Awaiting Analysis

Vulnerability type

Category:

Command Injection

CWE:

CWE-77, CWE-88

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(7.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

An incomplete mitigation allows specially crafted URLs containing "%action" to bypass prior protections and inject commands through the webbrowser.open() API.

Under certain browser configurations, this can result in command injection into the underlying shell when untrusted URLs are processed by the application.

Affected context

This vulnerability arises in applications that rely on Python's webbrowser.open() (or similar APIs) to launch user-supplied or externally controlled URLs.

It is most relevant where:

  • URL values can be influenced by untrusted input
  • The environment uses browser handlers or shell-based commands that interpret URL fragments
  • Prior filtering or mitigation logic is applied but does not fully sanitize special sequences such as "%action"

Exploit preconditions

  • Attack surface: Any feature that opens URLs via webbrowser.open() or equivalent OS/browser integration.
  • Required access: Ability to supply or control URL values (e.g., query parameters, HTTP headers, deep links, or configuration entries).
  • Trigger point: Invocation of webbrowser.open() with a crafted URL containing "%action" on affected browser types.
  • Why exploitation is possible: Incomplete input validation allows crafted URL sequences to bypass existing mitigation, leading to command injection into the shell that backs the browser integration.

Why this happens

The root cause is a partial fix for a command injection issue that failed to account for all dangerous input patterns.

The application trusts URL strings passed into webbrowser.open() and relies on mitigations that do not correctly neutralize sequences such as "%action" which, under certain browser or OS handlers, are transformed into shell commands.

Conceptually, this maps to CWE-77: Command Injection and CWE-88: Argument Injection or Modification, where user-controlled data is embedded into command or argument contexts without rigorous sanitization and separation.

Potential impact

  • Attackers may execute arbitrary commands in the context of the application's user or service account.
  • Sensitive data on the host may be read or modified.
  • Local files or configurations could be altered, leading to system instability or data loss.
  • Further compromise of the environment may occur through installation of malware or backdoors.
  • The application's integrity and trustworthiness can be undermined by unauthorized actions triggered through URL handling.

General mitigation guidance

Mitigation focuses on eliminating the possibility of user-controlled data influencing shell or command invocations through URL handling.

Recommended patterns include:

  • Treat URLs as opaque data and avoid passing them through shell-constructed commands; use API-level browser integration that does not rely on shell parsing.
  • Implement strict validation and encoding for URLs, rejecting or removing dangerous sequences such as "%action" and other metacharacters before use.
  • Centralize URL handling logic with a well-reviewed, minimal, allow-list-based parser that only permits known-safe schemes and formats.
  • Run browser-opening or helper processes with least privilege to reduce the impact of any unexpected command execution.
  • Design features so that untrusted URLs are never directly translated into command arguments or shell snippets, favoring high-level APIs instead.

How teams detect issues like this

Effective detection relies on both code-level and behavioral analysis:

  • Use static analysis rules to flag usages of webbrowser.open() or similar APIs where arguments derive from untrusted input without robust validation.
  • During code review, look for mitigation logic that handles only some patterns (e.g., specific substrings) rather than enforcing comprehensive normalization or allow-listing.
  • Implement logging around URL handling and browser invocation paths, then monitor for unusual or malformed URL patterns, including "%action" and other control sequences.
  • Apply security policy checks in CI/CD pipelines that disallow constructing shell commands with user-controlled URL fragments or environment-dependent browser handlers.

Sources

SourceLink
github.comgithub.com/python/cpython/commit/28b4ad38067bbdad34edfcd03ad2de5f06387e53
github.comgithub.com/python/cpython/commit/a4d3edf3a6ecfde504d02126410d2a65a859b744
github.comgithub.com/python/cpython/commit/c5767a72838a8dda9d6dc5d3558075b055c56bca
github.comgithub.com/python/cpython/commit/d22922c8a7958353689dc4763dd72da2dea03fff
github.comgithub.com/python/cpython/commit/d6d68494be70bdbda20f89f83801ba52ec37daa4
github.comgithub.com/python/cpython/commit/f4654824ae0850ac87227fb270f9057477946769
github.comgithub.com/python/cpython/issues/148169
github.comgithub.com/python/cpython/pull/148170
mail.python.orgmail.python.org/archives/list/security-announce@python.org/thread/JQDUNJVB4AQNTJECSUKOBDU3XCJIPSE5/
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10117
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10140
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10141
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10711
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10745
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10774
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10949
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10950
access.redhat.comaccess.redhat.com/errata/RHSA-2026:11062
access.redhat.comaccess.redhat.com/errata/RHSA-2026:11077
access.redhat.comaccess.redhat.com/errata/RHSA-2026:11768
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13692
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13812
access.redhat.comaccess.redhat.com/errata/RHSA-2026:14652
access.redhat.comaccess.redhat.com/errata/RHSA-2026:14653
access.redhat.comaccess.redhat.com/errata/RHSA-2026:14656
access.redhat.comaccess.redhat.com/errata/RHSA-2026:16699
access.redhat.comaccess.redhat.com/errata/RHSA-2026:17525
access.redhat.comaccess.redhat.com/errata/RHSA-2026:17619
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19019
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19064
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19175
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19176
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19177
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19216
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19549
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19570
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19571
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19576
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19589
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19590
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21275
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21682
access.redhat.comaccess.redhat.com/errata/RHSA-2026:22144
access.redhat.comaccess.redhat.com/errata/RHSA-2026:25096
access.redhat.comaccess.redhat.com/errata/RHSA-2026:26187
access.redhat.comaccess.redhat.com/errata/RHSA-2026:28247
access.redhat.comaccess.redhat.com/errata/RHSA-2026:28581
access.redhat.comaccess.redhat.com/errata/RHSA-2026:30078
access.redhat.comaccess.redhat.com/errata/RHSA-2026:30087
access.redhat.comaccess.redhat.com/errata/RHSA-2026:30088
access.redhat.comaccess.redhat.com/errata/RHSA-2026:30089
access.redhat.comaccess.redhat.com/errata/RHSA-2026:35838
access.redhat.comaccess.redhat.com/errata/RHSA-2026:8822
access.redhat.comaccess.redhat.com/errata/RHSA-2026:8824
access.redhat.comaccess.redhat.com/errata/RHSA-2026:9228
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-4786
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2458049
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-4786.json

Frequently asked

questions

Yes, if an attacker can supply URLs to an affected application over the network (e.g., via HTTP inputs, links, or configuration), they may be able to trigger command injection remotely, subject to deployment topology and access controls.

The attacker needs the ability to influence the URL parameter passed to webbrowser.open() or similar browser-opening functionality. They do not generally need local shell access, only control over the data that drives the URL handling.

The safest approach is to avoid any shell-based command construction from untrusted input, treat URLs as data only, and use high-level browser or OS APIs that do not depend on shell interpretation. Combine this with strict allow-list validation of URL schemes and formats.

Adopt secure coding guidelines that forbid embedding user input into command lines, require central URL validation utilities, and mandate security review for any interface that launches external programs or browsers based on dynamic data. Reinforce these practices with automated static analysis, code review checklists, and policy enforcement in development workflows.

Find out what's already
exploitable in your codebase.