CVE-2021-44549: Org.apache.sling.commons.messaging.mail Improper Certificate Validation Vulnerability

HIGH
Advisory Identifier: GHSA-c69w-jj56-834w
CVSS 7.4
CWE-295 CWE-297
Published
Advisory Summary

CVE-2021-44549 is a HIGH (CVSS 7.4) improper certificate validation vulnerability (CWE-295: Improper Certificate Validation) affecting Org.apache.sling.commons.messaging.mail libraries in the Maven ecosystem. The issue involves improper certificate validation and improper validation of certificate with host mismatch in apache sling commons messaging mail. Remediation is available by upgrading affected packages to version 2.0.

CVE-2021-44549 at a Glance

CVE Identifier CVE-2021-44549
GHSA Identifier GHSA-c69w-jj56-834w
Severity HIGH
CVSS v3.1 Base Score 7.4
CWE Classification CWE-295: Improper Certificate Validation
Affected Product Org.apache.sling.commons.messaging.mail
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2021-44549

To remediate this vulnerability, upgrade all affected Org.apache.sling.commons.messaging.mail dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.apache.sling:org.apache.sling.commons.messaging.mail fixed: 2.0
<dependency>
    <groupId>org.apache.sling</groupId>
    <artifactId>org.apache.sling.commons.messaging.mail</artifactId>
    <version>2.0</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.apache.sling

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2021-44549, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.apache.sling

Analyze the terminal output to locate any version of Org.apache.sling.commons.messaging.mail in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.apache.sling command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-295: Improper Certificate Validation, where the product does not validate, or incorrectly validates, a certificate. In Org.apache.sling.commons.messaging.mail, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Apache Sling Commons Messaging Mail provides a simple layer on top of JavaMail/Jakarta Mail for OSGi to send mails via SMTPS. To reduce the risk of "man in the middle" attacks additional server identity checks must be performed when accessing mail servers. For compatibility reasons these additional checks are disabled by default in JavaMail/Jakarta Mail. The SimpleMailService in Apache Sling Commons Messaging Mail 1.0 lacks an option to enable these checks for the shared mail session. A user could enable these checks nevertheless by accessing the session via the message created by SimpleMessageBuilder and setting the property mail.smtps.ssl.checkserveridentity to true. Apache Sling Commons Messaging Mail 2.0 adds support for enabling server identity checks and these checks are enabled by default. - https://javaee.github.io/javamail/docs/SSLNOTES.txt - https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html - https://github.com/eclipse-ee4j/mail/issues/429

CVE-2021-44549 Affected Org.apache.sling.commons.messaging.mail Versions

1 component(s)
Fixed Versions:
2.0
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.sling:org.apache.sling.commons.messaging.mail
Maven
< 2.0
2.0

References

Frequently Asked Questions

What is CVE-2021-44549?
CVE-2021-44549 is a security vulnerability in Org.apache.sling.commons.messaging.mail involving Improper Certificate Validation and Improper Validation of Certificate with Host Mismatch in Apache Sling Commons Messaging Mail under CWE-295: Improper Certificate Validation.
Which Org.apache.sling.commons.messaging.mail versions are affected?
Affected versions include releases prior to 2.0 across affected packages: org.apache.sling:org.apache.sling.commons.messaging.mail.
What version fixes CVE-2021-44549?
Upgrading to 2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is org.apache.sling.commons.messaging.mail affected?
Yes, org.apache.sling:org.apache.sling.commons.messaging.mail is affected in releases prior to 2.0. Upgrade your dependency to 2.0 or later.
What is the CVSS score of CVE-2021-44549?
CVE-2021-44549 has a CVSS v3.1 base score of 7.4 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2021-44549?
CVE-2021-44549 is classified under CWE-295: Improper Certificate Validation (The product does not validate, or incorrectly validates, a certificate.).
How can I check Maven dependencies for CVE-2021-44549?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.sling'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-c69w-jj56-834w",
  "modified" : "2022-01-04T19:09:34Z",
  "published" : "2021-12-16T14:12:49Z",
  "aliases" : [ "CVE-2021-44549" ],
  "summary" : "Improper Certificate Validation and Improper Validation of Certificate with Host Mismatch in Apache Sling Commons Messaging Mail",
  "details" : "Apache Sling Commons Messaging Mail provides a simple layer on top of JavaMail/Jakarta Mail for OSGi to send mails via SMTPS. To reduce the risk of \"man in the middle\" attacks additional server identity checks must be performed when accessing mail servers. For compatibility reasons these additional checks are disabled by default in JavaMail/Jakarta Mail. The SimpleMailService in Apache Sling Commons Messaging Mail 1.0 lacks an option to enable these checks for the shared mail session. A user could enable these checks nevertheless by accessing the session via the message created by SimpleMessageBuilder and setting the property mail.smtps.ssl.checkserveridentity to true. Apache Sling Commons Messaging Mail 2.0 adds support for enabling server identity checks and these checks are enabled by default. - https://javaee.github.io/javamail/docs/SSLNOTES.txt - https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html - https://github.com/eclipse-ee4j/mail/issues/429",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.sling:org.apache.sling.commons.messaging.mail"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-44549"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/eclipse-ee4j/mail/issues/429"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/eclipse-ee4j"
  }, {
    "type" : "WEB",
    "url" : "https://javaee.github.io/javamail/docs/SSLNOTES.txt"
  }, {
    "type" : "WEB",
    "url" : "https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread/l8p9h2bqvkj6rhv4w8kzctb817415b7f"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-295", "CWE-297" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-12-15T15:15:17Z",
    "nvd_published_at" : "2021-12-14T16:15:00Z"
  }
}