A Microsoft Azure cloud platform customers using Linux in virtual machines have encountered a critical vulnerability (CVE-2021-38647) that allows remote code execution with root privileges. The vulnerability has been given the code name OMIGOD and is noteworthy because the issue exists in the OMI Agent application, which is quietly installed in Linux environments.
The OMI Agent is automatically installed and activated when using services such as Azure Automation, Azure Automatic Update, Azure Operations Management Suite, Azure Log Analytics, Azure Configuration Management, Azure Diagnostics, and Azure Container Insights. For example, Linux environments in Azure with monitoring enabled are vulnerable. The agent is part of the open OMI (Open Management Infrastructure Agent) package, which implements the DMTF CIM/WBEM stack for managing IT infrastructure.
The OMI Agent is installed on the system under the omsagent user and creates settings in /etc/sudoers to run a series of scripts with root privileges. During the operation of certain services, listening network sockets are created on network ports 5985, 5986, and 1270. Scanning with the Shodan service shows that there are over 15,000 vulnerable Linux environments online. Currently, a working prototype of an exploit is already available that allows executing one's code with root privileges on such systems.
The problem is exacerbated by the fact that OMI's application in Azure is not explicitly documented, and the OMI Agent is installed without warning — simply agreeing to the terms of the selected service during environment setup will automatically activate the OMI Agent, meaning that most users are unaware of its presence.
The exploitation method is trivial — it is sufficient to send an XML request to the agent while removing the header responsible for authentication. OMI uses authentication when receiving control messages to verify that the client has the right to send a particular command. The essence of the vulnerability is that by removing the "Authentication" header responsible for authentication from the message, szerver A sikeres ellenőrzés áthaladását tekinti, elfogadja a vezérlő üzenetet, és lehetővé teszi a parancsok végrehajtását root jogosultságokkal. Az önálló parancsok futtatásához elegendő az ExecuteShellCommand_INPUT parancs használata az üzenetben. Például az 'id' eszköz indításához elegendő egy kérés küldése: curl -H "Content-Type: application/soap+xml;charset=UTF-8" -k --data-binary "@http_body.txt" https://10.0.0.5:5986/wsman …
id
0
A Microsoft már kiadta az OMI 1.6.8.1 frissítését, amely kijavítja a sebezhetőséget, de ez még nem jutott el a Microsoft Azure felhasználóihoz (az új környezetekben egyelőre a régi OMI verzió van telepítve). Az ügynök automatikus frissítése nem támogatott, ezért a felhasználóknak kézzel kell frissíteniük a csomagot a 'dpkg -l omi' parancs használatával Debian/Ubuntu alatt vagy az 'rpm -qa omi' parancs használatával Fedora/RHEL alatt. A védelem ideiglenes megoldásaként ajánlott letiltani az 5985, 5986 és 1270 hálózati portokhoz való hozzáférést.
Az OMI 1.6.8.1-ben a CVE-2021-38647 mellett három másik sebezhetőséget (CVE-2021-38648, CVE-2021-38645 és CVE-2021-38649) is kijavítottak, amelyek lehetővé teszik egy nem privilegizált helyi felhasználó számára, hogy kódot futtasson root jogosultságokkal.
Forrás: opennet.ru
