📕 FIELD MANUAL 22.1: CQL INJECTION (CASSANDRA BIG DATA)
Objective: We will inject commands into Apache Cassandra clusters by exploiting CQL (Cassandra Query Language) syntax.
0views
Classification: RED TEAM EYES ONLY
Objective: We will inject commands into Apache Cassandra clusters by exploiting CQL (Cassandra Query Language) syntax.
MITRE ATT&CK: T1190.
1. INTEL & RECON: IT LOOKS LIKE SQL, BUT IT'S NOT
Sección titulada «1. INTEL & RECON: PARECE SQL, PERO NO LO ES»CQL looks like SQL:
SELECT * FROM users WHERE id = '123';
Critical Differences for the Attacker:
- No JOINs: We will not be able to join tables to steal cross-referenced data.
- Strict PK: In older versions, we will ONLY be able to filter by the Primary Key.
- ALLOW FILTERING: To search by non-indexed columns, the query MUST include
ALLOW FILTERING.
2. WEAPONIZATION: FORCING THE FILTER
Sección titulada «2. WEAPONIZATION: FORZANDO EL FILTRO»TECHNIQUE: Property Injection
Sección titulada «TÉCNICA: Inyección de Propiedades»We often won't be able to easily change the WHERE logic due to partitioning restrictions, but we can inject execution options.
- Scenario: Backend concatenates input.
query = "SELECT * FROM logs WHERE type = '" + type + "'"; - Payload:
' ALLOW FILTERING;- In Cassandra, we will attempt to filter by a non-indexed column and trigger an error. By injecting
ALLOW FILTERING, we will enable the query and extract data that the developer thought was “protected” by the index restriction.
- In Cassandra, we will attempt to filter by a non-indexed column and trigger an error. By injecting
TECHNIQUE: JSON Injection (Modern Cassandra)
Sección titulada «TÉCNICA: JSON Injection (Modern Cassandra)»Cassandra supports insertion via JSON.
INSERT INTO users JSON '{"id": 1, "name": "..."}'
- Payload: If we control the JSON, we can attempt to overwrite attributes we shouldn't touch (privilege escalation) if the app simply concatenates the JSON string.
3. PURPLE TEAM VIEW (DEFENSE)
Sección titulada «3. PURPLE TEAM VIEW (DEFENSA)»- Defense:
- Prepared Statements: CQL supports
?just like SQL. We will always use prepared statements. - Input Validation: Cassandra is very strict with types (UUID, TimeUUID). We will validate the format before sending the query to prevent 99% of injections.
- Prepared Statements: CQL supports

