# GHSA-J376-W3X3-Q674: Unauthenticated arbitrary file upload in FormBundle → RCE / stored XSS

- Database: GitHub
- Severity: CVSS 9.8 (Critical)
- Published: 2026-07-27
- Modified: 2026-10-01

## Affected versions

- kunstmaan/bundles-cms (Packagist): fixed in 7.3.1
- kunstmaan/form-bundle (Packagist): fixed in 7.3.1

## Description

### Summary
The public form-submission file field in KunstmaanFormBundle accepts uploads from **unauthenticated** visitors with **no file-type restriction**, and stores the file under its **client-supplied extension** (when server-side MIME guessing fails) in a **web-accessible** directory (`public/uploads/formsubmissions/`). An anonymous visitor can upload `shell.php` → RCE, or `.html`/`.svg` → stored XSS.

### Details
`src/Kunstmaan/FormBundle/Entity/FormSubmissionFieldTypes/FileFormSubmissionField.php`:
- The only constraint is `#[Assert\File(maxSize: '6000000')]` - no MIME/extension allow-list.
- `getSafeFileName()` does `$newExtension = $this->file->guessExtension() ?: $clientExtension`. `UploadedFile::guessExtension()` returns **null** for PHP content (`text/x-php` maps to no extension in Symfony `MimeTypes`), so the client extension `php` is preserved → stored as `shell.php`.
- `HasGuessableExtensionValidator` only checks that an extension *exists* (a `.php` client name satisfies it), not that it is safe.
`KunstmaanFormExtension` defaults `form_submission_rootdir` to `{project}/public/uploads/formsubmissions` (web-accessible; webdir `/uploads/formsubmissions/`). `FormHandler::onValidPost()` runs for **public** form submissions (no auth).

### PoC
Mechanism confirmed against real Symfony `UploadedFile` + `MimeTypes`:
upload=shell.php  guessExtension=NULL  -> STORED AS shell.php   (RCE)
upload=x.svg      guessExtension='svg' -> STORED AS x.svg       (stored XSS)
upload=x.html     guessExtension='html'-> STORED AS x.html      (stored XSS)


Over HTTP: submit any public form that has a file field, attaching `shell.php` (`<?php system($_GET['c']); ?>`). It is written to `public/uploads/formsubmissions/<uuid>/shell.php`, reachable at `https://TARGET/uploads/formsubmissions/<uuid>/shell.php`. The `<uuid>` uses `uniqid()` (time-based, predictable) and is exposed via the field's `__toString()`/`getUrl()`.

### Impact
Unauthenticated RCE where `public/` executes PHP (common Apache mod_php / broad nginx configs); unauthenticated stored XSS in all cases via `.html`/`.svg` served inline. Precondition: a page has a form with a file field (a normal Kunstmaan feature). Remediation: enforce a MIME/extension allow-list on the stored extension; never fall back to the client extension; store outside web root and serve with `Content-Disposition: attachment` + `nosniff`.

## References

- https://github.com/Kunstmaan/KunstmaanBundlesCMS/security/advisories/GHSA-j376-w3x3-q674

Page: https://cve.now/GHSA-J376-W3X3-Q674

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
