Lucene search
K

XenForo 2.2.13 ArchiveImport.php Zip Slip

🗓️ 31 Jan 2024 00:00:00Reported by EgiX, karmainsecurity.comType 
packetstorm
 packetstorm
🔗 packetstormsecurity.com👁 489 Views

XenForo 2.2.13 Zip Slip Vulnerability in ArchiveImport.ph

Code
`------------------------------------------------------------  
XenForo <= 2.2.13 (ArchiveImport.php) Zip Slip Vulnerability  
------------------------------------------------------------  
  
  
[-] Software Link:  
  
https://xenforo.com  
  
  
[-] Affected Versions:  
  
Version 2.2.13 and prior versions.  
  
  
[-] Vulnerability Description:  
  
The vulnerability is located in the  
/src/XF/Service/Style/ArchiveImport.php script. Specifically, into the  
"ArchiveImport::extractFilesToTempDir()" method:  
  
198. public function extractFilesToTempDir()  
199. {  
200. $zip = $this->zip();  
201. $DS = \XF::$DS;  
202.  
203. if ($this->extracted)  
204. {  
205. return;  
206. }  
207.  
208. for ($i = 0; $i < $zip->numFiles; $i++)  
209. {  
210. $zipFileName = $zip->getNameIndex($i);  
211. $fsFileName = $this->getFsFileNameFromZipName($zipFileName);  
212. if ($fsFileName === null)  
213. {  
214. continue;  
215. }  
216.  
217. $finalFileName = $this->tempDir . $DS . $fsFileName;  
218.  
219. $dataStream = $zip->getStream($zipFileName);  
220. @File::writeFile($finalFileName, $dataStream, false);  
221. }  
  
The vulnerability exists because the above code is using the filename  
provided within the Zip archive ($zipFileName variable created at line  
210) to write the extracted file by using "File::writeFile()" at line  
220, without properly verifying whether it contains Path Traversal  
sequences. This could be exploited to carry out Zip Slip (or Path  
Traversal) attacks and write/overwrite arbitrary files on the web  
server, resulting in execution of arbitrary PHP code or other security  
impacts. Successful exploitation of this vulnerability requires an  
account with permissions to administer styles.  
  
  
[-] Solution:  
  
Upgrade to version 2.2.14 or later.  
  
  
[-] Disclosure Timeline:  
  
[02-01-2024] - Vendor notified  
[17-01-2024] - CVE identifier requested  
[24-01-2024] - Vendor replied a fix will be available in the next release  
[30-01-2024] - Version 2.2.14 released  
[30-01-2024] - Publication of this advisory  
  
  
[-] CVE Reference:  
  
The Common Vulnerabilities and Exposures project (cve.mitre.org) has  
not assigned a CVE identifier for this vulnerability.  
  
  
[-] Credits:  
  
Vulnerability discovered by Egidio Romano.  
  
  
[-] Other References:  
  
https://xenforo.com/tickets/BC37EB98/?v=5da7bd5728  
  
  
[-] Original Advisory:  
  
http://karmainsecurity.com/KIS-2024-01  
`

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation