Sensei Logo Sensei Hub

Recipe - Security Misconfiguration: StrictHttpFirewall: Rule configuration: Reject (URL encoded) null

Description:
Rejecting the use of a (URL encoded) null is more secure
Level:
warning
Language:
  • java
Tags:
  • Spring
  • security
  • framework specific
  • Spring Security
  • web
Documentation

Disallowing a null ("0") or a URL encoded null ("%00") in the URL is more secure, as they are frequently used in exploits. Spring Security by default sets StrictHttpFirewall#setAllowNull to false.

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