Skip to content

Commit

Permalink
Updated regex
Browse files Browse the repository at this point in the history
  • Loading branch information
OllieJC committed Dec 12, 2021
1 parent d0fb65e commit 56b1d4b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you'd like more control over filtering, suggest using Lambda@Edge and in part

The [faas_code/index.js](faas_code/index.js) attempts to capture bad inputs, it can also find base64 and test it (which systems may parse headers automatically before passing to log4j where it could be exploited).

The main _engine_ of the code is using the following regex: `/(\$|\%24)\s*(\{|\%7b)\s*jndi\s*(\:|\%3a)/im;`
The main _engine_ of the code is using the following regex: `/(?:\$|\%24)(?:\{|\%7b)[^\w]*?j[^\w]*?n[^\w]*?d[^\w]*?i[^\w]*?(?:\:|\%3a)/im;`

### Lambda@Edge

Expand Down
2 changes: 1 addition & 1 deletion faas_code/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function jndiMatch(value, isBase64) {

var res = false;

var jndiRegex = /(?:\$|\%24)\s*(?:\{|\%7b)\s*jndi\s*(?:\:|\%3a)/im;
var jndiRegex = /(?:\$|\%24)(?:\{|\%7b)[^\w]*?j[^\w]*?n[^\w]*?d[^\w]*?i[^\w]*?(?:\:|\%3a)/im;

if (value.match(jndiRegex)) {
res = true;
Expand Down

0 comments on commit 56b1d4b

Please sign in to comment.