RubySec

Providing security resources for the Ruby community

GHSA-97v8-p42x-qfhv (webauthn): Substring origin match when allowed_origins or allowed_top_origins is a String

Substring origin match when allowed_origins or allowed_top_origins is a String

Published: December 01, 2026

SECURITY IDENTIFIERS

GEM

webauthn

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? calls expected_origin.include?(client_data.origin), where expected_origin is allowed_origins.
  • valid_top_origin? calls relying_party.allowed_top_origins&amp;.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 as https://login.example.co cannot get a browser to create or use credentials for example.com.
  • allowed_top_origins (only when verify_cross_origin is 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 = [&quot;https://login.example.com&quot;]
  config.allowed_top_origins = [&quot;https://app.example.com&quot;]
end

RELATED