Advisory

GHSA-9v3j-4j64-p937

Also known as: CVE-2022-41951

Summary

OroPlatform vulnerable to path traversal during temporary file manipulations

Details

Impact
Path Traversal is possible in Oro\Bundle\GaufretteBundle\FileManager::getTemporaryFileName.
With this method, an attacker can pass the path to a non-existent file, which will allow writing the content to a new file that will be available during script execution. The file will be deleted immediately after the script ends.

Workarounds
Apply patch

--- a/vendor/oro/platform/src/Oro/Bundle/GaufretteBundle/FileManager.php
+++ b/vendor/oro/platform/src/Oro/Bundle/GaufretteBundle/FileManager.php
@@ -614,6 +614,10 @@
      */
     public function getTemporaryFileName(string $suggestedFileName = null): string
     {
+        if ($suggestedFileName) {
+            $suggestedFileName = basename($suggestedFileName);
+        }
+
         $tmpDir = ini_get('upload_tmp_dir');
         if (!$tmpDir || !is_dir($tmpDir) || !is_writable($tmpDir)) {
             $tmpDir = sys_get_temp_dir();

Or decorate Oro\Bundle\GaufretteBundle\FileManager::getTemporaryFileName in your customization and clear $suggestedFileName argument

    public function getTemporaryFileName(string $suggestedFileName = null): string
    {
        if ($suggestedFileName) {
            $suggestedFileName = basename($suggestedFileName);
        }

        return parent::getTemporaryFileName($suggestedFileName);
    }

References

Severity

High Basis: The source's own band: HIGH

Dates

Published
2023-11-27 23:28 UTC
Modified
2024-02-16 08:15 UTC

Affected packages and fixes

oro/platform

Packagist · All systems

Affected

  • introduced 4.1.0, last affected 4.1.13 (ecosystem)

Fixed versions

None listed

Fix

No fixed version is listed.

oro/platform

Packagist · All systems

Affected

  • introduced 4.2.0, last affected 4.2.10 (ecosystem)

Fixed versions

None listed

Fix

No fixed version is listed.

oro/platform

Packagist · All systems

Affected

  • introduced 5.0.0, fixed 5.0.8 (ecosystem)

Fixed versions

5.0.8

Fix

The export has no generic command for this ecosystem.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences