-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent setting pk_ref cookie with an empty string; it is perceived as sql injection attempt #21170
Comments
@atom-box We are setting a json encoded array as cookie value. If no campaign details were provided for the visit, the first two values are empty strings. Which ends up in your example. We can't easily change that and if we would decide to do so, this can't be done before a new major release. |
Could we, in that case, not set the cookie at all and treat a cookie that is not set the same way as one without the values? |
As that's part of the tracking, the code would need to be able to handle the old and the new style of cookies. Setting an empty cookie wouldn't be the same, as the third and fourth value of the json encoded array are set and required. We could set null instead and implement a handling for that. But t.b.h. I'm pretty sure, that might only fix one of the problems a tracking behind a very restrictive waf would have. |
Hi, I originally raised this issue through the support page |
@tsteur Do you think this should be fixed? |
@sgiehl I guess it depends how easy it is to fix. It would be nice if it just worked out of the box with such WAF rules. If it's too much effort, then I would maybe rather wait until more people run into this issue. The least we should do though, is create an FAQ around Matomo and WAF rules. So it's clear that certain rules may be causing issues and trigger eg 403 response codes etc. |
Guess passing null instead of an empty string should be implemented quite easily. |
We might want to check if this causes similar issues |
Hello, 2023:10:18-12:36:08 securitysrv1-2 httpd[18459]: [security2:error] [pid 18459:tid 3861777216] [client 84.123.456.789:36647] [client 84.123.456.789] ModSecurity: Warning. Pattern match "([\\~\\!\\@\\#\\$\\%\\^\\&\\\\(\\)\\-\\+\\=\\{\\}\\[\\]\\|\\:\\;\"\\'\\\xc2\xb4\\\xe2\x80\x99\\\xe2\x80\x98\\`\\<\\>].?){8,}" at REQUEST_COOKIES:_pk_ref.6.8e6a. [file "/usr/apache/conf/waf/modsecurity_crs_sql_injection_attacks.conf"] [line "157"] [id "981172"] [rev "2"] [msg "Restricted SQL Character Anomaly Detection Alert - Total # of special characters exceeded"] [data "Matched Data: - found within REQUEST_COOKIES:_pk_ref.6.8e6a: [\x22\x22,\x22\x22,1697624257,\x22https://some.domain.tld/\x22]"] [ver "OWASP_CRS/2.2.7"] [maturity "9"] [accuracy "8"] [tag "OWASP_CRS/WEB_ATTACK/SQL_INJECTION"] [hostname "other.domain.tld"] [uri "/"] [unique_id "ZS-1GId9oroUJOVy24FkHwAAAOc"], referer: https://other.domain.tld/ My ITs have created some sort of exception for the empty string cookie. Thanks for the hard work ! |
We seem to have the same problem. |
Exactly same issue for us! |
Any idea if this will be fixed. |
Hey @Gazymodo, |
Thank you. |
Expected:
pk_ref will never be set with "" property.
Actual:
pk_ref is sometimes set with: ["", "", 1234567890, "https://www.example.com/"].
Why this is a problem:
Security software throws a false positive, seeing this as a SQL injection attempt.
Here is the original email from our user:
--
The text was updated successfully, but these errors were encountered: