# GHSA-58qw-p7qm-5rvh: Eclipse Jetty XmlParser allows arbitrary DOCTYPE declarations

> Developers using Jetty's XmlParser for untrusted input face XXE risks, allowing denial of service or local file disclosure.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 10 Jul 2023

## What is GHSA-58qw-p7qm-5rvh?

GHSA-58qw-p7qm-5rvh is a vulnerability in org.eclipse.jetty:jetty-xml, published on 10 Jul 2023. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

### From the reporter

> `XmlParser` is vulnerable to XML external entity (XXE) vulnerability.
>  XmlParser is being used when parsing Jetty’s xml configuration files. An attacker might exploit
> this vulnerability in order to achieve SSRF or cause a denial of service.
> One possible scenario is importing a (remote) malicious WAR into a Jetty’s server, while the
> WAR includes a malicious web.xml.

### Impact
There are no circumstances in a normally deployed Jetty server where potentially hostile XML is given to the XmlParser class without the attacker already having arbitrary access to the server. I.e. in order to exploit `XmlParser` the attacker would already have the ability to deploy and execute hostile code.  Specifically, Jetty has no protection against malicious web application and potentially hostile web applications should only be run on an isolated virtualisation.  

Thus this is not considered a vulnerability of the Jetty server itself, as any such usage of the jetty XmlParser is equally vulnerable as a direct usage of the JVM supplied SAX parser.  No CVE will be allocated to this advisory.

However, any direct usage of the `XmlParser` class by an application may be vulnerable.  The impact would greatly depend on how the application uses `XmlParser`, but it could be a denial of service due to large entity expansion, or possibly the revealing local files if the XML results are accessible remotely.

### Patches
Ability to configure the SAXParserFactory to fit the needs of your particular XML parser implementation have been merged as part of PR #10067

### Workarounds
Don't use Jetty's `XmlParser` to parse data from users.

## Which versions are affected by GHSA-58qw-p7qm-5rvh?

8 open source packages ship an affected version, including org.eclipse.jetty:jetty-xml.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.eclipse.jetty:jetty-xml` | Maven | All versions | 9.4.52.v20230823 |
| `org.eclipse.jetty:jetty-xml` | Maven | All versions | 9.4.52.v20230823 |
| `org.eclipse.jetty:jetty-xml` | Maven | From 10.0.0-alpha0 | 10.0.16 |
| `org.eclipse.jetty:jetty-xml` | Maven | From 10.0.0-alpha0 | 10.0.16 |
| `org.eclipse.jetty:jetty-xml` | Maven | From 11.0.0-alpha0 | 11.0.16 |
| `org.eclipse.jetty:jetty-xml` | Maven | From 11.0.0-alpha0 | 11.0.16 |
| `org.eclipse.jetty:jetty-xml` | Maven | From 12.0.0.alpha0 | 12.0.0 |
| `org.eclipse.jetty:jetty-xml` | Maven | From 12.0.0.alpha0 | 12.0.0 |

## How do I fix GHSA-58qw-p7qm-5rvh?

Upgrade org.eclipse.jetty:jetty-xml to a fixed version for your release line: 9.4.52.v20230823, 10.0.16, 11.0.16 or 12.0.0.

## Is GHSA-58qw-p7qm-5rvh being exploited?

There is no known exploitation of GHSA-58qw-p7qm-5rvh in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-58qw-p7qm-5rvh and fix it if it is affected.

What it is: GHSA-58qw-p7qm-5rvh is a vulnerability in org.eclipse.jetty:jetty-xml, published on 10 Jul 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-58qw-p7qm-5rvh in the wild and no public exploit code.

Affected packages and fixed versions:
- org.eclipse.jetty:jetty-xml (Maven): affected all versions; fixed in 9.4.52.v20230823
- org.eclipse.jetty:jetty-xml (Maven): affected all versions; fixed in 9.4.52.v20230823
- org.eclipse.jetty:jetty-xml (Maven): affected from 10.0.0-alpha0; fixed in 10.0.16
- org.eclipse.jetty:jetty-xml (Maven): affected from 10.0.0-alpha0; fixed in 10.0.16
- org.eclipse.jetty:jetty-xml (Maven): affected from 11.0.0-alpha0; fixed in 11.0.16
- org.eclipse.jetty:jetty-xml (Maven): affected from 11.0.0-alpha0; fixed in 11.0.16
- org.eclipse.jetty:jetty-xml (Maven): affected from 12.0.0.alpha0; fixed in 12.0.0
- org.eclipse.jetty:jetty-xml (Maven): affected from 12.0.0.alpha0; fixed in 12.0.0

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/GHSA-58qw-p7qm-5rvh/ (Markdown: https://insights.sbomify.com/GHSA-58qw-p7qm-5rvh/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-58qw-p7qm-5rvh

---
From sbomify Insights: https://insights.sbomify.com/GHSA-58qw-p7qm-5rvh/
Summaries are generated and may contain mistakes; the official description above is the record.
