CVE-2023-49087: Simplesamlphp/xml security Validation Of SignedInfo Vulnerability

HIGH
Advisory Identifier: GHSA-ww7x-3gxh-qm6r
CVSS 7.5
CWE-345
Published
Advisory Summary

CVE-2023-49087 is a HIGH (CVSS 7.5) validation of signedinfo vulnerability (CWE-345: Insufficient Verification of Data Authenticity) affecting Simplesamlphp/xml security libraries in the Packagist ecosystem. The issue involves validation of signedinfo. Remediation is available by upgrading affected packages to version 1.6.12, 5.0.0-alpha.13.

CVE-2023-49087 at a Glance

CVE Identifier CVE-2023-49087
GHSA Identifier GHSA-ww7x-3gxh-qm6r
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-345: Insufficient Verification of Data Authenticity
Affected Product Simplesamlphp/xml security
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 7.5

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:N/I:H/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 None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2023-49087

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

simplesamlphp/xml-security fixed: 1.6.12
Upgrade simplesamlphp/xml-security to 1.6.12
simplesamlphp/saml2 fixed: 5.0.0-alpha.13
Upgrade simplesamlphp/saml2 to 5.0.0-alpha.13
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 simplesamlphp/xml-security

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-49087, inspect your project dependencies for Simplesamlphp/xml security:

inspect dependencies for simplesamlphp/xml-security

Analyze the terminal output to locate any version of Simplesamlphp/xml security in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.6.12), 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-345: Insufficient Verification of Data Authenticity, where the product does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data. In Simplesamlphp/xml security, 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

Validation of an XML Signature requires verification that the hash value of the related XML-document (after any optional transformations and/or normalizations) matches a specific DigestValue-value, but also that the cryptografic signature on the SignedInfo-tree (the one that contains the DigestValue) verifies and matches a trusted public key. Within the simpleSAMLphp/xml-security library (https://github.com/simplesamlphp/xml-security), the hash is being validated using SignedElementTrait::validateReference, and the signature is being verified in SignedElementTrait::verifyInternal https://github.com/simplesamlphp/xml-security/blob/master/src/XML/SignedElementTrait.php: ![afbeelding](https://user-images.githubusercontent.com/841045/285817284-a7b7b3b4-768a-46e8-a34b-61790b6e23a5.png) What stands out is that the signature is being calculated over the canonical version of the SignedInfo-tree. The validateReference method, however, uses the original non-canonicalized version of SignedInfo. ### Impact If an attacker somehow (i.e. by exploiting a bug in PHP's canonicalization function) manages to manipulate the canonicalized version's DigestValue, it would be potentially be possible to forge the signature. No possibilities to exploit this were found during the investigation.

CVE-2023-49087 Affected Simplesamlphp/xml security Versions

2 component(s)
Fixed Versions:
1.6.125.0.0-alpha.13
Product / Package Ecosystem Affected Versions Fixed Version
simplesamlphp/xml-security
Packagist
≥ 1.6.11
< 1.6.12
All 1 versions
1.6.11
1.6.12
simplesamlphp/saml2
Packagist
≥ 5.0.0-alpha.12
< 5.0.0-alpha.13
All 1 versions
5.0.0-alpha.12
5.0.0-alpha.13

References

Frequently Asked Questions

What is CVE-2023-49087?
CVE-2023-49087 is a security vulnerability in Simplesamlphp/xml security involving Validation of SignedInfo under CWE-345: Insufficient Verification of Data Authenticity.
Which Simplesamlphp/xml security versions are affected?
Affected versions include releases prior to 1.6.12, 5.0.0-alpha.13 across affected packages: simplesamlphp/xml-security, simplesamlphp/saml2.
What version fixes CVE-2023-49087?
Upgrading to 1.6.12, 5.0.0-alpha.13 (or the latest patched release for your respective branch) resolves the vulnerability.
Is simplesamlphp/xml-security affected?
Yes, simplesamlphp/xml-security is affected in releases prior to 1.6.12. Upgrade your dependency to 1.6.12 or later.
Is simplesamlphp/saml2 affected?
Yes, simplesamlphp/saml2 is affected in releases prior to 5.0.0-alpha.13. Upgrade your dependency to 5.0.0-alpha.13 or later.
What is the CVSS score of CVE-2023-49087?
CVE-2023-49087 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2023-49087?
CVE-2023-49087 is classified under CWE-345: Insufficient Verification of Data Authenticity (The product does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.).
How can I check Packagist dependencies for CVE-2023-49087?
Run the dependency tree command: 'inspect dependencies for simplesamlphp/xml-security'. 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-ww7x-3gxh-qm6r",
  "modified" : "2023-12-06T21:08:04Z",
  "published" : "2023-11-28T18:52:19Z",
  "aliases" : [ "CVE-2023-49087" ],
  "summary" : "Validation of SignedInfo",
  "details" : "Validation of an XML Signature requires verification that the hash value of the related XML-document (after any optional transformations and/or normalizations) matches a specific DigestValue-value, but also that the cryptografic signature on the SignedInfo-tree (the one that contains the DigestValue) verifies and matches a trusted public key.\n\nWithin the simpleSAMLphp/xml-security library (https://github.com/simplesamlphp/xml-security), the hash is being validated using SignedElementTrait::validateReference, and the signature is being verified in SignedElementTrait::verifyInternal\n\nhttps://github.com/simplesamlphp/xml-security/blob/master/src/XML/SignedElementTrait.php:\n\n![afbeelding](https://user-images.githubusercontent.com/841045/285817284-a7b7b3b4-768a-46e8-a34b-61790b6e23a5.png)\n\nWhat stands out is that the signature is being calculated over the canonical version of the SignedInfo-tree. The validateReference method, however, uses the original non-canonicalized version of SignedInfo.\n\n### Impact\nIf an attacker somehow (i.e. by exploiting a bug in PHP's canonicalization function) manages to manipulate the canonicalized version's DigestValue, it would be potentially be possible to forge the signature. No possibilities to exploit this were found during the investigation.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "simplesamlphp/xml-security"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.6.11"
      }, {
        "fixed" : "1.6.12"
      } ]
    } ],
    "versions" : [ "1.6.11" ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "simplesamlphp/saml2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0-alpha.12"
      }, {
        "fixed" : "5.0.0-alpha.13"
      } ]
    } ],
    "versions" : [ "5.0.0-alpha.12" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/simplesamlphp/xml-security/security/advisories/GHSA-ww7x-3gxh-qm6r"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-49087"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/simplesamlphp/xml-security/commit/f509e3083dd7870cce5880c804b5122317287581"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/simplesamlphp/xml-security"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/simplesamlphp/xml-security/blob/master/src/XML/SignedElementTrait.php"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-345" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-11-28T18:52:19Z",
    "nvd_published_at" : "2023-11-30T06:15:47Z"
  }
}