Researchers discovered that two vulnerabilities in the Apache OpenWhisk serverless cloud platform could have allowed malicious actors to overwrite and execute arbitrary code.
Apache OpenWhisk is an open source platform designed to execute code in response to events. The platform handles infrastructure and servers so that users can focus on developing their applications.
IBM’s Cloud Functions function-as-a-service (FaaS) platform is based on Apache OpenWhisk, which made it vulnerable to attacks.
Both Apache OpenWhisk developers and IBM have created patches that should prevent attacks.
According to PureSec, the vulnerabilities could have allowed an attacker – under certain conditions – to overwrite the source code of a function being executed in a container and influence subsequent executions in the same container, even if they were carried out by a different user.
Successful exploitation of the vulnerabilities could have resulted in sensitive data getting leaked, or the execution of rogue logic in parallel to a legitimate action’s original logic.
“In addition, an attacker may launch similar attacks in parallel, and in turn affect additional containers, turning the attack into a more persistent or wide-spread threat,” PureSec explained.
Specifically, PureSec says an attacker could have exploited the flaws to obtain sensitive user data, such as passwords, modify or delete information, mine cryptocurrencies, or launch distributed denial-of-service (DDoS) attacks.
OpenWhisk runs each action (function) inside a Docker container and interaction with the function involves a REST interface accessible over port 8080. Each container has two endpoints: /init, which receives the code to be executed, and /run, which receives the arguments for the action and executes the code.
If an attacker could find a vulnerability in the function, such as a remote code execution flaw, they may have been able to force it to launch a local HTTP request to the /init interface on port 8080 and overwrite its source code.
“[PureSec] research showed that for the affected function runtime, an attacker that successfully exploits an already vulnerable function — say by remote code execution or hijacking parameters — may replace the running code inside the container so that subsequent function invocations that reuse that container are now using the new code,” said Rodric Rabbah, one of the creators of Apache OpenWhisk.
“The Apache OpenWhisk community responded quickly to the PureSec research report and audited all the runtimes that are available for functions. This includes Node.js, Python, Swift, Java, PHP, and upcoming additions Ruby and Ballerina. All of the runtimes now detect when a function is attempting to mutate itself from inside a running container (in the way described by PureSec), and uniformly generate a warning message so that the developer can observe and respond to such attempts if their functions are vulnerable to code exploits,” Rabbah added.