CVE-2021-37714: Jsoup Uncaught Exception Vulnerability

HIGH
Advisory Identifier: GHSA-m72m-mhq2-9p6c
CVSS 7.5
CWE-835 CWE-248
Published
Advisory Summary

CVE-2021-37714 is a HIGH (CVSS 7.5) uncaught exception vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting Jsoup libraries in the Maven ecosystem. The issue involves uncaught exception in jsoup. Remediation is available by upgrading affected packages to version 1.14.2.

CVE-2021-37714 at a Glance

CVE Identifier CVE-2021-37714
GHSA Identifier GHSA-m72m-mhq2-9p6c
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
Affected Product Jsoup
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

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

How to Fix CVE-2021-37714

To remediate this vulnerability, upgrade all affected Jsoup 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.jsoup:jsoup fixed: 1.14.2
<dependency>
    <groupId>org.jsoup</groupId>
    <artifactId>jsoup</artifactId>
    <version>1.14.2</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.jsoup

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=org.jsoup

Analyze the terminal output to locate any version of Jsoup in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.14.2), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.jsoup 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-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. In Jsoup, 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

### Impact _What kind of vulnerability is it? Who is impacted?_ Those using jsoup to parse untrusted HTML or XML may be vulnerable to DOS attacks. If the parser is run on user supplied input, an attacker may supply content that causes the parser to get stuck (loop indefinitely until cancelled), to complete more slowly than usual, or to throw an unexpected exception. This effect may support a denial of service attack. ### Patches _Has the problem been patched? What versions should users upgrade to?_ Users should upgrade to jsoup 1.14.2 ### Workarounds _Is there a way for users to fix or remediate the vulnerability without upgrading?_ Users may rate limit input parsing. Users should limit the size of inputs based on system resources. Users should implement thread watchdogs to cap and timeout parse runtimes.

CVE-2021-37714 Affected Jsoup Versions

1 component(s)
Fixed Versions:
1.14.2
Product / Package Ecosystem Affected Versions Fixed Version
org.jsoup:jsoup
Maven
< 1.14.2
1.14.2

References

GitHub Advisory / Wiki ADVISORY
https://github.com/jhy/jsoup/security/advisories/GHSA-m72m-mhq2-9p6c
NVD — CVE-2021-37714 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-37714
Jsoup Source Repository REPOSITORY
https://github.com/jhy/jsoup
Jsoup Release RELEASE
https://jsoup.org/news/release-1.14.1
Jsoup Release RELEASE
https://jsoup.org/news/release-1.14.2
lists.apache.org/thread.html/r215009... WEB
https://lists.apache.org/thread.html/r215009dbf7467a9f6506d0c0024cb36cad30071010e62c9352cfaaf0@%3Cissues.maven.apache.org%3E
lists.apache.org/thread.html/r377b93... WEB
https://lists.apache.org/thread.html/r377b93d79817ce649e9e68b3456e6f499747ef1643fa987b342e082e@%3Cissues.maven.apache.org%3E
lists.apache.org/thread.html/r3d71f1... WEB
https://lists.apache.org/thread.html/r3d71f18adb78e50f626dde689161ca63d3b7491bd9718fcddfaecba7@%3Cissues.maven.apache.org%3E
lists.apache.org/thread.html/r50e9c9... WEB
https://lists.apache.org/thread.html/r50e9c9466c592ca9d707a5dea549524d19e3287da08d8392f643960e@%3Cissues.maven.apache.org%3E
lists.apache.org/thread.html/r685c52... WEB
https://lists.apache.org/thread.html/r685c5235235ad0c26e86d0ee987fb802c9675de6081dbf0516464e0b@%3Cnotifications.james.apache.org%3E
lists.apache.org/thread.html/r974046... WEB
https://lists.apache.org/thread.html/r97404676a5cf591988faedb887d64e278f522adcaa823d89ca69defe@%3Cnotifications.james.apache.org%3E
lists.apache.org/thread.html/rc33540... WEB
https://lists.apache.org/thread.html/rc3354080fc67fb50b45b3c2d12dc4ca2a3c1c78dad3d3ba012c038aa@%3Cnotifications.james.apache.org%3E
Jsoup Security Information SECURITY
https://security.netapp.com/advisory/ntap-20220210-0022
Jsoup Security Information SECURITY
https://www.oracle.com/security-alerts/cpuapr2022.html
Jsoup Security Information SECURITY
https://www.oracle.com/security-alerts/cpujan2022.html
Jsoup Security Information SECURITY
https://www.oracle.com/security-alerts/cpujul2022.html

Frequently Asked Questions

What is CVE-2021-37714?
CVE-2021-37714 is a security vulnerability in Jsoup involving Uncaught Exception in jsoup under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop').
Which Jsoup versions are affected?
Affected versions include releases prior to 1.14.2 across affected packages: org.jsoup:jsoup.
What version fixes CVE-2021-37714?
Upgrading to 1.14.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is jsoup affected?
Yes, org.jsoup:jsoup is affected in releases prior to 1.14.2. Upgrade your dependency to 1.14.2 or later.
What is the CVSS score of CVE-2021-37714?
CVE-2021-37714 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2021-37714?
CVE-2021-37714 is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop') (The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.).
How can I check Maven dependencies for CVE-2021-37714?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.jsoup'. 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-m72m-mhq2-9p6c",
  "modified" : "2022-02-08T20:59:16Z",
  "published" : "2021-08-23T19:42:38Z",
  "aliases" : [ "CVE-2021-37714" ],
  "summary" : "Uncaught Exception in jsoup",
  "details" : "### Impact\n_What kind of vulnerability is it? Who is impacted?_\nThose using jsoup to parse untrusted HTML or XML may be vulnerable to DOS attacks. If the parser is run on user supplied input, an attacker may supply content that causes the parser to get stuck (loop indefinitely until cancelled), to complete more slowly than usual, or to throw an unexpected exception. This effect may support a denial of service attack.\n\n### Patches\n_Has the problem been patched? What versions should users upgrade to?_\nUsers should upgrade to jsoup 1.14.2\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\nUsers may rate limit input parsing. Users should limit the size of inputs based on system resources. Users should implement thread watchdogs to cap and timeout parse runtimes.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.jsoup:jsoup"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.14.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jhy/jsoup/security/advisories/GHSA-m72m-mhq2-9p6c"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-37714"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jhy/jsoup"
  }, {
    "type" : "WEB",
    "url" : "https://jsoup.org/news/release-1.14.1"
  }, {
    "type" : "WEB",
    "url" : "https://jsoup.org/news/release-1.14.2"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r215009dbf7467a9f6506d0c0024cb36cad30071010e62c9352cfaaf0@%3Cissues.maven.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r377b93d79817ce649e9e68b3456e6f499747ef1643fa987b342e082e@%3Cissues.maven.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r3d71f18adb78e50f626dde689161ca63d3b7491bd9718fcddfaecba7@%3Cissues.maven.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r50e9c9466c592ca9d707a5dea549524d19e3287da08d8392f643960e@%3Cissues.maven.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r685c5235235ad0c26e86d0ee987fb802c9675de6081dbf0516464e0b@%3Cnotifications.james.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r97404676a5cf591988faedb887d64e278f522adcaa823d89ca69defe@%3Cnotifications.james.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rc3354080fc67fb50b45b3c2d12dc4ca2a3c1c78dad3d3ba012c038aa@%3Cnotifications.james.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220210-0022"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujan2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-248", "CWE-835" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-08-23T17:20:30Z",
    "nvd_published_at" : "2021-08-18T15:15:00Z"
  }
}