A bit of background about OpenVAS workflows
A user with sudo rights to run the openvas binary could escalate to root by supplying a custom configuration that points to a malicious plugin folder and a rogue Redis socket, then triggering a scan that executes the malicious NASL plugin. The plugin creates a root shell.
csal.medium.com
Published on csal.medium.com
It’s not a common scenario but if during a pentesting you get access to some machine with a user that has sudo rights to execute openvas, you could escalate privileges to get root!
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The openvas binary allows its configuration to be changed at runtime via the -c option, and the plugins_folder setting can point to an attacker-controlled directory containing a malicious NASL plugin that is executed during a scan.
Impact
An attacker with a shell as a user having sudo rights to execute openvas could escalate privileges to root, but this is not the default scenario and requires specific sudo configuration.
What the attacker needed
Shell as user with sudo rights to openvas; ability to run a modified ospd-openvas; ability to start a Redis instance
The fix
The sudo rights should be set to a user without shell access so that interaction is restricted to ospd-openvas and openvas command-line options cannot be manipulated.
How it was found
- Create a malicious NASL plugin in a directory (e.g., /tmp/plugins) that creates a root shell when executed, and include a valid plugin_feed_info.inc file.
- Create a malicious configuration file (e.g., /tmp/openvas.conf) that sets plugins_folder to the malicious directory and db_address to a rogue Redis socket.
- Start a private Redis instance listening on the socket specified in the configuration.
- Run a modified ospd-openvas that passes the -c option with the malicious configuration to openvas.
- Use a python-gvm script to connect to the ospd-openvas socket, add the malicious plugin to the scan, and start a scan.
- The malicious plugin executes and creates a root shell at /tmp/rootshell.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
OpenVAS is a tool that scans networks for vulnerabilities. If a user is allowed to run the openvas program with administrator rights (sudo), they can tell it to load extra scanning instructions from a folder they control. Those instructions can run commands as the administrator, so the user can become the all-powerful root user.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.