Skip to content

Commit

Permalink
Fixed safe-eval's setup
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianstaicu committed Jun 20, 2023
1 parent 731e711 commit 345a69f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions templates_sandboxes/safe-eval.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
let code = `
const fs = require("fs"), path = require("path");
let code = fs.readFileSync(path.resolve(__dirname, "./exploit.js")).toString(); // put your exploit in this file

//YOUR CODE HERE;
console.log("Prototype before:");
console.log(Object.prototype);

`;


let leak = console.log;
let endows = {leak:leak}
let endows = {leak:()=>{}, stats:{}}
let safeEval = require("safe-eval");
safeEval("1;" + code, endows);
console.log("Done");
console.log(Object.prototype.p, {}.polluted, Object.prototype.FEA, Object.prototype.FET, Object.prototype.FIA, Object.prototype.FIT, Object.prototype.CCA, Object.prototype.CCT);

console.log("Prototype after:");
console.log(Object.prototype);
2 changes: 1 addition & 1 deletion templates_sandboxes/vm2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const fs = require("fs"), path = require("path");
let code = fs.readFileSync(path.resolve(__dirname, "./exploit.js")).toString();
let code = fs.readFileSync(path.resolve(__dirname, "./exploit.js")).toString(); // put your exploit in this file

console.log("Prototype before:");
console.log(Object.prototype);
Expand Down

0 comments on commit 345a69f

Please sign in to comment.