ZeroHour

CVE-2026-63490

niche

Unauthenticated arbitrary file read in Handlebars.java (handlebars-springmvc)

CVSS 3.1
7.5 high
EPSS
<1%p39
Published
()
Modified
AI analysis

The SpringTemplateLoader in Handlebars.java's handlebars-springmvc module resolves Spring MVC view names into URLs through Spring's ResourceLoader without the path-containment check that was added to the library's other URL-based loaders, leaving the automatically appended '.hbs' suffix as the only guard against reading files outside template directories. A trailing '#' character in a user-influenced view name pushes that suffix into the URL fragment, which both Spring's resource handling and the JDK silently discard, so a view name of 'file:/etc/passwd' reads /etc/passwd instead of /etc/passwd.hbs. The fetched file is then parsed as a Handlebars template and rendered into the HTTP response, giving an unauthenticated, network-reachable attacker an arbitrary file read of any file readable by the JVM process (CVSS 7.5 High). Affected deployments are Spring MVC applications using a default-configured HandlebarsViewResolver whose controllers return fully or partially attacker-controlled view names. No public proof-of-concept is known, exploitation has not been observed in the wild, and the issue is not in CISA KEV; EPSS puts 30-day exploitation probability at about 0.5%.

What to do: Upgrade handlebars-springmvc to a release that applies the missing path-containment check once available (no fixed version is stated in the source data; commit d177cdee shows the intended hardening pattern). As an interim mitigation, stop letting raw user input determine view names, or validate/allowlist view names and reject values containing '#' or scheme prefixes such as 'file:' and 'classpath:'. Also review which secrets are readable by the application's JVM user, since any of those files can be exfiltrated via template rendering until patched.

Affected
jknack (Handlebars.java) handlebars-springmvc (SpringTemplateLoader)
Estimated exposure
nicheunknown precisely; likely at most a few thousand Java web applications — No install counts or internet-exposure scan data were provided, and the estimate reflects that handlebars-springmvc is a niche Maven module whose exploitation additionally requires the uncommon combination of a default-configured…

Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.

Description

Handlebars.java provides logic-less and semantic Mustache templates with Java. Prior to 4.5.3, com.github.jknack.handlebars.springmvc.SpringTemplateLoader resolves attacker-influenced Spring MVC view names through Spring ResourceLoader without the path-containment validation used by other URL-based loaders. In handlebars-springmvc/src/main/java/com/github/jknack/handlebars/springmvc/SpringTemplateLoader.java, a view name using a file: or classpath: URL and ending with the # fragment delimiter places the appended .hbs suffix in the fragment, which FileUrlResource.exists() and URL.openStream() discard. HandlebarsViewResolver in handlebars-springmvc/src/main/java/com/github/jknack/handlebars/springmvc/HandlebarsViewResolver.java then passes the attacker-controlled name to handlebars.compile(), allowing an unauthenticated remote attacker to read files accessible to the JVM when an application exposes a controller with a user-influenced view name. This issue is fixed in version 4.5.3.

Ecosystems
maven
Weakness
CWE-22, CWE-23, CWE-552
Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
GHSA
GHSA-g29j-rwfv-h99w (high)

In the news

No ingested article mentions this CVE yet.