CVE-2022-41951: Oro/platform Path Traversal Vulnerability

HIGH
Advisory Identifier: GHSA-9v3j-4j64-p937
CVSS 8.5
CWE-22
Published
Advisory Summary

CVE-2022-41951 is a HIGH (CVSS 8.5) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Oro/platform libraries in the Packagist ecosystem. The issue involves oroplatform vulnerable to path traversal during temporary file manipulations. Remediation is available by upgrading affected packages to version 5.0.8.

CVE-2022-41951 at a Glance

CVE Identifier CVE-2022-41951
GHSA Identifier GHSA-9v3j-4j64-p937
Severity HIGH
CVSS v3.1 Base Score 8.5
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Oro/platform
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-41951

To remediate this vulnerability, upgrade all affected Oro/platform dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

oro/platform fixed: Latest secure release
Upgrade oro/platform to Latest secure release
oro/platform fixed: Latest secure release
Upgrade oro/platform to Latest secure release
oro/platform fixed: 5.0.8
Upgrade oro/platform to 5.0.8
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for oro/platform

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-41951, inspect your project dependencies for Oro/platform:

inspect dependencies for oro/platform

Analyze the terminal output to locate any version of Oro/platform in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.0.8), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Oro/platform, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 ```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 ```php public function getTemporaryFileName(string $suggestedFileName = null): string { if ($suggestedFileName) { $suggestedFileName = basename($suggestedFileName); } return parent::getTemporaryFileName($suggestedFileName); } ``` ### References - [Path Traversal](https://owasp.org/www-community/attacks/Path_Traversal) - [How to Decorate Services](https://symfony.com/doc/5.4/service_container/service_decoration.html)

CVE-2022-41951 Affected Oro/platform Versions

3 component(s)
Fixed Versions:
5.0.8
Product / Package Ecosystem Affected Versions Fixed Version
oro/platform
Packagist
≥ 4.1.0
≤ 4.1.13
oro/platform
Packagist
≥ 4.2.0
≤ 4.2.10
oro/platform
Packagist
≥ 5.0.0
< 5.0.8
5.0.8

References

Frequently Asked Questions

What is CVE-2022-41951?
CVE-2022-41951 is a security vulnerability in Oro/platform involving OroPlatform vulnerable to path traversal during temporary file manipulations under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Oro/platform versions are affected?
Affected versions include releases prior to 5.0.8 across affected packages: oro/platform.
What version fixes CVE-2022-41951?
Upgrading to 5.0.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is oro/platform affected?
Yes, oro/platform is affected in releases prior to Latest secure release, 5.0.8. Upgrade your dependency to Latest secure release, 5.0.8 or later.
What is the CVSS score of CVE-2022-41951?
CVE-2022-41951 has a CVSS v3.1 base score of 8.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2022-41951?
CVE-2022-41951 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Packagist dependencies for CVE-2022-41951?
Run the dependency tree command: 'inspect dependencies for oro/platform'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9v3j-4j64-p937",
  "modified" : "2023-11-27T23:28:52Z",
  "published" : "2023-11-27T23:28:52Z",
  "aliases" : [ "CVE-2022-41951" ],
  "summary" : "OroPlatform vulnerable to path traversal during temporary file manipulations",
  "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('upload_tmp_dir');\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",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "oro/platform"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.1.0"
      }, {
        "last_affected" : "4.1.13"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "oro/platform"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.2.0"
      }, {
        "last_affected" : "4.2.10"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "oro/platform"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.0.8"
      } ]
    } ]
  } ],
  "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"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-11-27T23:28:52Z",
    "nvd_published_at" : "2023-11-27T21:15:07Z"
  }
}