-
Notifications
You must be signed in to change notification settings - Fork 211
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
A Stack overflow error #201
Comments
Since Janino's parser is a stack-recursive one, deeply nested code structures can always lead to Don't know how to handle this. Catching the We could look at the call stack and verify that it contains mostly Any proposals? |
Also notice that allowing user input as code input for Janino is always an extremely risky operation, because the user is free to do something like
Only "educated" persons, like system administrators should be allowed to write Janino expressions (scripts, class bodies, compilation units). There exists a "Janino sandbox" that attempts to prevent the worst (such as the previous example), but (A) that janino sandbox does not work with JRE 17+ and (B) it cannot prevent all kinds of attempts, see https://janino-compiler.github.io/janino/#security. |
How to solve this problem. |
CVE-2023-33546 was assigned to this. Note: I didn't have any involvement in this assignment, I'm just posting here for reference. |
Is this issue ONLY occurs when using ExpressionEvaluator.guessParameterNames method? Otherwise, it is not affected? |
Would it be an option to set a (default) limit (that can be overridden) to the amount of open brackets you can have at a single time. For example a max of 100 and up a counter every time you hit an open bracket (and stop if the limit is reached) and lower the counter when you hit an end bracket. |
Difficult, because there are a zillion ways to notate nested structures in Java. |
Catch StackOverflowError in all relevant API methods 8e.g. "cook()" and "guessParameterNames()") and convert it into a CompileException.
Ok, I decided to catch the Please test! |
Hello @aunkrig , what are your plans to get this released? Thanks a lot! |
This user (PoppingSnack) has been irresponsibly raising issues across a large number of Java JSON tools (including Jackson, a lib that I work on). Most or all of these tools having documented approaches on how to report issues responsibly and this user has ignored them all. If there is any attempt by this user to claim credit and cash rewards for disclosing vulnerabilities, I hope that the Janino team will not give the user credit due to the irresponsible disclosure. |
As you want it, I will prepare a release ASAP. |
Release 3.1.10 is out the door. Please test. |
Thanks! |
You're welcome. |
Description
janino 3.1.9 and earlier are subject to denial of service (DOS) attacks when using the expression evaluator.guess parameter name method. If the parser runs on user-supplied input, an attacker could supply content that causes the parser to crash due to a stack overflow.
Error Log
Reproducing
The text was updated successfully, but these errors were encountered: