[php-src] Issue #12418: Remove -- usage from session ID creation
| From: | OpreaFlorin | Date: | Wed, 11 Oct 2023 14:25:17 +0000 |
| Subject: | [php-src] Issue #12418: Remove -- usage from session ID creation | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245546@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12418
Author: OpreaFlorin
### Description
When a COOKIE ID containing the character sequence '--' is generated, mod_security thinks
it's a SQL injection and returns a 404 error. This sequence should be avoided, or the
'-' character could be replaced with '_'. However, the sequence '--'
in the session ID creates a lot of problems.
SecRule
REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/*
"@rx (?:/\*!?|\*/|[';]--|--[\s\r\n\v\f]|--[^-]*?-|[^&-]#.*?[\s\r\n\v\f]|;?\\x00)"
\
`SecRule
REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/*
"(/\*!?|\*/|[';]--|--[\s\r\n\v\f]|(?:--[^-]*?-)|([^\-&])#.*?[\s\r\n\v\f]|;?\\x00)"
"phase:2,rev:'2',ver:'OWASP_CRS/2.2.9',maturity:'8',accuracy:'8',\
id:'981231',t:none,t:urlDecodeUni,block,\
msg:'SQL Comment Sequence Detected.'\
,severity:'2',capture,logdata:'Matched Data: %{TX.0} found within
%{MATCHED_VAR_NAME}:
%{MATCHED_VAR}',tag:'OWASP_CRS/WEB_ATTACK/SQL_INJECTION',tag:'WASCTC/WASC-19',tag:'OWASP_TOP_10/A1',tag:'OWASP_AppSensor/CIE1',tag:'PCI/6.5.2',setvar:tx.anomaly_score=+%{tx.critical_anomaly_score},setvar:tx.sql_injection_score=+1,setvar:'tx.msg=%{rule.msg}',setvar:tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/SQL_INJECTION-%{matched_var_name}=%{tx.0}"`