Skip to content
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

enhance: Wordpress rule to prevent listing uploads directories if misconfigured #1140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .appsec-tests/generic-wordpress-uploads-listing/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
appsec-rules:
- ./appsec-rules/crowdsecurity/generic-wordpress-uploads-listing.yaml
nuclei_template: generic-wordpress-uploads-listing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
id: generic-wordpress-uploads-listing
info:
name: generic-wordpress-uploads-listing
author: crowdsec
severity: info
description: generic-wordpress-uploads-listing testing
tags: appsec-testing
http:
- raw:
- |
GET /wp-content/uploads/ HTTP/1.1
Host: {{Hostname}}
- |
GET /wp-content/uploads/2024/ HTTP/1.1
Host: {{Hostname}}
- |
GET /wp-content/uploads/2024/10/ HTTP/1.1
Host: {{Hostname}}
- |
GET /wp-content/uploads/2024/10/fp-check.jpg HTTP/1.1
Host: {{Hostname}}
matchers:
- type: dsl
condition: and
dsl:
- "status_code_1 == 403"
- "status_code_2 == 403"
- "status_code_3 == 403"
- "status_code_4 == 404"

31 changes: 31 additions & 0 deletions appsec-rules/crowdsecurity/generic-wordpress-uploads-listing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: crowdsecurity/generic-wordpress-uploads-listing
description: "Protect Wordpress uploads directory from listing files"
rules:
- or:
- zones:
- URI_FULL
transform:
- lowercase
- urldecode
match:
type: regex
value: '/wp-content/uploads/$'
- zones:
- URI_FULL
transform:
- lowercase
- urldecode
match:
type: regex
value: '/wp-content/uploads/.*/$'

labels:
type: exploit
service: http
confidence: 2
spoofable: 0
behavior: "http:exploit"
label: "Protect Wordpress uploads directory from listing files"
classification:
- attack.T1595
- attack.T1190
1 change: 1 addition & 0 deletions collections/crowdsecurity/appsec-generic-rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ appsec-rules:
- crowdsecurity/base-config
- crowdsecurity/generic-freemarker-ssti
- crowdsecurity/generic-wordpress-uploads-php
- crowdsecurity/generic-wordpress-uploads-listing
appsec-configs:
- crowdsecurity/generic-rules
- crowdsecurity/appsec-default
Expand Down
1 change: 1 addition & 0 deletions collections/crowdsecurity/appsec-wordpress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ appsec-rules:
- crowdsecurity/vpatch-CVE-2024-1061
- crowdsecurity/vpatch-CVE-2024-1071
- crowdsecurity/generic-wordpress-uploads-php
- crowdsecurity/generic-wordpress-uploads-listing
appsec-configs:
- crowdsecurity/virtual-patching
description: "A virtual patching collection, suitable for WordPress websites"
Expand Down
Loading