Skip to content

fix(933110): prevent whitespace padding bypass in PHP upload detection#4546

Merged
fzipi merged 1 commit into
mainfrom
fix/933110
Mar 15, 2026
Merged

fix(933110): prevent whitespace padding bypass in PHP upload detection#4546
fzipi merged 1 commit into
mainfrom
fix/933110

Conversation

@fzipi
Copy link
Copy Markdown
Member

@fzipi fzipi commented Mar 15, 2026

what

  • add t:removeWhitespace transformation to rule 933110 so filenames with whitespace padding are normalized before regex evaluation
  • add 6 regression tests covering whitespace bypass variants (leading space, trailing space, multipart uploads, different PHP extensions)

why

  • rule 933110 can be bypassed by inserting whitespace in the filename (e.g. photo. php or photo.php ) because the regex requires the dot to be immediately followed by the extension, and only t:lowercase is applied
  • some backends (especially on Windows) strip whitespace from filenames, so photo.php could become photo.php and be executed as PHP

refs

  • coreruleset/security-tracker-private#37

…ection

Add t:removeWhitespace transformation to rule 933110 so filenames with
whitespace padding (e.g. "photo. php", "photo.php ") are normalized
before regex evaluation, preventing evasion of PHP extension detection.
@github-actions
Copy link
Copy Markdown
Contributor

📊 Quantitative test results for language: eng, year: 2023, size: 10K, paranoia level: 1:
🚀 Quantitative testing did not detect new false positives

Copy link
Copy Markdown
Member

@Xhoenix Xhoenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fzipi fzipi enabled auto-merge March 15, 2026 20:33
@fzipi fzipi disabled auto-merge March 15, 2026 20:39
@fzipi fzipi added this pull request to the merge queue Mar 15, 2026
Merged via the queue into main with commit 955e09d Mar 15, 2026
8 checks passed
@fzipi fzipi deleted the fix/933110 branch March 15, 2026 20:40
fzipi added a commit that referenced this pull request Mar 26, 2026
…upload detection

Backport upstream fixes from main (#4546, #4547, #4549) that add
t:removeWhitespace transformation to file upload detection rules,
preventing evasion via whitespace padding in filenames.

Rule 944140 (#4548) was not backported as it does not exist in v3.3.
fzipi added a commit that referenced this pull request Mar 27, 2026
* chore: pre-release v3.3.8

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>

* docs: update changes

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>

* ci: update versions

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>

* ci: add pre-commit file

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>

* fix: pre-commit fixes

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>

* ci: use go-ftw 0.6.4

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>

* fix(932180,933110,933111): prevent whitespace padding bypass in file upload detection

Backport upstream fixes from main (#4546, #4547, #4549) that add
t:removeWhitespace transformation to file upload detection rules,
preventing evasion via whitespace padding in filenames.

Rule 944140 (#4548) was not backported as it does not exist in v3.3.

* ci(lint): prevent duplicate workflow runs on PRs

Restrict push trigger to v3.3/dev and v3.3/master branches so that
pull requests only trigger the workflow once via the pull_request event,
instead of running both push and pull_request.

---------

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
fzipi added a commit that referenced this pull request Mar 28, 2026
Add t:removeWhitespace transformation to rules 932180, 933110, and 933111
to prevent file upload detection bypass via whitespace in filenames.

Backport of #4546, #4547, #4549 from main. Rule 944140 (#4548) skipped
as it does not exist in v3.3.
fzipi added a commit that referenced this pull request Mar 28, 2026
* chore: pre-release v3.3.9 (#4576)

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>

* fix: backport whitespace padding bypass fixes for 932180, 933110, 933111

Add t:removeWhitespace transformation to rules 932180, 933110, and 933111
to prevent file upload detection bypass via whitespace in filenames.

Backport of #4546, #4547, #4549 from main. Rule 944140 (#4548) skipped
as it does not exist in v3.3.

---------

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants