CVE-2026-63490: Handlebars.java: Arbitrary file read in `SpringTemplateLoader` via URL-fragment suffix bypass
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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
com.github.jknack.handlebars:handlebars-springmvcto a version that resolves this vulnerability.Fixed in 4.5.3
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications using the handlebars-springmvc module before 4.5.3 are exposed when they have a controller that allows an attacker to influence the Spring MVC view name resolved by HandlebarsViewResolver. The impact is limited to files accessible to the JVM process.
Does exploitation require authentication or user interaction?
No. The reported vector is network-accessible, requires low attack complexity, no privileges, and no user interaction, provided an attacker can influence a resolved view name.
What input is used to bypass the template suffix handling?
The bypass uses a file: or classpath: URL view name ending in the # fragment delimiter. The loader-appended .hbs suffix is then placed in the URL fragment, which FileUrlResource.exists() and URL.openStream() discard.
What is the remediation?
Upgrade Handlebars.java handlebars-springmvc to version 4.5.3, which fixes the issue. If upgrading cannot happen immediately, prevent untrusted request data from controlling Spring MVC view names passed to HandlebarsViewResolver.