Analysis of the XZ Backdoor: Advanced Capabilities within OpenSSH
In a continuation of our exploration into the XZ backdoor, which we initially discussed in a prior article, we delve deeper into its operational intricacies within OpenSSH. For those unfamiliar, we recommend Baeldung's discussion on SSH authentication methods and JFrog's insights into privilege separation in SSH to grasp the foundational concepts relevant to our analysis.
Key Discoveries in the XZ Backdoor's Operation
Our thorough investigation into the backdoor’s behavior in the most recent version of OpenSSH portable (9.7p1) has unearthed several significant functionalities:
Detailed Functional Analysis
Function Hooking Specifics
The backdoor targets several critical functions within the OpenSSH architecture:
Interestingly, EVP_PKEY_set1_RSA is absent in this version of OpenSSH, suggesting its inclusion as a remnant from other SSH utilities or older versions.
Recommended by LinkedIn
RSA Key Manipulation
The backdoor intercepts RSA key usage specifically during the pre-authentication phase of a client session, where it parses and modifies the RSA key's modulus to embed malicious payloads.
Innovative Key Extraction via Steganography
Our analysis revealed that the backdoor reconstructs a public key hidden within the binary itself using a custom algorithm that scans for specific x86 instructions. This technique resembles gadget scanning in return-oriented programming but is used here to reconstruct cryptographic keys.
Command Execution and Log Hiding
The backdoor supports several commands, enabling actions from logging in as root to executing commands under specific user privileges. It cleverly conceals its activity by hooking into the SSH server's logging functions, selectively filtering or altering log outputs to avoid detection.
Conclusion
The XZ backdoor represents a sophisticated and well-engineered piece of malware with profound implications for SSH security. Its ability to manipulate key functions within OpenSSH and clever use of steganography and logging manipulation underscores the advanced capabilities of its developers. This series of articles aims to provide a comprehensive understanding of its mechanisms to better prepare the cybersecurity community for such threats.
Further research and vigilance are required to counteract such sophisticated threats, which exploit core functionalities of widely used open-source projects. Kaspersky has recognized the threat posed by this backdoor, labeling related malicious objects under various detections, highlighting the ongoing battle against advanced cybersecurity threats.
This deep dive into the XZ backdoor’s operation within OpenSSH not only illuminates the technical sophistication behind such threats but also serves as a crucial reminder of the need for continual advancements in cybersecurity defenses.