Cassandra Unauthenticated Access
With superuser access to Cassandra (through default credentials or disabled authentication), an attacker can read all application data, create new superuser accounts, and potentially achieve code execution through user-defined functions. Confirm access through Cassandra enumeration first.
Creating a Superuser Account
With superuser access, create a persistent backdoor account.
Creates a new superuser account. This requires superuser privileges on the current connection. The account persists across restarts.
Data Exfiltration
Dump high-value tables across all application keyspaces.
Iterates all application keyspaces and tables, dumping the first 50 rows from each. Adjust LIMIT for full extraction. Look for credentials, PII, and API keys.
UDF-Based Code Execution
Cassandra supports User-Defined Functions (UDFs) in Java and JavaScript. If enable_user_defined_functions = true and enable_scripted_user_defined_functions = true in cassandra.yaml, UDFs can execute arbitrary code on the server.
Warning
UDFs are disabled by default. When enabled, they run in a sandboxed JVM, but sandbox escapes have been found in older versions.
Creates a UDF that executes OS commands. Requires UDFs to be enabled in cassandra.yaml. Call it with: SELECT webapp.exec('id') FROM system.local;
webapp.exec('id')
---------------------------------------------
uid=999(cassandra) gid=999(cassandra) groups=999(cassandra)
JMX Exploitation (Port 7199)
Cassandra exposes JMX on port 7199 for management. JMX authentication is disabled by default. Use JMX to invoke MBeans for configuration changes or, with tools like beanshooter, for code execution.
JConsole provides a GUI to browse all MBeans. For CLI access, use jmxterm or beanshooter. JMX can expose heap dumps, thread info, and allow invoking management operations.
References
-
Cassandra: User-Defined FunctionsDOCS: Cassandra: User-Defined Functions, cassandra.apache.org/doc/latest/cassandra/cql/functions.html (opens in new tab)
Official docs on UDFs including Java and JavaScript support.
-
HackTricks: Pentesting CassandraTOOL: HackTricks: Pentesting Cassandra, hacktricks.wiki/en/network-services-pentesting/cassandra.html (opens in new tab)
Cassandra enumeration and exploitation reference.