CVE-2026-73254: Mongoose: Stored XSS via unescaped filenames in directory listing

Published Aug 20, 2026
·
Updated

Mongoose is an embedded web server and network library. Prior to 7.22, an attacker who can create a file with an HTML payload in its name can trigger stored cross-site scripting when a user browses a directory served with MGENABLEDIRLIST. The printdirentry() path called by listdir() in src/http.c URL-encodes the href but inserts the raw filesystem filename into the HTML link text. The browser executes the injected markup in the Mongoose origin, which can expose session data or permit actions as the victim. This issue is fixed in version 7.22.

Affected Software

1 affected component
Mongoose Mongoose<7.22

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade Mongoose to a version that resolves this vulnerability.

    Fixed in 7.22
  2. Configuration

    Disable directory listing (MG_ENABLE_DIRLIST) to prevent stored XSS via unescaped filenames when serving directory listings.

    Mongoose embedded web server MG_ENABLE_DIRLIST = disabled

Event History

Aug 20, 2026
CVE Published
via MITRE·05:37 PM
Data Sourced
via MITRE·05:37 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are exposed?

Deployments are exposed when they serve a directory with MG_ENABLE_DIRLIST enabled. The affected directory listing path renders filesystem filenames as HTML link text without escaping them.

2

What must an attacker and victim do for exploitation to occur?

An attacker must be able to create a file whose filename contains an HTML payload. A user must then browse the affected directory listing, causing the browser to execute the injected markup in the Mongoose origin.

3

How can I assess whether an instance is affected?

Check whether the Mongoose version is earlier than 7.22 and whether MG_ENABLE_DIRLIST is enabled for served directories. Also determine whether untrusted parties can create files in directories that are exposed through those listings.

4

What is the available fix?

Upgrade Mongoose to version 7.22, which fixes the issue.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203