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
[Java] "Deserialization of user-controlled data" is overly broad to be useful to end users #11603
Comments
|
It looks like XStream is now secure by default as well: https://x-stream.github.io/security.html Looking at CodeQL, it's incorrectly flagging code as vulnerable if there isn't a call to |
|
Is that as of a particular version? Can we recognise if the user is using a new enough version e.g. by looking for new or changed method signatures? |
I don't know. But the general policy AFAIK has been to always write queries against the latest version and not to assume that the user is using out-of-date vulnerable versions. I believe the idea has been that suggesting dependency updates has been outside of the scope of CodeQL. |
From that doc:
|
|
👍 ok agreed that we should change our alerting behaviour to match the library's changed characteristics. PR welcome to flip that around, or if you'd prefer to leave it to us I'll make an issue :) Are there libs you're aware of that have gone secure-by-default besides XStream and Kyro? |
|
Related #11912 |
|
I'd like to propose that we continue to work on this problem, specifically with Here are some examples of messages that could be generated to better communicate the reason WHY this vulnerability is present.
|
|
We'll need to keep these brief since they're one-line-ish descriptions that get shown inline with source code (the qhelp gets to be more verbose), but where compatible with that constraint I agree this would be useful. For example, the Kyro message could be |
Why? This seems like an artificial limitation. What's the rationale, besides UI elements expecting it? Couldn't this be changed to support more complex formatted reports specific to the project? |
|
Because they look like this: https://github.com/github/codeql/security/code-scanning/2401 If I hack that to include quite a long message it looks like this: You can see how that would really drown the user in text if there were lots of these in a file, particularly if they were using a narrow display. Also note we have the qhelp below which can give extra detail, so I'd suggest something more like |
What about exposing a header and a 'details' section? Also, personally, I don't see an issue with this amount of data if we can provide more actionable information in this message with more specific links to locations in the code where the vulnerabilities root cause lies. For example, the place where a jackson |



Description of the issue
Looking at all the results that "Deserialization of user-controlled data" returns, from Alibaba
JSON.parseObject, to Kryo, to XStream, to Java Deserialization, the results are all over the place. But the advice is incredibly simplistic and only provides a single example on how to fix this.https://codeql.github.com/codeql-query-help/java/java-unsafe-deserialization/
Deserialization of user-controlled data has a massive impact, usually RCE, but the documentation on how, or even why, you might need to fix it, is basically completely missing.
The one example
ObjectInputStreamis useful, but how do I fix Kryo, how do I fix Alibaba JSON, how does CodeQL know that a givenObjectMapperfrom Jackson is configured to be vulnerable? None of this information is captured either in the documentation, or in the query results (for example, whatObjectMapperhasenableDefaultTyping()enabled).I'm a security researcher, and I know how these are vulnerable, but scrolling through the results on LGTM.com (which I know is about to die), most of these, I don't know how I'd fix them.
Additionally, you see results like
JSON.parseObject(httpResponse.getHttpContentString())getting flagged, and from what I can see from documentation, this was potentially fixed? Maybe? I though CodeQL had a policy against flagging vulnerabilities that can be fixed with a dependency update. Why this is getting flagged is inherently unclear.https://jfrog.com/blog/cve-2022-25845-analyzing-the-fastjson-auto-type-bypass-rce-vulnerability/
In summary, this is a significant vulnerability finding, with potentially massive impact, but the CodeQL documentation doesn't do it justice, and doesn't give valuable information to the end user on determining if they are truly vulnerable, and then how to fix it.
The text was updated successfully, but these errors were encountered: