feat: prevent php session files to be uploaded#4412
Conversation
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
|
📊 Quantitative test results for language: |
There was a problem hiding this comment.
Pull request overview
This pull request adds protection against PHP session file upload attacks to prevent PHP session deserialization vulnerabilities, specifically addressing CVE-2025-54236 (Magento Session Reaper).
Changes:
- Adds new rule 933220 at paranoia level 2 to detect and block uploads of files matching PHP session naming patterns (sess_<session_id>)
- Includes comprehensive test coverage with 17 test cases covering various attack vectors and legitimate filenames
- Creates regex assembly file with pattern documentation for the session file detection
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| rules/REQUEST-933-APPLICATION-ATTACK-PHP.conf | Implements rule 933220 to detect PHP session file uploads via FILES, FILES_NAMES, and custom filename headers (X-Filename, X_Filename, X.Filename, X-File-Name) |
| regex-assembly/933220.ra | Defines the regex pattern assembly for detecting sess_ prefix followed by valid PHP session ID characters (20-256 chars) |
| tests/regression/tests/REQUEST-933-APPLICATION-ATTACK-PHP/933220.yaml | Provides comprehensive test coverage with 17 test cases including multipart uploads, various headers, path variations, and negative test cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot open a new pull request to apply changes based on the comments in this thread |
…4415) * Initial plan * Add test cases for comma and uppercase handling Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com>
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
|
Why PL2? Looks it can goes into PL1. |
|
Thank you very much for this PR, Felipe. I agree with @azurit - this rule should be in PL1. |
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
|
Moved to PL1! |
|
@fzipi Thank you, great work! |
what
why
refs