CVE-2022-0543: Redis Lua Sandbox Escape and Remote Code Execution
In January 2022, Reginaldo Silva discovered a vulnerability in Redis (Debian-specific) that allows Lua sandbox escape.
A remote attacker with the ability to execute arbitrary Lua scripts could escape the Lua sandbox and execute arbitrary code on the host.
This vulnerability existed because the Lua library in some Debian/Ubuntu packages is provided as a dynamic library (Ubuntu Bionic and Trusty are not affected).
When the Lua interpreter initializes, the “package” variable is automatically populated, and that in turn permitted access to arbitrary Lua functionality.
For instance, we can use “package.loadlib” to load the modules from “liblua” library, then use this module to execute commands.
On March 11, Juniper Threat Labs observed attacks launching this exploit from their telemetry.
The attack attempts to download “russia.sh” using wget or curl from “106[.]246.224.219”.
It saves it as “/tmp/russ” and executes it.
This script (russia.sh) will further download and execute linux binaries from 160[.]16.58.163.
These binaries are identified to be variants of Muhstik bot.
This bot connects to an IRC server to receive commands which include the following:
1. Download files
2. Shell commands
3. Flood attacks
4. SSH brute force