coreruleset: False positive for libinjection (941100)

Description

I am running FrankenPHP (Caddy) in Docker (compose file) with these Coraza settings. When I send a text like:

<p>This website is clearly not a large enterprise, so my server is small. I have only 10GBs of RAM on it, and that includes some extra RAM that was bought to accommodate this table, that at the time was around 8GBs. I obviously was not checking the size regularly, but when I started getting eternal loads on the website in the beginning of November, relatively soon I deduced, that that table might have been the problem. Because nothing else made much sense.</p>
<p>Well, there is a possibility that it was older version of <a href="https://www.crowdsec.net/" target="_blank" rel="noopener">Crowdsec</a> hanging for some reason (which I got 2 on my test environment accidentally), but since my <a href="https://github.com/Simbiat/database" target="_blank" rel="noopener">Database</a> library is throwing errors when there are still deadlocks after 5 times, and the hang-ups were coinciding with spikes of those errors, especially during daily backups, the size was the most obvious culprit. And even if not - it needed to be solved anyway.</p>

I get error like

{"level":"error","ts":1735223896.7160676,"logger":"http.handlers.waf","msg":"[client \"87.92.5.57\"] Coraza: Access denied (phase 2). XSS Attack Detected via libinjection [file \"@owasp_crs/REQUEST-941-APPLICATION-ATTACK-XSS.conf\"] [line \"4454\"] [id \"941100\"] [rev \"\"] [msg \"XSS Attack Detected via libinjection\"] [data \"Matched Data: XSS data found within ARGS:postForm[text]: <p>This website is clearly not a large enterprise, so my server is small. I have only 10GBs of RAM on it, and that includes some extra RAM that\"] [severity \"critical\"] [ver \"OWASP_CRS/4.0.0-rc1\"] [maturity \"0\"] [accuracy \"0\"] [tag \"application-multi\"] [tag \"language-multi\"] [tag \"platform-multi\"] [tag \"attack-xss\"] [tag \"paranoia-level/1\"] [tag \"OWASP_CRS\"] [tag \"capec/1000/152/242\"] [hostname \"\"] [uri \"/api/talks/posts/965/edit\"] [unique_id \"eSNFFDFiGpUQjuJg\"]\n"}

Which does not even make much sense to me, to be honest, since it highlights wrong portion of text. I mean I can replace the first <p> content with anything else (and it was something different originally), but then it still fails highlighting the very beginning of the HTML content.
Some more experiments helped identify that it complains specifically about

<a href="https://github.com/Simbiat/database" target="_blank" rel="noopener">Database</a>

And I am not sure it should. I mean, I am not sure how exactly is this a libinjection. It may be Coraza’s issue, though, especially since it’s picking up OWASP_CRS/4.0.0-rc1 for some reason, but my gut feeling suggests that this is still a false positive from the rule, rather than Coraza’s issue, so starting here for now.

Unfortunately not able to replicate this on Sandbox even with nightly, but hopefully above is enough to reproduce this. If not, let me know what else may be required.

Confirmation

[x ] I have removed any personal data (email addresses, IP addresses, passwords, domain names) from any logs posted.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

This will be correctly be the whole fixing path 😅 But I would stick with just an issue in corazawaf/coraza. If my investigation is correct, all the connectors using the default libinjection-go are affected. Thanks again!

Done https://github.com/corazawaf/libinjection-go/issues/46 Should I create an issue in corazawaf/coraza and link it to libinjection-go one, and then another one in corazawaf/coraza-caddy and link it to corazawaf/coraza or is that excessive? 😅

I forced to use Caddy’s module from @main which forced to use latest ruleset (and probably not only) - issue still persists.

{"level":"error","ts":1735291683.5235817,"logger":"http.handlers.waf","msg":"[client \"172.21.0.1\"] Coraza: Warning. XSS Attack Detected via libinjection [file \"@owasp_crs/REQUEST-941-APPLICATION-ATTACK-XSS.conf\"] [line \"4664\"] [id \"941100\"] [rev \"\"] [msg \"XSS Attack Detected via libinjection\"] [data \"Matched Data: XSS data found within ARGS:dgfd: <a href=\\\"https://github.com/Simbiat/database\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\">Database</a>\"] [severity \"critical\"] [ver \"OWASP_CRS/4.7.0\"] [maturity \"0\"] [accuracy \"0\"] [tag \"application-multi\"] [tag \"language-multi\"] [tag \"platform-multi\"] [tag \"attack-xss\"] [tag \"xss-perf-disable\"] [tag \"paranoia-level/1\"] [tag \"OWASP_CRS\"] [tag \"capec/1000/152/242\"] [hostname \"\"] [uri \"/api/fftracker/characters\"] [unique_id \"lDgDVoYOdCzrHXVZ\"]"}

Thanks @Simbiat. I’ll have to play around with this one a bit.