javascript-deobfuscator icon indicating copy to clipboard operation
javascript-deobfuscator copied to clipboard

Function executor does not deal with array of literals and deletes code even if no replacement is found

Open canpadawan opened this issue 2 years ago • 0 comments

The following snippet does not simplify

function _0x1661() {
    "#execute";
    return ["str1", "str2"];
}
const foo = _0x1661()[0];

FunctionExecutor.replaceFunctionCalls() tries to replace the call by a literal value and fails (since we have a table of literals), so nothing gets replaced in the foo assigment (and cannot be simplified further).

The output is also not sound since the function is removed and the code can no longer be executed. Output is:

const foo = _0x1661()[0];

I don't know much about javascript, so there might be good reasons for not handling this. What you think?

canpadawan avatar Sep 20 '22 08:09 canpadawan