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

Broken JSON serialization and JSON injection vulnerability #12

Open
j13z opened this issue Aug 11, 2021 · 3 comments
Open

Broken JSON serialization and JSON injection vulnerability #12

j13z opened this issue Aug 11, 2021 · 3 comments

Comments

@j13z
Copy link

j13z commented Aug 11, 2021

General information

  • SDK/Library version: 1.0.2
  • Java Version: 8

Issue description

The JSON serializer implementation does not properly JSON-encode string values. In fact, they are not encoded at all. See this critical line that constructs the JSON value (the right part after the colon) by just quoting the input string value and otherwise copying it unchanged:
https://github.com/paypal/paypalhttp_java/blob/master/paypalhttp/src/main/java/com/paypal/http/serializer/Json.java#L133

Combined with user-provided data, this allows JSON injection that leads to security vulnerabilities in the Checkout-Java-SDK library (e.g. manipulating OrdersCreateRequest via injection in user-provided address data) when no additional security measures are in place (e.g. restricting character sets or input lengths).

I created a commit on a forked repo that shows this defect with two failing tests: j13z@3dce573

@j13z
Copy link
Author

j13z commented Aug 12, 2021

Is there a reason why you don't just use Jackson or GSON for handling JSON?

@NadirHelix
Copy link

Hi,
this issue is affecting our customers and we would like to get it solved. It's a major security issue.
I'm a bit surprised that there is no reaction here?!

@foxt7ot
Copy link

foxt7ot commented Dec 13, 2021

I second this, any particular reason for using a custom JSON serializer when we have already have some amazing serializations libraries.

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