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

GroovyEngine.execute cause an OOM exception #909

Closed
sirnple opened this issue Dec 7, 2023 · 3 comments
Closed

GroovyEngine.execute cause an OOM exception #909

sirnple opened this issue Dec 7, 2023 · 3 comments

Comments

@sirnple
Copy link

sirnple commented Dec 7, 2023

version: 3.24.1

Reproduced code:

public void executeFuzzerTest() {
        try {
            GroovyEngine groovyEngine = new GroovyEngine();
            Object result = groovyEngine.execute("/\n/*777777777777777777777777777777");
        } catch (Exception e) {
        }
}
@carnil
Copy link

carnil commented Dec 29, 2023

This seems to have a CVE assigned: CVE-2023-50572

@atulajoshi24
Copy link

atulajoshi24 commented Jan 2, 2024

I tested this on latest version 3.25.0 , but the programme goes into infinite loop with no termination. It keeps on executing indefinitely. Tested on Open JDK 17

@mattirn
Copy link
Collaborator

mattirn commented Jan 18, 2024

The method GroovyEngine.execute(...) is used by JLine groovy REPL demo application to evaluate groovy/java statements. In underneath the method uses groovy.lang.GroovyShell.evaluate(...) method which will throw OOM exception when passing the statement above as a parameter, see the output when it is executed on Groovy shell:
groovy-shell-oom

I have not seen the executeFuzzerTest() enter into infinite loop but as you can enter an arbitrary groovy/java statement to the GroovyEngine.execute(...) method you can easily create also infinite loop groovyEngine.execute("while (true) {}").

When I tried to executeFuzzerTest() on groovy REPL demo application I found an other OOM exception when trying to display the execution result that is fixed on commit f3c60a3 .

The method GroovyEngine.execute(...) works as designed.

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

4 participants