Skip to content

Block dangerous extensions in static asset uploads by default - #6

Open
drdavella wants to merge 1 commit into
develop-7.0.xfrom
security/static-asset-baseline-extension-blocklist
Open

Block dangerous extensions in static asset uploads by default#6
drdavella wants to merge 1 commit into
develop-7.0.xfrom
security/static-asset-baseline-extension-blocklist

Conversation

@drdavella

Copy link
Copy Markdown

Summary

  • Add a hardcoded baseline blocklist of dangerous extensions to StaticAssetServiceImpl.validateFileExtension.
  • The blocklist runs before the existing allow/deny config-driven checks and always applies.

Why

validateFileExtension currently short-circuits to "accept anything" when both allowedFileExtensions and disabledFileExtensions are empty, which is the out-of-the-box configuration. A misconfigured deployment can therefore accept .jsp, .php, .war, .class, .svg (which can carry inline script), etc., through the admin asset upload endpoints.

The new baseline blocklist covers server-side script types (jsp, jspx, jspf, php variants, asp/aspx, cshtml, cer), native executables (exe, com, bat, cmd, sh, ps1), Java archives (war, ear, jar, class), htaccess, and svg. It runs first, so operators who set their own allow/deny lists still get this floor of protection.

Test plan

  • mvn -pl admin/broadleaf-contentmanagement-module -am compile
  • Manual: upload payload.jsp via /{sectionKey}/{id}/uploadAsset and confirm it is rejected with the existing "Invalid extension type of file." IOException, even with no disabled.file.extensions configured
  • Manual: upload a plain .jpg and confirm it still succeeds

Notes for reviewers

This tweaks a security control referenced in the repo threat model ("file upload abuse / path handling issues"). The current threat model notes that upload routes "appear to inspect file names/extensions" — this PR upgrades that from "appears to" to "always rejects a hardcoded floor of dangerous types." The mitigations line for that section should be updated.

🤖 Generated with Claude Code

validateFileExtension previously did nothing when both
allowedFileExtensions and disabledFileExtensions were empty (the
out-of-the-box configuration), meaning any extension was accepted.

Add a hardcoded baseline blocklist of extensions commonly used to
smuggle executable content into a static asset store (jsp/jspx/php
variants, asp/aspx, exe/bat/cmd/sh/ps1, war/ear/jar/class, svg,
htaccess). The blocklist runs before the config-driven allow/deny
checks and cannot be disabled, so a misconfigured deployment still
gets a baseline of protection.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@clevernyyyy

Copy link
Copy Markdown

Logo
Checkmarx One – Scan Summary & Details27207cc6-b396-405a-b221-f372bb30edd7


New Issues (3)

Medium: 1 · Low: 2

Checkmarx found the following issues in this Pull Request

# Severity Issue Source File / Package Checkmarx Insight
1 MEDIUM CVE-2026-19880 Maven-ch.qos.logback:logback-classic-1.5.32
detailsDescription: Path-traversal vulnerability in QOS.CH Sarl Logback-classic on Java (logback-classic module) allows path-traversal vulnerability. More specifically...
Attack Vector: NETWORK
Attack Complexity: LOW

ID: z05Q6f7AAZOxDIL5YVlwUVuHHxpvsmsOOtYIPkDDAmc%3D
Vulnerable Package
2 LOW Log_Forging admin/broadleaf-contentmanagement-module/src/main/java/org/broadleafcommerce/cms/admin/web/controller/AdminAssetUploadController.java: 155
detailsMethod at line 155 of /admin/broadleaf-contentmanagement-module/src/main/java/org/broadleafcommerce/cms/admin/web/controller/AdminAssetUploadCon...
ID: MibocdmfyJnHWbe0BBFbbMr88SE%3D
Attack Vector
3 LOW Log_Forging admin/broadleaf-contentmanagement-module/src/main/java/org/broadleafcommerce/cms/admin/web/controller/AdminAssetUploadController.java: 108
detailsMethod at line 108 of /admin/broadleaf-contentmanagement-module/src/main/java/org/broadleafcommerce/cms/admin/web/controller/AdminAssetUploadCon...
ID: zDhdH01KgFlNBFtyVUnKC5%2FKsL4%3D
Attack Vector

Communicate with Checkmarx by submitting a PR comment with @Checkmarx followed by one of the supported commands. Learn about the supported commands here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants