# CVE-2023-49087: Validation of SignedInfo

> Attackers can forge XML signatures by exploiting canonicalization bugs, bypassing integrity checks in the xml-security library.

- **Severity:** Medium 6.8 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 30 Nov 2023
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-ww7x-3gxh-qm6r

## What is CVE-2023-49087?

CVE-2023-49087 is a medium-severity vulnerability in simplesamlphp xml-security, published on 30 Nov 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

xml-security is a library that implements XML signatures and encryption. Validation of an XML signature requires verification that the hash value of the related XML-document matches a specific DigestValue-value, but also that the cryptographic signature on the SignedInfo-tree (the one that contains the DigestValue) verifies and matches a trusted public key. 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 possible to forge the signature. This issue has been patched in version 1.6.12 and 5.0.0-alpha.13.

Weakness: CWE-345 (Insufficient Verification of Data Authenticity)

## Which versions are affected by CVE-2023-49087?

4 open source packages ship an affected version, including simplesamlphp/xml-security and simplesamlphp/saml2. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `simplesamlphp/xml-security` | Packagist | From 1.6.11 | 1.6.12 |
| `simplesamlphp/xml-security` | Packagist | From 1.6.11 | 1.6.12 |
| `simplesamlphp/saml2` | Packagist | From 5.0.0-alpha.12 | 5.0.0-alpha.13 |
| `simplesamlphp/saml2` | Packagist | From 5.0.0-alpha.12 | 5.0.0-alpha.13 |

Products: Simplesamlphp Saml2, Simplesamlphp Xml-Security.

## How do I fix CVE-2023-49087?

Upgrade simplesamlphp/xml-security to 1.6.12 or later.

## Is CVE-2023-49087 being exploited?

There is no known exploitation of CVE-2023-49087 in the wild and no public exploit code.

## Other vulnerabilities in simplesamlphp xml-security

- [CVE-2016-9814](https://insights.sbomify.com/CVE-2016-9814/): SimpleSAMLphp SAML2 spoof SAML responses (critical 9.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-49087 and fix it if it is affected.

What it is: CVE-2023-49087 is a medium-severity vulnerability in simplesamlphp xml-security, published on 30 Nov 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-49087 in the wild and no public exploit code.

Affected packages and fixed versions:
- simplesamlphp/xml-security (Packagist): affected from 1.6.11; fixed in 1.6.12
- simplesamlphp/xml-security (Packagist): affected from 1.6.11; fixed in 1.6.12
- simplesamlphp/saml2 (Packagist): affected from 5.0.0-alpha.12; fixed in 5.0.0-alpha.13
- simplesamlphp/saml2 (Packagist): affected from 5.0.0-alpha.12; fixed in 5.0.0-alpha.13

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-49087/ (Markdown: https://insights.sbomify.com/CVE-2023-49087/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-49087
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-49087
- OSV: https://osv.dev/vulnerability/CVE-2023-49087

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-49087/
Summaries are generated and may contain mistakes; the official description above is the record.
