CVE-2025-27773: Simplesamlphp/saml2 The SimpleSAMLphp SAML2 Library Incorrectly Vulnerability

HIGH
Advisory Identifier: GHSA-46r4-f8gj-xg56
CVSS 8.6
CWE-347
Published
Advisory Summary

CVE-2025-27773 is a HIGH (CVSS 8.6) the simplesamlphp saml2 library incorrectly vulnerability (CWE-347: Improper Verification of Cryptographic Signature) affecting Simplesamlphp/saml2 libraries in the Packagist ecosystem. The issue involves the simplesamlphp saml2 library incorrectly verifies signatures for http-redirect binding. Remediation is available by upgrading affected packages to version 4.17.0, 5.0.0-alpha.20.

CVE-2025-27773 at a Glance

CVE Identifier CVE-2025-27773
GHSA Identifier GHSA-46r4-f8gj-xg56
Severity HIGH
CVSS v3.1 Base Score 8.6
CWE Classification CWE-347: Improper Verification of Cryptographic Signature
Affected Product Simplesamlphp/saml2
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.6

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

How to Fix CVE-2025-27773

To remediate this vulnerability, upgrade all affected Simplesamlphp/saml2 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/saml2 fixed: 4.17.0
Upgrade simplesamlphp/saml2 to 4.17.0
simplesamlphp/saml2 fixed: 5.0.0-alpha.20
Upgrade simplesamlphp/saml2 to 5.0.0-alpha.20
simplesamlphp/saml2-legacy fixed: 4.17.0
Upgrade simplesamlphp/saml2-legacy to 4.17.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 simplesamlphp/saml2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-27773, inspect your project dependencies for Simplesamlphp/saml2:

inspect dependencies for simplesamlphp/saml2

Analyze the terminal output to locate any version of Simplesamlphp/saml2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.17.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-347: Improper Verification of Cryptographic Signature, where the product does not verify, or incorrectly verifies, the cryptographic signature for data. In Simplesamlphp/saml2, 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 There's a signature confusion attack in the HTTPRedirect binding. An attacker with any signed SAMLResponse via the HTTP-Redirect binding can cause the application to accept an unsigned message. I believe that it exists for v4 only. I have not yet developed a PoC. V5 is well designed and instead builds the signed query from the same message that will be consumed. ### Details #### What is verified The data['SignedQuery'] is the string that will be verified by the public key. It is defined here: https://github.com/simplesamlphp/saml2/blob/9545abd0d9d48388f2fa00469c5c1e0294f0303e/src/SAML2/HTTPRedirect.php#L178-L217 THe code will iterate through each parameter name. Notably, sigQuery is overridden each time when processing, making the last of SAMLRequest/SAMLResponse used for sigQuery. For example, given: SAMLRequest=a&SAMLResponse=idpsigned SAMLResponse=idpsigned will be set as sigQuery, then later verified #### What is actually processed Processing uses SAMLRequest parameter value first, (if it exists) then SAMLResponse: https://github.com/simplesamlphp/saml2/blob/9545abd0d9d48388f2fa00469c5c1e0294f0303e/src/SAML2/HTTPRedirect.php#L104-L113 Given this, the contents that are processed might not be the same as the data that is actually verified. ### Exploiting Suppose an attacker has a signed HTTP Redirect binding from IdP, say a signed logout response. : SAMLResponse=idpsigned&RelayState=...&SigAlg=...&Signature Then an attacker can append SAMLRequest in front: `SAMLRequest=unverifieddata&SAMLResponse=idpsigned&RelayState=...&SigAlg=...&Signature=..` SimpleSAMLPhp will only verify the SAMLResponse, but will actually use the SAMLRequest contents. The impact here is increased because there's no checks that SAMLRequest actually contains a Request, it could instead contain an Response, which allows the attacker to effectively impersonate any user within the SP. ### IdPs Microsoft Azure AD/Entra (and likely ADFS) signs the LogoutResponse via this SimpleSign format in HTTP Redirect binding. If an attacker logs out of Entra, they will be able to extract a valid Signature. Attached is an HTTP Request when an I initiated a SLO request from the service provider to the IdP (entra). Then IdP POSTed this SAMLResponse with HTTP Redirect binding signature, via the user browser to the SP. It should be possible to carry out the described attack with this. ``` https://webhook.site/c6038292-6ef5-46ac-973d-d7c25520ec48/logout?SAMLResponse=fVJNa%2bMwEP0rRndZtmw5tnAMy%2fYSaC9N6aGXIsmjVMTRGI9M%2bvObdeihsPQ4w7x5HzM9mcs060c84ZqegWaMBNnhYc%2fejS1UW1TAnVU7XldK8s7JkcvOd60Db3zTsewVFgoY90zmBcsORCscIiUT061VyJqXJS%2fbl7LRUmrZ5mXdvLHsASiFaNKG%2fEhpJi3EFewH4jmnkEC4pqha2UnegFe8bozj3a4a%2bbhzUilZgKtbMW2yb7TxW%2foL7lkM9hTC2XnEOPvZXjDECb2N1lh7mvBsp%2bnsErDs8zJF0lsEe7YuUaOhQDqaC5BOTh%2f%2fPD3qmzE9L5jQ4cSGfrO43KG%2fgwwRLP8ssuHbIiXKryGOeKU8QhLSVN7WteejV8Bru%2bt4WynFbwE3bdVV5ahG0Ys759Dfj3VMJq30s%2fqLI2SvZlrhd020Tevj6hwQMTH04udS8b%2bHGL4A&Signature=Z%2f7gIPv7Gkgvqtwo0bzgXyum9IjHMfP0zTYuNbl%2fBUGlQ%2fU%2bbOZGZJ6Rk9wLUyvNQ5XlZRxZrfESNA%2bn0CVyIedsg9GxQKTi7VqPTJFJqEIP1BZaEpYYP3%2f6sFfLxfTMKecJoQdxnDE5Malte1hMj2UujWnLXOnp0CgO%2f%2fU2K52SoGckIzNDRB%2fJ6%2fysTn%2bDjBrmgdro%2fgdTyby9%2f3vm8dzY8pUkRCgMjlimShrZxr5U33wQvwPLIXlDgActr91RUtWKE0k8sy%2brshrK9DKLPo8AdTLk7NYhjSWdF7OG7uqgEeEo470tacqQuA09E0qDh8CWS%2bycLJijiGYWVyQa4Q%3d%3d&SigAlg=http%3a%2f%2fwww.w3.org%2f2001%2f04%2fxmldsig-more%23rsa-sha256 ```

CVE-2025-27773 Affected Simplesamlphp/saml2 Versions

3 component(s)
Fixed Versions:
4.17.05.0.0-alpha.20
Product / Package Ecosystem Affected Versions Fixed Version
simplesamlphp/saml2
Packagist
< 4.17.0
4.17.0
simplesamlphp/saml2
Packagist
≥ 5.0.0-alpha.1
< 5.0.0-alpha.20
5.0.0-alpha.20
simplesamlphp/saml2-legacy
Packagist
< 4.17.0
4.17.0

References

Frequently Asked Questions

What is CVE-2025-27773?
CVE-2025-27773 is a security vulnerability in Simplesamlphp/saml2 involving The SimpleSAMLphp SAML2 library incorrectly verifies signatures for HTTP-Redirect binding under CWE-347: Improper Verification of Cryptographic Signature.
Which Simplesamlphp/saml2 versions are affected?
Affected versions include releases prior to 4.17.0, 5.0.0-alpha.20 across affected packages: simplesamlphp/saml2, simplesamlphp/saml2-legacy.
What version fixes CVE-2025-27773?
Upgrading to 4.17.0, 5.0.0-alpha.20 (or the latest patched release for your respective branch) resolves the vulnerability.
Is simplesamlphp/saml2 affected?
Yes, simplesamlphp/saml2 is affected in releases prior to 4.17.0, 5.0.0-alpha.20. Upgrade your dependency to 4.17.0, 5.0.0-alpha.20 or later.
Is simplesamlphp/saml2-legacy affected?
Yes, simplesamlphp/saml2-legacy is affected in releases prior to 4.17.0. Upgrade your dependency to 4.17.0 or later.
What is the CVSS score of CVE-2025-27773?
CVE-2025-27773 has a CVSS v3.1 base score of 8.6 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N.
What CWE is associated with CVE-2025-27773?
CVE-2025-27773 is classified under CWE-347: Improper Verification of Cryptographic Signature (The product does not verify, or incorrectly verifies, the cryptographic signature for data.).
How can I check Packagist dependencies for CVE-2025-27773?
Run the dependency tree command: 'inspect dependencies for simplesamlphp/saml2'. 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-46r4-f8gj-xg56",
  "modified" : "2025-05-09T21:31:08Z",
  "published" : "2025-03-11T19:23:22Z",
  "aliases" : [ "CVE-2025-27773" ],
  "summary" : "The SimpleSAMLphp SAML2 library incorrectly verifies signatures for HTTP-Redirect binding",
  "details" : "### Summary\nThere's a signature confusion attack in the HTTPRedirect binding. An attacker with any signed SAMLResponse via the HTTP-Redirect binding can cause the application to accept an unsigned message.\n\nI believe that it exists for v4 only. I have not yet developed a PoC.\n\nV5 is well designed and instead builds the signed query from the same message that will be consumed.\n### Details\n\n#### What is verified\nThe data['SignedQuery'] is the string that will be verified by the public key. \n\nIt is defined here:\nhttps://github.com/simplesamlphp/saml2/blob/9545abd0d9d48388f2fa00469c5c1e0294f0303e/src/SAML2/HTTPRedirect.php#L178-L217\n\nTHe code will iterate through each parameter name. Notably, sigQuery is overridden each time when processing, making the last of SAMLRequest/SAMLResponse used for sigQuery.\n\nFor example, given:\n\nSAMLRequest=a&SAMLResponse=idpsigned\n\nSAMLResponse=idpsigned will be set as sigQuery, then later verified\n\n\n#### What is actually processed\n\nProcessing uses SAMLRequest parameter value first, (if it exists) then SAMLResponse:\n\nhttps://github.com/simplesamlphp/saml2/blob/9545abd0d9d48388f2fa00469c5c1e0294f0303e/src/SAML2/HTTPRedirect.php#L104-L113\n\nGiven this, the contents that are processed might not be the same as the data that is actually verified.\n\n\n### Exploiting\nSuppose an attacker has a signed HTTP Redirect binding from IdP, say a signed logout response. :\n\nSAMLResponse=idpsigned&RelayState=...&SigAlg=...&Signature\n\n\nThen an attacker can append SAMLRequest in front:\n\n`SAMLRequest=unverifieddata&SAMLResponse=idpsigned&RelayState=...&SigAlg=...&Signature=..`\n\nSimpleSAMLPhp will only verify the SAMLResponse, but will actually use the SAMLRequest contents. The impact here is increased because there's no checks that SAMLRequest actually contains a Request, it could instead contain an Response, which allows the attacker to effectively impersonate any user within the SP.\n\n\n### IdPs\n\nMicrosoft Azure AD/Entra (and likely ADFS) signs the LogoutResponse via this SimpleSign format in HTTP Redirect binding. If an attacker logs out of Entra, they will be able to extract a valid Signature.\n\nAttached is an HTTP Request when an I initiated a SLO request from the service provider to the IdP (entra). Then IdP POSTed this SAMLResponse with HTTP Redirect binding signature, via the user browser to the SP. It should be possible to carry out the described attack with this.\n\n```\nhttps://webhook.site/c6038292-6ef5-46ac-973d-d7c25520ec48/logout?SAMLResponse=fVJNa%2bMwEP0rRndZtmw5tnAMy%2fYSaC9N6aGXIsmjVMTRGI9M%2bvObdeihsPQ4w7x5HzM9mcs060c84ZqegWaMBNnhYc%2fejS1UW1TAnVU7XldK8s7JkcvOd60Db3zTsewVFgoY90zmBcsORCscIiUT061VyJqXJS%2fbl7LRUmrZ5mXdvLHsASiFaNKG%2fEhpJi3EFewH4jmnkEC4pqha2UnegFe8bozj3a4a%2bbhzUilZgKtbMW2yb7TxW%2foL7lkM9hTC2XnEOPvZXjDECb2N1lh7mvBsp%2bnsErDs8zJF0lsEe7YuUaOhQDqaC5BOTh%2f%2fPD3qmzE9L5jQ4cSGfrO43KG%2fgwwRLP8ssuHbIiXKryGOeKU8QhLSVN7WteejV8Bru%2bt4WynFbwE3bdVV5ahG0Ys759Dfj3VMJq30s%2fqLI2SvZlrhd020Tevj6hwQMTH04udS8b%2bHGL4A&Signature=Z%2f7gIPv7Gkgvqtwo0bzgXyum9IjHMfP0zTYuNbl%2fBUGlQ%2fU%2bbOZGZJ6Rk9wLUyvNQ5XlZRxZrfESNA%2bn0CVyIedsg9GxQKTi7VqPTJFJqEIP1BZaEpYYP3%2f6sFfLxfTMKecJoQdxnDE5Malte1hMj2UujWnLXOnp0CgO%2f%2fU2K52SoGckIzNDRB%2fJ6%2fysTn%2bDjBrmgdro%2fgdTyby9%2f3vm8dzY8pUkRCgMjlimShrZxr5U33wQvwPLIXlDgActr91RUtWKE0k8sy%2brshrK9DKLPo8AdTLk7NYhjSWdF7OG7uqgEeEo470tacqQuA09E0qDh8CWS%2bycLJijiGYWVyQa4Q%3d%3d&SigAlg=http%3a%2f%2fwww.w3.org%2f2001%2f04%2fxmldsig-more%23rsa-sha256\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "simplesamlphp/saml2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.17.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.16.15"
    }
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "simplesamlphp/saml2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0-alpha.1"
      }, {
        "fixed" : "5.0.0-alpha.20"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.0.0-alpha.19"
    }
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "simplesamlphp/saml2-legacy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.17.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.16.15"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/simplesamlphp/saml2/security/advisories/GHSA-46r4-f8gj-xg56"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-27773"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/simplesamlphp/saml2/commit/7867d6099dc7f31bed1ea10e5bea159c5623d2a0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/simplesamlphp/saml2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/simplesamlphp/saml2/blob/9545abd0d9d48388f2fa00469c5c1e0294f0303e/src/SAML2/HTTPRedirect.php#L104-L113"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/simplesamlphp/saml2/blob/9545abd0d9d48388f2fa00469c5c1e0294f0303e/src/SAML2/HTTPRedirect.php#L178-L217"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2025/05/msg00013.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-347" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-03-11T19:23:22Z",
    "nvd_published_at" : "2025-03-11T19:15:43Z"
  }
}