GHSA-9V3J-4J64-P937

Vulnerability from github – Published: 2023-11-27 23:28 – Updated: 2023-11-27 23:28
VLAI?
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

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "oro/platform"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "4.1.0"
            },
            {
              "last_affected": "4.1.13"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "oro/platform"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "4.2.0"
            },
            {
              "last_affected": "4.2.10"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "oro/platform"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "5.0.0"
            },
            {
              "fixed": "5.0.8"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2022-41951"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2023-11-27T23:28:52Z",
    "nvd_published_at": "2023-11-27T21:15:07Z",
    "severity": "HIGH"
  },
  "details": "### Impact\nPath Traversal is possible in `Oro\\Bundle\\GaufretteBundle\\FileManager::getTemporaryFileName`. \nWith 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. \n\n### Workarounds\nApply patch\n```patch\n--- a/vendor/oro/platform/src/Oro/Bundle/GaufretteBundle/FileManager.php\n+++ b/vendor/oro/platform/src/Oro/Bundle/GaufretteBundle/FileManager.php\n@@ -614,6 +614,10 @@\n      */\n     public function getTemporaryFileName(string $suggestedFileName = null): string\n     {\n+        if ($suggestedFileName) {\n+            $suggestedFileName = basename($suggestedFileName);\n+        }\n+\n         $tmpDir = ini_get(\u0027upload_tmp_dir\u0027);\n         if (!$tmpDir || !is_dir($tmpDir) || !is_writable($tmpDir)) {\n             $tmpDir = sys_get_temp_dir();\n\n```\n\nOr decorate `Oro\\Bundle\\GaufretteBundle\\FileManager::getTemporaryFileName` in your customization and clear `$suggestedFileName` argument\n\n```php\n    public function getTemporaryFileName(string $suggestedFileName = null): string\n    {\n        if ($suggestedFileName) {\n            $suggestedFileName = basename($suggestedFileName);\n        }\n\n        return parent::getTemporaryFileName($suggestedFileName);\n    }\n```\n\n### References\n - [Path Traversal](https://owasp.org/www-community/attacks/Path_Traversal)\n - [How to Decorate Services](https://symfony.com/doc/5.4/service_container/service_decoration.html)\n\n",
  "id": "GHSA-9v3j-4j64-p937",
  "modified": "2023-11-27T23:28:52Z",
  "published": "2023-11-27T23:28:52Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/oroinc/platform/security/advisories/GHSA-9v3j-4j64-p937"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-41951"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/oroinc/platform"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "OroPlatform vulnerable to path traversal during temporary file manipulations"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…