You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the StaticHandlerImpl#sendDirectoryListing(...) method under the text/html branch, file and directory names are directly embedded into the href, title, and link text without proper HTML escaping.
As a result, in environments where an attacker can control file names, injecting HTML/JavaScript is possible. Simply accessing the directory listing page will trigger an XSS.
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