-
Notifications
You must be signed in to change notification settings - Fork 11
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
User can escape the sandbox language #29
Comments
Another example is using constructor (after adding methods): x = location.constructor.constructor("alert('x')")
x() |
Here is hacked eval function: def eval(str)
let fn = location.constructor.constructor("return $str")
return fn()
end
let factorial = eval("(function(n) {
return Array.from({length: n}, (_, i) => i + 1).reduce((a,b) => a * b, 1);
})")
echo factorial(10) |
I think that it will be not possible to protect the language, constructor can't be blacklisted because user can get the property dynamically: def eval(str)
let constructor = location["constructor"]["constructor"]
let fn = constructor("return $str")
return fn()
end I think that if someone wants to hack the language it's ok, but with the original issue of the template literal, the user can inject the code into the developer game. Which can be a problem and security. |
Actually previous example will not work, because Gaiman don't support mutlline strings: This code that currently works: let code = <<<CODE
(function(n) {
return Array.from({length: n}, (_, i) => i + 1).reduce((a,b) => a * b, 1);
})
CODE
let factorial = eval(code)
echo factorial(10) |
This is valid and it's interpreted by gaiman, and it's executed. This is potential XSS.
Reported upstream estools/escodegen#448
The text was updated successfully, but these errors were encountered: