CVE-2018-6334

CRITICAL9.8/ 10.0
Share:
Published: December 31, 2018 at 07:29 PM
Modified: May 6, 2025 at 05:15 PM
Source: cve-assign@fb.com

Vulnerability Description

Multipart-file uploads call variables to be improperly registered in the global scope. In cases where variables are not declared explicitly before being used this can lead to unexpected behavior. This affects all supported versions of HHVM prior to the patch (3.25.1, 3.24.5, and 3.21.9 and below).

CVSS Metrics

Base Score
9.8
Severity
CRITICAL
Vector String
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Weaknesses (CWE)

Source: cve-assign@fb.com
Source: nvd@nist.gov

AI Security Analysis

01 // Technical Summary

HHVM (HipHop Virtual Machine), a PHP runtime environment, is vulnerable to a global variable injection attack via multipart file uploads. This allows attackers to overwrite existing variables or introduce new ones in the global scope, potentially leading to remote code execution or other severe security breaches. This vulnerability affects all supported versions of HHVM prior to the patched versions.

02 // Vulnerability Mechanism

Step 1: Payload Preparation: The attacker crafts a malicious multipart/form-data request. This request includes a file upload with a specially crafted filename or data. The filename is designed to be interpreted as a PHP variable name, and the file data is designed to be the variable's value.

Step 2: Request Submission: The attacker sends the malicious multipart/form-data request to a web application running on HHVM.

Step 3: HHVM Processing: HHVM receives the request and begins processing the multipart file upload. The vulnerable code parses the request, extracting the file name and data.

Step 4: Variable Injection: Due to the vulnerability, the code fails to properly scope the variables. The crafted filename is treated as a variable name, and the file data is assigned as the variable's value, injecting the variable into the global scope.

Step 5: Exploitation (Potential): Depending on the injected variables and the application's code, the attacker can potentially achieve various malicious outcomes, such as modifying application behavior, gaining unauthorized access, or achieving remote code execution.

03 // Deep Technical Analysis

The vulnerability stems from an improper handling of multipart file uploads within HHVM. Specifically, when processing these uploads, the code fails to properly scope variables. When a variable is not declared before being used, it is implicitly created in the global scope. Attackers can craft malicious multipart file upload requests that include specially crafted file names or data. These crafted elements can be interpreted as variable names and values, allowing attackers to inject arbitrary variables into the global scope. This can lead to overwriting existing variables, potentially controlling application logic, or introducing new variables that, when used in conjunction with other vulnerabilities, could lead to remote code execution. The root cause is a lack of proper input validation and variable scoping during the parsing of multipart file upload data.

CVE-2018-6334 - CRITICAL Severity (9.8) | Free CVE Database | 4nuxd