Vulnerability DatabaseGHSA-9343-66h6-6cjr

GHSA-9343-66h6-6cjr: 
PHP vulnerability analysis and mitigation

Summary

FileUpload::create() validates the allowedTypes option against $fileData['type'], which is the Content-Type sent by the client. The uploaded content itself is never inspected, so a file of any content (e.g. PHP source, HTML, SVG) passes an "images only" policy by being labelled image/jpeg. isImage() is based on the same client value. Applications that rely on allowedTypes without allowedExtensions, store files under the client-supplied filename, and store them in a directory where PHP is executed are exposed to remote code execution. Otherwise the impact is limited to unexpected content being accepted (e.g. stored XSS if uploads are served back).

Details

Location: src/FileUpload.php, FileUpload::create(), allowedTypes check. In $_FILES, the 'type' value comes from the multipart Content-Type header and is fully controlled by the client. create() compares only this value with allowedTypes. The temporary file (tmp_name) is not examined, although the package already requires ext-fileinfo and uses mime_content_type() in fromFile(). The reference implementation tests/Example/UploadHandler.php uses allowedTypes without allowedExtensions and stores the file under basename($upload->name), which meets two of the three preconditions for code execution. Fix: when allowedTypes is set, create() now also detects the MIME type from the uploaded content with mime_content_type() and requires it to be in the list. If the type cannot be detected, the upload is rejected. The existing check of the client-supplied type is kept. The fix was contributed by @iefken. Note: allowlist entries that libmagic never reports (e.g. image/jpg, or text/csv, which may be detected as text/plain) will now reject those files until the detected type is added. Content detection does not replace extension validation; use allowedExtensions or generate the stored filename on the server.

PoC

<?php
require 'vendor/autoload.php';
use Koriym\FileUpload\FileUpload;
$tmp = tempnam(sys_get_temp_dir(), 'poc');
file_put_contents($tmp, "<?php\n// not an image\n");
$upload = FileUpload::create([
    'name' => 'avatar.php',
    'type' => 'image/jpeg',          // client-supplied
    'size' => filesize($tmp),
    'tmp_name' => $tmp,
    'error' => UPLOAD_ERR_OK,
], ['allowedTypes' => ['image/jpeg', 'image/png', 'image/gif']]);
var_dump(mime_content_type($tmp)); // "text/x-php"
var_dump($upload::class);          // FileUpload (accepted) in <= 1.0.0
var_dump($upload->isImage());      // true

Impact

This is a validation bypass (CWE-434 / CWE-345). Applications using koriym/file-upload <= 1.0.0 that rely on the allowedTypes option to restrict which files are accepted are affected: any content is accepted as long as the client labels it with an allowed MIME type. Remote code execution is possible only when an application also (1) does not use allowedExtensions, (2) stores the file under the client-supplied filename, and (3) stores it in a directory where the web server executes PHP. The example UploadHandler in this repository meets (1) and (2). Applications that serve uploaded files back may be exposed to stored XSS (HTML/SVG accepted as images). Users should upgrade to 1.0.1. As a workaround, always use allowedExtensions together with allowedTypes, or generate the stored filename on the server, and store uploads outside directories where PHP is executed.


Source: NVD

Related PHP vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-q4v7-v68c-x6hxHIGH8.7
  • PHP logoPHP
  • wallabag/wallabag
NoNoNov 13, 2026
GHSA-46jc-m2hq-v399MEDIUM6.4
  • PHP logoPHP
  • wallabag/wallabag
NoNoNov 13, 2026
GHSA-rr6m-92cx-w69qMEDIUM6.1
  • PHP logoPHP
  • wallabag/wallabag
NoNoNov 13, 2026
GHSA-q2r9-jqp3-5f26MEDIUM5.4
  • PHP logoPHP
  • wallabag/wallabag
NoNoNov 13, 2026
GHSA-9343-66h6-6cjrMEDIUM5.3
  • PHP logoPHP
  • koriym/file-upload
NoYesNov 12, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management