OroPlatform vulnerable to path traversal during temporary file manipulations
The advisory, in context
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
Affected packages
Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.
From 4.1.0 through 4.1.13 (inclusive)
No fix recorded for this interval.
16 explicitly affected versions
4.1.0, 4.1.1, 4.1.1-rc, 4.1.1-rc2, 4.1.10, 4.1.11, 4.1.12, 4.1.13, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.1.6, 4.1.7, 4.1.8, 4.1.9
View affected-version evidence
{
"ranges": [
{
"events": [
{
"introduced": "4.1.0"
},
{
"last_affected": "4.1.13"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"4.1.0",
"4.1.1",
"4.1.1-rc",
"4.1.1-rc2",
"4.1.10",
"4.1.11",
"4.1.12",
"4.1.13",
"4.1.2",
"4.1.3",
"4.1.4",
"4.1.5",
"4.1.6",
"4.1.7",
"4.1.8",
"4.1.9"
]
}From 4.2.0 through 4.2.10 (inclusive)
No fix recorded for this interval.
11 explicitly affected versions
4.2.0, 4.2.1, 4.2.10, 4.2.2, 4.2.3, 4.2.4, 4.2.5, 4.2.6, 4.2.7, 4.2.8, 4.2.9
View affected-version evidence
{
"ranges": [
{
"events": [
{
"introduced": "4.2.0"
},
{
"last_affected": "4.2.10"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"4.2.0",
"4.2.1",
"4.2.10",
"4.2.2",
"4.2.3",
"4.2.4",
"4.2.5",
"4.2.6",
"4.2.7",
"4.2.8",
"4.2.9"
]
}From 5.0.0 before 5.0.8
Fixed in 5.0.8
8 explicitly affected versions
5.0.0, 5.0.1, 5.0.2, 5.0.3, 5.0.4, 5.0.5, 5.0.6, 5.0.7
View affected-version evidence
{
"ranges": [
{
"events": [
{
"introduced": "5.0.0"
},
{
"fixed": "5.0.8"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"5.0.0",
"5.0.1",
"5.0.2",
"5.0.3",
"5.0.4",
"5.0.5",
"5.0.6",
"5.0.7"
]
}