Skip to content

Incorrect escaping in @rx operator with macro expansion #2357

Closed
@marcstern

Description

@marcstern

When using macro expansion with @rx operator, escaping is incorrectly applied.

Example:
SecRule ARGS "@rx localhost|%{TX.OtherHosts}"
will lead to something like SecRule ARGS "@rx localhost\|myhost1\|myhost2"
This screws up all regexes, as regex special characters will be escaped, even outside the macro-expanded varaiables.

In case I want to test against %{TX.MyHost} that isn't a regex, I can use the @contain operator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.xRelated to ModSecurity version 2.xenhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions