HIGH missing tlscassandra

Missing Tls in Cassandra

How Missing Tls Manifests in Cassandra

Missing TLS in Cassandra environments creates multiple attack vectors that are particularly dangerous due to Cassandra's distributed nature and typical deployment patterns. The most critical vulnerability occurs during inter-node communication, where Cassandra nodes exchange data and coordinate cluster operations over unencrypted channels. An attacker positioned on the same network can perform passive eavesdropping on gossip protocol traffic, capturing sensitive information including partition token assignments, schema definitions, and even data being replicated between nodes.

Client-to-node communication without TLS exposes application credentials and query data to interception. When applications connect using native protocol drivers, authentication tokens and query parameters travel in plaintext. This becomes especially problematic in hybrid cloud deployments where Cassandra clusters span multiple availability zones or connect to external applications.

Thrift API endpoints, though deprecated, remain active in many legacy Cassandra deployments. These endpoints lack authentication by default and transmit all data unencrypted when TLS is disabled. An attacker can exploit this to extract entire datasets without credentials. Even with native protocol enabled, misconfigured Cassandra instances may fall back to unencrypted Thrift connections.

Cross-site request forgery (CSRF) attacks become feasible when Cassandra web interfaces like OpsCenter or DataStax Studio are exposed without TLS. These interfaces often run on default ports with weak authentication, allowing attackers to execute administrative operations or extract data through crafted requests from authenticated users' browsers.

The Cassandra storage engine itself can leak data through unencrypted SSTable files on disk. While this isn't strictly a TLS issue, it compounds the problem when combined with network interception. Attackers who gain temporary file system access can extract data from un-encrypted SSTables, and TLS interception provides the network access needed to identify vulnerable nodes.

Real-world exploitation often follows this pattern: an attacker discovers a Cassandra cluster through network scanning, identifies nodes communicating over port 9042 (native protocol) or 7000 (inter-node), then uses tools like cqlsh or custom drivers to connect without authentication. Once connected, they can enumerate keyspaces, extract data, or even modify cluster configuration to persist their access.

Cassandra-Specific Detection

Detecting missing TLS in Cassandra requires examining both configuration files and network traffic patterns. Start with the Cassandra configuration files, particularly cassandra.yaml. Look for the client_encryption_options section - if enabled is set to false or the section is missing entirely, TLS is not enforced for client connections. Similarly, check server_encryption_options for inter-node communication encryption settings.

# Vulnerable configuration - TLS disabled
client_encryption_options:
    enabled: false
    optional: false

server_encryption_options:
    internode_encryption: none
    keystore: conf/.keystore
    truststore: conf/.truststore

Network scanning reveals TLS misconfigurations through service banners and protocol negotiation. Tools like openssl s_client can test TLS support on Cassandra ports:

# Test native protocol port
openssl s_client -connect cassandra-node:9042
# Test inter-node communication
openssl s_client -connect cassandra-node:7000

MiddleBrick scans Cassandra endpoints specifically for TLS enforcement, testing both client and server encryption configurations. The scanner attempts connections to standard Cassandra ports and reports when encryption is absent or improperly configured. It also checks for deprecated Thrift endpoints that might be exposed without authentication.

Application-level detection involves reviewing driver configurations in your application code. Many Cassandra drivers default to unencrypted connections unless explicitly configured otherwise. For Java applications using the DataStax driver:

// Vulnerable - no TLS configuration
Cluster cluster = Cluster.builder()
    .addContactPoint("127.0.0.1")
    .build();

Log analysis can reveal TLS issues through connection logs showing successful unauthenticated connections or protocol version mismatches. Look for entries indicating protocol versions below 4, which may suggest older, less secure connection methods.

MiddleBrick's black-box scanning approach is particularly effective for Cassandra because it tests the actual runtime behavior without requiring credentials or configuration access. The scanner attempts to establish connections to Cassandra endpoints and verifies whether encryption is enforced, providing immediate feedback on the security posture.

Cassandra-Specific Remediation

Remediating TLS issues in Cassandra requires both configuration changes and code updates. Begin with the cassandra.yaml configuration. Enable client encryption with a strong cipher suite:

client_encryption_options:
    enabled: true
    optional: false
    keystore: conf/.keystore
    keystore_password: 
    require_client_auth: true
    truststore: conf/.truststore
    truststore_password: 
    protocol: TLS
    algorithm: SunX509
    store_type: JKS
    cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA]

For inter-node communication, configure server encryption to prevent eavesdropping between Cassandra nodes:

server_encryption_options:
    internode_encryption: all
    keystore: conf/.keystore
    keystore_password: 
    truststore: conf/.truststore
    truststore_password: 
    protocol: TLS
    algorithm: SunX509
    store_type: JKS
    cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA]

Generate the required keystore and truststore files using the Java keytool:

# Generate keystore
keytool -genkey -alias cassandra -keyalg RSA -validity 365 -keystore conf/.keystore
# Generate truststore
keytool -import -alias cassandra -file cassandra.cer -keystore conf/.truststore

Update application code to enforce TLS connections. For the DataStax Java driver:

Cluster cluster = Cluster.builder()
    .addContactPoint("127.0.0.1")
    .withSSL(SSLConnection.conf()                .withKeystore('/path/to/keystore.jks')
                .withKeystorePassword('')
                .withTruststore('/path/to/truststore.jks')
                .withTruststorePassword('')
                .build())
    .build();

For Python applications using the Cassandra driver:

from cassandra.cluster import Cluster, SSLConnection
from cassandra.policies import DCAwareRoundRobinPolicy

ssl_opts = {
    'ca_certs': '/path/to/ca-bundle.crt',
    'certfile': '/path/to/client-cert.pem',
    'keyfile': '/path/to/client-key.pem',
    'ssl_version': 'TLSv1_2'
}

cluster = Cluster(
    ['127.0.0.1'],
    port=9042,
    ssl_options=ssl_opts,
    load_balancing_policy=DCAwareRoundRobinPolicy(local_dc='datacenter1')
)
session = cluster.connect()

Implement certificate validation in your applications to prevent man-in-the-middle attacks. Never disable certificate verification in production environments, even when using self-signed certificates.

Monitor TLS implementation effectiveness using Cassandra's built-in metrics. Enable client_encryption_options.metrics_enabled: true to track encrypted connection statistics. Set up alerts for any connections that fail to negotiate TLS, as these may indicate attempted bypasses of your security controls.

Regularly rotate TLS certificates and update cipher suites to maintain security against evolving threats. Configure Cassandra to reject connections using deprecated protocols like SSLv2 or SSLv3, and disable weak cipher suites that could be vulnerable to known attacks.

Related CWEs: encryption

CWE IDNameSeverity
CWE-319Cleartext Transmission of Sensitive Information HIGH
CWE-295Improper Certificate Validation HIGH
CWE-326Inadequate Encryption Strength HIGH
CWE-327Use of a Broken or Risky Cryptographic Algorithm HIGH
CWE-328Use of Weak Hash HIGH
CWE-330Use of Insufficiently Random Values HIGH
CWE-338Use of Cryptographically Weak PRNG MEDIUM
CWE-693Protection Mechanism Failure MEDIUM
CWE-757Selection of Less-Secure Algorithm During Negotiation HIGH
CWE-261Weak Encoding for Password HIGH

Frequently Asked Questions

How can I test if my Cassandra cluster is vulnerable to missing TLS attacks?
Use MiddleBrick to scan your Cassandra endpoints - it tests both client and server encryption configurations without requiring credentials. You can also manually test using openssl s_client against ports 9042 and 7000 to verify if encryption is enforced.
Does enabling TLS in Cassandra impact performance?
TLS adds minimal overhead to Cassandra operations - typically less than 5% latency increase for most workloads. The security benefits far outweigh this small performance cost, especially considering the severe risks of unencrypted data transmission.