logo

Database

Java Unsafe Tls Renegotiation Enabled

Description

Detects when unsafe TLS renegotiation is explicitly enabled in Java applications. Unsafe TLS renegotiation is a critical security vulnerability that makes TLS connections susceptible to man-in-the-middle attacks by allowing an attacker to inject arbitrary data into an encrypted session.

Weakness:

332 - Use of insecure channel - Source code

Category: Information Collection

Detection Strategy

    Identifies calls to setProperty method in Java code

    Checks if the first argument matches 'sun.security.ssl.allowUnsafeRenegotiation' property name

    Verifies if the second argument is set to 'true', enabling unsafe renegotiation

    Reports a vulnerability when both conditions are found, indicating explicit enablement of unsafe TLS renegotiation

Vulnerable code example

public class TLSConfig {
    public void configureSSL() {
        // VULNERABLE: Enables unsafe TLS renegotiation which can lead to MITM attacks
        System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", true);
    }
}

✅ Secure code example

public class TLSConfig {
    public void configureSSL() {
        // Disable unsafe TLS renegotiation to prevent MITM attacks
        System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", false);
    }
}