Skip to content

Unexpected Rule Processing in Coraza Proxy WASM on APISIX #307

Open
@azolfagharj

Description

@azolfagharj

Unexpected Rule Processing in Coraza Proxy WASM on APISIX

Hello team,

I am currently using Coraza Proxy WASM within Apache APISIX, and I've encountered an issue where a request from a specific IP is not being excluded from rule processing as expected.

🔧 Configuration Overview

Here is the relevant part of my configuration:

SecDebugLogLevel 9
SecRuleEngine On
SecDefaultAction "phase:2,log,deny,status:403"

# IP exclusion rule
SecRule REMOTE_ADDR "@contains X.X.X.X" "id:1236,phase:1,nolog,allow,ctl:ruleEngine=Off"
or
SecRule REMOTE_ADDR "@ipMatch X.X.X.X" "id:1236,phase:1,nolog,allow,ctl:ruleEngine=Off"

# Example blocking rule
SecRule REQUEST_URI "\.php\?.*=(https?|ftp)\:/.*(cmd|command)=" \
    "id:20508013,t:none,t:urlDecodeUni,t:htmlEntityDecode,t:lowercase,\
    phase:2,msg:'(Access denied with code 403)',\
    logdata:Matched on: %{MATCHED_VAR}"

❗ Expected Behavior

I expect that any request coming from X.X.X.X would be:

  • Allowed due to the allow,ctl:ruleEngine=Off directive.
  • Skipped from further rule evaluation (e.g., the rule with ID 20508013 should not be executed).

🚨 Actual Behavior

Unfortunately, this is not happening. The rule 20508013 is still being evaluated for the IP X.X.X.X, and access is being denied.

Here’s a log excerpt:

Coraza: Access denied (phase 2). (Access denied with code 403) [file ""] [line "51"] [id "20508013"] [rev ""] [msg "(Access denied with code 403)"] [data "Matched on: /waf/ip.php?url=http://example.com/cmd=something"] [severity "emergency"] [ver ""] [maturity "0"] [accuracy "0"] [hostname ""] [uri "/waf/ip.php?url=http://example.com/cmd=something"] [unique_id "aWvKAemfFFQtuoQJBkl"], client: X.X.X.X, server: _, request: "GET /waf/ip.php?url=http://example.com/cmd=something HTTP/1.1"

🤔 Question

Is there something I’m missing about how ctl:ruleEngine=Off should behave within Coraza Proxy WASM in APISIX?

I would greatly appreciate any guidance or clarification on how to achieve this behavior properly.

Thank you very much in advance for your support!

Best regards,
[Your Name]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions