Insufficient Type Distinction Affecting livewire/livewire package, versions <3.5.2


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.05% (18th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PHP-LIVEWIRELIVEWIRE-8171408
  • published9 Oct 2024
  • disclosed8 Oct 2024
  • creditJeremy Angele

Introduced: 8 Oct 2024

CVE-2024-47823  (opens in a new tab)
CWE-351  (opens in a new tab)

How to fix?

Upgrade livewire/livewire to version 3.5.2 or higher.

Overview

livewire/livewire is an A front-end framework for Laravel.

Affected versions of this package are vulnerable to Insufficient Type Distinction when validating uploaded files in the generateHashNameWithOriginalNameEmbedded() function. An attacker can execute code by uploading a file with a valid MIME type such as image/png which actually contains executable code and has an executable file extension like .php.

Note: This is only exploitable if the following conditions are met, illustrated in the snippet below:

  1. The affected application applies $file->getClientOriginalName() to filenames.

  2. Files are stored in a publicly accessible directory on the affected server.

  3. The affected server is configured to execute uploaded files.

class SomeComponent extends Component
{
    use WithFileUploads;

#[Validate(&#39;image|extensions:png&#39;)]
public $file;

public function save()
{
    $this-&gt;validate();

    $this-&gt;file-&gt;storeAs(
        path: &#39;images&#39;,
        name: $this-&gt;file-&gt;getClientOriginalName(),
        options: [&#39;disk&#39; =&gt; &#39;public&#39;],
    );
}

}

References

CVSS Scores

version 4.0
version 3.1