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

Protect against RegEx attacks in santising script input #139

Merged
merged 8 commits into from
May 26, 2023

Conversation

mxro
Copy link
Collaborator

@mxro mxro commented May 21, 2023

Fixes #117

The Nashorn Sandbox utilises Regular Expressions to inject 'poison pill' statements that can be used to interrupt scripts early that take too long time to execute. (This is not the only way one can protect against too long running scripts, another is using seperate threads).

Poison pills are defined here:

private final static List<PoisonPil> POISON_PILLS = Arrays.asList(

As suggested by MrLi2018, this PR adds a protection to the evaluation of regular expression.

A unit test is also included in the PR that asserts the regular expression attack cannot be exploited.

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

Successfully merging this pull request may close these issues.

A ReDoS vulnerability can be exploited after version 0.2.0
1 participant