Substring origin match when allowed_origins or allowed_top_origins is a String
Published: December 01, 2026
SECURITY IDENTIFIERS
- GHSA: GHSA-97v8-p42x-qfhv
- Vendor Advisory: https://github.com/cedarcode/webauthn-ruby/security/advisories/GHSA-97v8-p42x-qfhv
GEM
SEVERITY
CVSS v3.x: 4.2 (Medium)
UNAFFECTED VERSIONS
< 3.4.0
PATCHED VERSIONS
~> 3.4.5
>= 3.5.2
DESCRIPTION
Summary
When an application sets allowed_origins or allowed_top_origins to
a String instead of an Array, origin verification matches
substrings. A client origin or top origin that is a prefix of the
configured value, such as https://login.example.co for
https://login.example.com, passes verification.
Details
Origin verification uses include? on the configured values:
valid_origin?callsexpected_origin.include?(client_data.origin), whereexpected_originisallowed_origins.valid_top_origin?callsrelying_party.allowed_top_origins&.include?(client_data.top_origin).
Both settings are documented as Arrays, but WebAuthn::RelyingParty
stored them without checking their type. When the value is a String,
String#include? does a substring match instead of an exact one.
Impact
Only applications that set allowed_origins or allowed_top_origins
to a String are affected, either through the global configuration or
through WebAuthn::RelyingParty.new. In 3.4.x, only allowed_origins
is affected, because allowed_top_origins was added in 3.5.0.
The practical impact is limited:
allowed_origins: the authenticator data must still match the configured RP ID, and browsers only let a page use an RP ID that matches its own domain. A page on a lookalike origin such ashttps://login.example.cocannot get a browser to create or use credentials forexample.com.allowed_top_origins(only whenverify_cross_originis enabled): a page on a lookalike domain could embed the relying party's WebAuthn page in an iframe and pass the top-origin check. This requires the relying party's page to allow being framed by any site. The confidentiality score assumes an application whose embedded page sends authentication results, such as a token, to its parent page.
Workarounds
If you can't upgrade right away, set both settings to an Array:
WebAuthn.configure do |config|
config.allowed_origins = ["https://login.example.com"]
config.allowed_top_origins = ["https://app.example.com"]
end
