-
Notifications
You must be signed in to change notification settings - Fork 20
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
Security items #25
Comments
@jchesterpivotal provided the following: Regular Expression Denial of Service Attacks (ReDOS)A malicious user can submit a JSON object intended to cause explosive backtracking by a JSONPath implementation performing regular expression matching. This is known as a ReDOS [REDOS] attack. To defend against this attack, regular expressions in JSONPath filters SHOULD conform to RE2 syntax [RE2SYNTAX], which does not support backtracking. (but MAY not support "\C" - move this to the filter section). Additionally, implementations SHOULD guarantee linear run time for regular expression matching, such as provided by the original RE2 library implementation [RE2IMPL] and Go's "regexp" library [GOREG]. Informative References[GOREG] The Go Authors, "Package regexp", January 2007, [RE2IMPL] The RE2 Authors, "RE2", March 2010, [RE2SYNTAX] [REDOS] Crosby, SA. and DS. Wallach, "Denial of Service via |
@jchesterpivotal suggested adding the following to the Security Considerations section: Out of scope attacksEavesdropping, replay, message insertion, deletion, modification and man-in-the-middle attacks are considered out of scope for JSONPath. These attacks are relevant to a network protocol, but not to a query language. |
Granted, but I'm not sure this would be in-scope for the RFC. |
Agreed about specific solutions not being in scope for the RFC. At most, I think we can identify several potential risks, but:
As an exaample of point 2, an implementation that is designed for applications that run on Windows obviously cannot run in Linux. |
Would it be worth giving special consideration to concerns for JavaScript in the security considerations? RFC 8259 does this, and there are similar concerns for this document too. For instance, some naïve implementations of JSONPath in JavaScript could run into trouble with paths that refer to things like JavaScript is special here in that it's very popular and there is a very strong conventional representation for JSON data -- whatever It may be worth talking to seasoned JavaScript security practitioners if we want to make any comment on the perils of walking arbitrary properties of |
It may be worth mentioning that the recursive descent operator is a possible security issue. Naïve implementations that simply recurse down the stack may be vulnerable to attack, and would likely fail suitably designed fuzzer tests. At the least, the specification should require a limit to the depth of recursion. |
How big of JSON objects are we talking about here? It's not like GraphQL where you can actually have requests for circular data. JSON is most definitely finite, and surely other mechanisms, such as limits on request size (an application concern), would capture JSON objects large enough to cause recursion issues. Unless your available call stack is really small, I suppose. But environmental awareness seems like a concern of either the app or the implementation, not this spec. |
We're talking about attack files that are specifically generated to exploit vulnerabilities. That's what fuzz testing is about, bombarding your function calls with simulated attack files on a continuous basis, to detect whether your API is vulnerable to malicious attackers. Recursive algorithms are a big source of security vulnerabilities. Daniel |
We still have to write the Security Considerations section. |
Let's use this issue to capture possible items for the Security Considerations section of the spec.
As discussed in #14, CPU exploits are possible using selectors such as:
One mitigation would be to run the implementation in an environment, such as a Linux cgroup, which can restrict the CPU consumed.
The text was updated successfully, but these errors were encountered: