Recipe Name:
Security Misconfiguration: StrictHttpFirewall: Rule configuration: Reject URL encoded period
Description:
Rejecting the use of a URL encoded period is more secure
Level:
warning
Language:
  • java
Tags:
  • Spring
  • security
  • framework specific
  • Spring Security
  • web
Documentation

Disallowing a URL encoded period ("%2E") in the URL is more secure, as they are frequently used to bypass security constraints. It could f.e. facilitate Directory Traversal Attacks. Spring Security by default sets StrictHttpFirewall#setAllowUrlEncodedPeriod to false.

Before
firewall.setAllowUrlEncodedPeriod(true);
After
firewall.setAllowUrlEncodedPeriod(false);
References
Recipe
id: scw:spring:security:stricthttpfirewall-period
version: 10
metadata:
  name: 'Security Misconfiguration: StrictHttpFirewall: Rule configuration: Reject URL encoded period'
  shortDescription: Rejecting the use of a URL encoded period is more secure
  level: warning
  language: java
  enabled: true
  descriptionFile: descriptions/RejectURLEncodedPeriod.html
  tags: Spring;security;framework specific;Spring Security;web
search:
  methodcall:
    args:
      1:
        type: boolean
        value:
          stringified: "true"
    name: setAllowUrlEncodedPeriod
    type: org.springframework.security.web.firewall.StrictHttpFirewall
availableFixes:
- name: Set setAllowUrlEncodedPeriod to false
  actions:
  - modifyArguments:
      rewrite:
        1: "false"