Vert.x-Web vulnerable to Stored Cross-site Scripting in directory listings via file names
Package
Affected versions
< 4.5.22
>= 5.0.0, <= 5.0.4
Patched versions
4.5.22
5.0.5
Description
Published by the National Vulnerability Database
Oct 22, 2025
Published to the GitHub Advisory Database
Oct 22, 2025
Reviewed
Oct 22, 2025
Last updated
Oct 22, 2025
Description
StaticHandlerImpl#sendDirectoryListing(...)
method under thetext/html
branch, file and directory names are directly embedded into thehref
,title
, and link text without proper HTML escaping.vertx-web/src/main/java/io/vertx/ext/web/handler/impl/StaticHandlerImpl.java
normalizedDir
is constructed without escaping<li><a ...>
elements insert file names directly into attributes and body without escaping{directory}
,{parent}
, and{files}
are inserted into the HTML template without escapingReproduction Steps
Prerequisites:
StaticHandler
(e.g.,
StaticHandler.create("public").setDirectoryListing(true)
)Create a malicious file name (example for Unix-based OS):
public/
with one of the following names:<img src=x onerror=alert('XSS')>.txt
evil" onmouseover="alert('XSS')".txt
Start the server (example):
router.route("/public/*").handler(StaticHandler.create("public").setDirectoryListing(true));
vertx.createHttpServer().requestHandler(router).listen(8890);
Verification request (raw HTTP):
Example response excerpt:
/public/
in a browser, the unescaped file name is interpreted as HTML, and event handlers such asonerror
are executed.Potential Impact
Stored XSS
Common Conditions That Make Exploitation Easier
Similar CVEs Previously Reported
References