Published on 2023-01-18

Improper Privilege Management vulnerability in Rapid7 Velociraptor in the copy() function.

Velociraptor allows users to be created with different privileges on the server. Administrators are generally allowed to run any command on the server including writing arbitrary files. However, lower privilege users are generally forbidden from writing or modifying files on the server.

The VQL copy() function applies permission checks for reading files but does not check for permission to write files. This allows a low privilege user (e.g. users with the Velociraptor "investigator" role) to overwrite files on the server, including Velociraptor configuration files.

To exploit this vulnerability, the attacker must already have a Velociraptor user account at a low privilege level (at least "analyst"). Be able to log into the GUI and create a notebook where they can run the VQL query invoking the copy() VQL function. Typically most users deploy Velociraptor with limited access to a trusted group (most users will be administrators within the GUI).

This vulnerability is associated with program files https://github.Com/Velocidex/velociraptor/blob/master/vql/filesystem/copy.go and program routines copy().

This issue affects Velociraptor: before 0.6.7-5.

Required configuration for exposure:

Velociraptor deployment with multiple users at lower roles than administrators (e.g. "investigator" and above)

Problem:

CWE-269 Improper Privilege Management CWE-269

Impact:

CAPEC-75 Manipulating Writeable Configuration Files CAPEC-75

Product Status:

ProductAffected
Rapid7 Velociraptor » VQL copy() function on Linux, Windows, MacOS, 64 bit, 32 bit
package reposource repohttps://github.com/Velocidex/velociraptor/blob/master/vql/filesystem/copy.gocopy()
Default status is unaffected
before 0.6.7-5 (unaffected from 5)

Solution:

Upgrade to 0.6.7-5

Workaround:

A valid workaround is to prevent the copy function in the Velociraptor allow list:

1. In the configuration wizard answer yes to the question "Do you want to restrict VQL functionality on the server?"
2. This will add a default allow list to the configuration file.
3. Copy this allow list to your existing server.config.yaml
4. Ensure the "copy" function is removed from the default allow list.

Credits:

Paul Alkemade from Telstra

Timeline:

  • 2023-01-12 - Notification of the issue
  • 2023-01-17 - Release 0.6.7-5 made available on Github