CVE-2024-39912: Web auth/webauthn lib The FIDO2/Webauthn Support For PHP Vulnerability

MODERATE
Advisory Identifier: GHSA-875x-g8p7-5w27
CVSS 5.3
CWE-204
Published
Advisory Summary

CVE-2024-39912 is a MODERATE (CVSS 5.3) the fido2/webauthn support for php vulnerability (CWE-204: Observable Response Discrepancy) affecting Web auth/webauthn lib libraries in the Packagist ecosystem. The issue involves the fido2/webauthn support for php library allows enumeration of valid usernames. Remediation is available by upgrading affected packages to version 4.9.0.

CVE-2024-39912 at a Glance

CVE Identifier CVE-2024-39912
GHSA Identifier GHSA-875x-g8p7-5w27
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-204: Observable Response Discrepancy
Affected Product Web auth/webauthn lib
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-39912

To remediate this vulnerability, upgrade all affected Web auth/webauthn lib dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

web-auth/webauthn-lib fixed: 4.9.0
Upgrade web-auth/webauthn-lib to 4.9.0
web-auth/webauthn-framework fixed: 4.9.0
Upgrade web-auth/webauthn-framework to 4.9.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for web-auth/webauthn-lib

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-39912, inspect your project dependencies for Web auth/webauthn lib:

inspect dependencies for web-auth/webauthn-lib

Analyze the terminal output to locate any version of Web auth/webauthn lib in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.9.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-204: Observable Response Discrepancy, where the product provides different responses to incoming requests in a way that reveals internal state information to an unauthorized actor outside of the intended control sphere. In Web auth/webauthn lib, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The ProfileBasedRequestOptionsBuilder method returns allowedCredentials without any credentials if no username was found. ### Details When WebAuthn is used as the first or only authentication method, an attacker can enumerate usernames based on the absence of the `allowedCredentials` property in the assertion options response. This allows enumeration of valid or invalid usernames. #### Proposal how to resolve it: ``` return $this->publicKeyCredentialRequestOptionsFactory->create( $this->profile, count($allowedCredentials) <= 0 ? self::getRandomCredentials(): $allowedCredentials, $optionsRequest->userVerification, $extensions ); private static function getRandomCredentials(): array { $credentialSources = []; for ($i = 0; $i <= rand(0,1); $i++) { $credentialSources[] = new PublicKeyCredentialSource( random_bytes(32), "public-key", [], "basic", new EmptyTrustPath(), Uuid::v7(), random_bytes(77), Uuid::v7()->__toString(), rand(0, 6000), null ); } return array_map( static fn (PublicKeyCredentialSource $credential): PublicKeyCredentialDescriptor => $credential->getPublicKeyCredentialDescriptor(), $credentialSources ); } ``` ### PoC curl https://example.com/assertion/options \ -H 'content-type: application/json' \ --data-raw '{"username":"NotMeRandomUsername123"}' ### Impact By knowing which usernames are valid, attackers can focus their efforts on a smaller set of potential targets, increasing the efficiency and likelihood of successful attacks.

CVE-2024-39912 Affected Web auth/webauthn lib Versions

2 component(s)
Fixed Versions:
4.9.0
Product / Package Ecosystem Affected Versions Fixed Version
web-auth/webauthn-lib
Packagist
≥ 4.5.0
< 4.9.0
4.9.0
web-auth/webauthn-framework
Packagist
≥ 4.5.0
< 4.9.0
4.9.0

References

Frequently Asked Questions

What is CVE-2024-39912?
CVE-2024-39912 is a security vulnerability in Web auth/webauthn lib involving The FIDO2/Webauthn Support for PHP library allows enumeration of valid usernames under CWE-204: Observable Response Discrepancy.
Which Web auth/webauthn lib versions are affected?
Affected versions include releases prior to 4.9.0 across affected packages: web-auth/webauthn-lib, web-auth/webauthn-framework.
What version fixes CVE-2024-39912?
Upgrading to 4.9.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is web-auth/webauthn-lib affected?
Yes, web-auth/webauthn-lib is affected in releases prior to 4.9.0. Upgrade your dependency to 4.9.0 or later.
Is web-auth/webauthn-framework affected?
Yes, web-auth/webauthn-framework is affected in releases prior to 4.9.0. Upgrade your dependency to 4.9.0 or later.
What is the CVSS score of CVE-2024-39912?
CVE-2024-39912 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2024-39912?
CVE-2024-39912 is classified under CWE-204: Observable Response Discrepancy (The product provides different responses to incoming requests in a way that reveals internal state information to an unauthorized actor outside of the intended control sphere.).
How can I check Packagist dependencies for CVE-2024-39912?
Run the dependency tree command: 'inspect dependencies for web-auth/webauthn-lib'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-875x-g8p7-5w27",
  "modified" : "2024-07-15T21:38:21Z",
  "published" : "2024-07-15T16:37:49Z",
  "aliases" : [ "CVE-2024-39912" ],
  "summary" : "The FIDO2/Webauthn Support for PHP library allows enumeration of valid usernames ",
  "details" : "### Summary\n\nThe ProfileBasedRequestOptionsBuilder method returns allowedCredentials without any credentials if no username was found.\n\n### Details\n\nWhen WebAuthn is used as the first or only authentication method, an attacker can enumerate usernames based on the absence of the `allowedCredentials` property in the assertion options response. This allows enumeration of valid or invalid usernames.\n\n#### Proposal how to resolve it:\n \n```\nreturn $this->publicKeyCredentialRequestOptionsFactory->create(\n            $this->profile,\n            count($allowedCredentials) <= 0 ? self::getRandomCredentials(): $allowedCredentials,\n            $optionsRequest->userVerification,\n            $extensions\n);\n\nprivate static function getRandomCredentials(): array\n{\n        $credentialSources = [];\n        for ($i = 0; $i <= rand(0,1); $i++) {\n            $credentialSources[] = new PublicKeyCredentialSource(\n                random_bytes(32),\n                \"public-key\",\n                [],\n                \"basic\",\n                new EmptyTrustPath(),\n                Uuid::v7(),\n                random_bytes(77),\n                Uuid::v7()->__toString(),\n                rand(0, 6000),\n                null\n            );\n        }\n        return array_map(\n            static fn (PublicKeyCredentialSource $credential): PublicKeyCredentialDescriptor => $credential->getPublicKeyCredentialDescriptor(),\n            $credentialSources\n        );\n}\n```\n\n### PoC\n\ncurl https://example.com/assertion/options \\\n  -H 'content-type: application/json' \\\n  --data-raw '{\"username\":\"NotMeRandomUsername123\"}'\n\n### Impact\n\nBy knowing which usernames are valid, attackers can focus their efforts on a smaller set of potential targets, increasing the efficiency and likelihood of successful attacks.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "web-auth/webauthn-lib"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.5.0"
      }, {
        "fixed" : "4.9.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "web-auth/webauthn-framework"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.5.0"
      }, {
        "fixed" : "4.9.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/web-auth/webauthn-framework/security/advisories/GHSA-875x-g8p7-5w27"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39912"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/web-auth/webauthn-framework/commit/64de11f6cddc71e56c76e0cc4573bf94d02be045"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/web-auth/webauthn-framework/commit/a9d1352897fba552e659e1445a771dec2d4ed05a"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/web-auth/webauthn-lib/commit/b6798de27cdedd8681fe4c9b13ace0ff2456d18b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/web-auth/webauthn-framework"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-204" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-15T16:37:49Z",
    "nvd_published_at" : "2024-07-15T20:15:03Z"
  }
}