Java Vulnerable Spring Escape False
Description
This detector identifies Spring Framework configurations where HTML escaping is explicitly disabled, which can lead to Cross-Site Scripting (XSS) vulnerabilities. When HTML escaping is turned off, user-controlled data rendered in web pages will not be automatically sanitized, allowing malicious scripts to execute in users' browsers.
Detection Strategy
• Scans Spring configuration files (typically XML) for <spring:htmlescape> tags
• Flags configurations where the 'defaulthtmlescape' attribute is explicitly set to 'false'
• Reports the exact line and column where the vulnerable configuration is found
• Note that configurations with defaulthtmlescape='true' or missing defaulthtmlescape attribute (defaults to true) are considered safe
Vulnerable code example
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>
<html>
<head>
<title>User Profile</title>
</head>
<body>...✅ Secure code example
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<title>User Profile</title>
</head>...Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.