Skip to main content
Vulnerability Database/CVE-2026-102366

CVE-2026-102366: mall4j File Upload XSS Vulnerability

CVE-2026-102366 is a stored XSS vulnerability in mall4j that allows authenticated attackers to upload malicious files. This post explains its technical details, affected versions, security impact, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-102366 Overview

CVE-2026-102366 affects mall4j through version 4.0, an open-source e-commerce platform maintained on GitHub by gz-yami. The vulnerability resides in the admin FileController endpoints, which lack authorization checks and accept arbitrary file types without validation. Any authenticated user with a valid token can upload HTML or SVG files containing JavaScript. When an administrator opens the uploaded file from the local storage path, the injected script executes in the administrator's browser context, producing stored cross-site scripting (XSS). The issue is classified under CWE-434: Unrestricted Upload of File with Dangerous Type.

Critical Impact

Authenticated attackers can plant stored XSS payloads that execute in administrator sessions, enabling session theft, admin action hijacking, and pivot into higher-privileged operations.

Affected Products

  • mall4j versions through 4.0
  • yami-shop-admin module (FileController.java)
  • yami-shop-service module (AttachFileServiceImpl.java)

Discovery Timeline

  • 2026-09-29 - CVE-2026-102366 published to NVD
  • 2026-09-30 - Last updated in NVD database

Technical Details for CVE-2026-102366

Vulnerability Analysis

The flaw combines two independent weaknesses in the mall4j admin file upload path. First, the FileController upload endpoint does not enforce role-based authorization, so any user holding a valid token, including low-privilege accounts, can reach the handler. Second, the underlying AttachFileServiceImpl writes uploaded bytes to local storage without validating MIME type, file extension, or content signature.

An attacker uploads an HTML or SVG file containing <script> payloads. The server stores the file and returns a URL under the local storage path. When an administrator later browses that URL, the browser renders the content and executes the embedded JavaScript under the admin origin. This yields stored XSS with persistent reach across administrative sessions.

Root Cause

The root cause is missing input validation and missing authorization on the file upload interface. Neither the controller layer nor the service layer restricts the set of acceptable file types, and the controller does not verify that the caller holds an administrative role.

Attack Vector

Exploitation requires network access to the admin API and a low-privilege authenticated token. The attacker submits a multipart upload with an HTML or SVG payload, then delivers the resulting URL to an administrator or plants it where an admin will view it. Refer to the VulnCheck Mall4j Advisory and the GitHub PoC Script for the reproduction sequence. The vulnerable code paths are visible in the GitHub FileController Code and the GitHub AttachFileService Code.

No verified sanitized exploitation code is provided in the enriched data. See the linked PoC repository for the tested request sequence.

Detection Methods for CVE-2026-102366

Indicators of Compromise

  • HTTP POST requests to admin file upload endpoints originating from non-admin user tokens.
  • Files with .html, .htm, .svg, or double extensions such as image.jpg.html present in the mall4j local attachment storage directory.
  • Outbound requests from administrator browsers to unfamiliar hosts shortly after opening an attachment URL.

Detection Strategies

  • Inspect stored attachments for HTML or SVG content containing <script>, onerror=, or onload= handlers.
  • Correlate upload API calls with the authenticated user role and alert when non-admin roles reach admin file endpoints.
  • Monitor web server access logs for GET requests to attachment URLs immediately followed by anomalous session activity from the same admin account.

Monitoring Recommendations

  • Enable verbose logging on the yami-shop-admin file controller, including caller identity, file name, and MIME type.
  • Forward web application and reverse proxy logs to a centralized analytics platform for retention and query.
  • Track file writes to the mall4j storage path with host-based integrity monitoring.

How to Mitigate CVE-2026-102366

Immediate Actions Required

  • Restrict the admin file upload endpoints at the reverse proxy or WAF to authenticated administrator sessions only.
  • Reject uploads whose MIME type or extension is not on an explicit allow list of image formats.
  • Serve stored attachments from a separate domain or with Content-Disposition: attachment and a restrictive Content-Security-Policy.
  • Audit the attachment storage directory for pre-existing HTML or SVG payloads and remove them.

Patch Information

No vendor patch reference is included in the enriched CVE data. Monitor the GitHub Mall4j Repository for updates to FileController.java and AttachFileServiceImpl.java that add role checks and file type validation.

Workarounds

  • Add a servlet filter or Spring Security rule that requires an admin role for all /file/** admin routes.
  • Enforce server-side validation of file extension, MIME type, and magic bytes before writing to disk.
  • Rename uploaded files to a server-generated identifier without a client-controlled extension.
  • Set response headers X-Content-Type-Options: nosniff and a strict Content-Security-Policy on the attachment origin.
bash
# Example nginx configuration to block HTML/SVG delivery from the attachment path
location /upload/ {
    types { image/jpeg jpg jpeg; image/png png; image/gif gif; image/webp webp; }
    default_type application/octet-stream;
    add_header X-Content-Type-Options "nosniff" always;
    add_header Content-Security-Policy "default-src 'none'; img-src 'self'" always;
    add_header Content-Disposition "attachment" always;

    if ($request_filename ~* \.(html?|svg|js|xml)$) { return 403; }
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.