Improper Certificate Validation

ID

scala.cryptography.scala_crypto_rule_weaktlsprotocol

Severity

low

Remediation Complexity

medium

Remediation Risk

medium

Remediation Effort

medium

Resource

Cryptography

Language

Scala

Description

A HostnameVerifier that accept any host are often use because of certificate reuse on many hosts. As a consequence, this is vulnerable to Man-in-the-middleattacks attacks since the client will trust any certificate.

Rationale

A HostnameVerifier that accept any host are often use because of certificate reuse on many hosts. As a consequence, this is vulnerable to Man-in-the-middleattacks attacks since the client will trust any certificate.

The following code illustrates a vulnerable pattern detected by this rule:

object TransportSetup {
  def configure(): Unit = {
    // VULNERABLE: Improper Certificate Validation
    new DefaultHttpClient

    try {
      // VULNERABLE: Improper Certificate Validation
      val legacy = SSLContext.getInstance("SSL")
      val current = SSLContext.getInstance("TLS")
    } catch {
      case e: NoSuchAlgorithmException =>
        e.printStackTrace
    }
  }
}

Remediation

Follow secure coding practices and review the references below for detailed remediation guidance.

Configuration

This detector does not need any configuration.

References

© 2026 Xygeni. All rights reserved