GHSA-47hv-j4px-h3c9: Go/github.com/wailsapp/wails/v2 vulnerability
Security Vulnerability Report: Wails v2 — Origin Validator Bypass via Wildcard Pattern
| | | |---|---| | Product | wailsapp/wails (v2) | | Affected File | v2/internal/frontend/originvalidator/originValidator.go | | Affected Versions | All versions containing originValidator (latest as of 2026-03-26) | | CVSSv4.0 | 7.6 HIGH — CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:L/SC:L/SI:L/SA:N | | CWE | CWE-625: Permissive Regular Expression | | Platforms | Windows / Linux / macOS (all desktop targets) |
---
Summary
Wails v2 provides BindingsAllowedOrigins to restrict which web origins can invoke Go backend methods via IPC. The wildcard pattern matching in wildcardPatternToRegex converts to . without anchoring subcomponents, allowing suffix-matched origins to bypass the restriction.
An attacker who controls a domain sharing a prefix with the allowed origin (e.g., myapp.community when myapp.com is configured) can invoke arbitrary bound Go methods, potentially achieving file system access, data exfiltration, or code execution depending on the application's exposed API surface.
---
Vulnerability Details
Root Cause
wildcardPatternToRegex converts a wildcard pattern to a regular expression by escaping special characters and replacing with .. The substituted . has no restriction — it matches any character sequence including dots and additional domain components.
Vulnerable Code
File: v2/internal/frontend/originvalidator/originValidator.go
go func (v OriginValidator) wildcardPatternToRegex(wildcardPattern string) string { specialChars := []string{"\\", ".", "+", "?", "^", "$", "{", "}", "(", ")", "|", "[", "]"}
escaped := wildcardPattern for , specialChar := range specialChars { escaped = strings.ReplaceAll(escaped, specialChar, "\\"+specialChar) }
// becomes . — matches ANY character sequence, including dots and domain separators escaped = strings.ReplaceAll(escaped, "", ".")
return "^" + escaped + "$" }
The generated regex for https://myapp.com is:
^https://myapp\.com.$
This matches any string beginning with https://myapp.com, including:
- https://myapp.community — different TLD - https://myapp.com.attacker.com — attacker-controlled subdomain - https://myapp.comXXXXX — any arbitrary suffix
Scope Note
The official comment in options.go gives https://.myapp.com as the example pattern (subdomain prefix wildcard). This pattern is not affected. The vulnerability only manifests when developers use a trailing wildcard (myapp.com), which is a natural misuse when intending to permit a domain and all its subpaths or ports.
---
Impact
Any Go method registered with Wails bindings becomes callable from the attacker's origin. Depending on the application:
- File system read / write (common in desktop apps) - Database queries - OS command execution (if exposed via bindings) - Sensitive configuration or credential access
---
Fix
PR: https://github.com/wailsapp/wails/pull/5074
Wildcards are now only expanded when they represent a full domain component (immediately after ://, ., or :). A wildcard appended to a partial label (e.g. com) is stripped, preventing suffix-based bypasses. Comprehensive test suite added.
---
Disclosure Timeline
| Date | Event | |---|---| | 2026-03-26 | Vulnerability discovered during source code audit by @Saku0512 | | 2026-03-26 | Private report submitted via GitHub Security Advisory | | 2026-03-26 | Vendor acknowledgement and fix PR opened (#5074) | | TBD | Patch release | | TBD + 90 days | Public disclosure deadline |
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/wailsapp/wails/v2to a version that resolves this vulnerability.Fixed in 2.13.0 - Configuration
Replace trailing partial-label wildcard patterns such as `https://myapp.com*` with a full domain-component wildcard such as `https://*.myapp.com`; do not use a wildcard appended directly to a domain label.
Wails v2 BindingsAllowedOrigins = https://*.myapp.com
Event History
Frequently Asked Questions
Which applications are affected in practice?
Wails v2 applications on Windows, Linux, or macOS are affected if they contain originValidator and use BindingsAllowedOrigins with a wildcard pattern whose matching can be bypassed. The report identifies all versions containing originValidator as affected.
What does an attacker need to exploit this issue?
The attacker needs to control an origin whose domain shares a prefix with an allowed wildcard origin, such as myapp.community when myapp.com* is allowed. The CVSS vector indicates network reachability, no privileges, low attack complexity, and required user interaction.
How can I identify risky origin allowlist entries?
Review BindingsAllowedOrigins settings for wildcard patterns, especially patterns that append * to an origin or domain prefix. These patterns may match attacker-controlled suffixes because * is converted to .* without anchoring subcomponents.
What determines the impact if the origin check is bypassed?
Impact depends on the Go methods the application exposes through IPC. A successful bypass can let the untrusted origin invoke arbitrary bound Go methods, potentially enabling file-system access, data exfiltration, or code execution.