Skip to content
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

SyntaxError: 'return' outside of function #3

Open
10142904 opened this issue May 10, 2019 · 4 comments
Open

SyntaxError: 'return' outside of function #3

10142904 opened this issue May 10, 2019 · 4 comments

Comments

@10142904
Copy link

Hi,

     Thank you for fixing the test error, it is ok now. but when i deobfuscate a js, it report a error.

`[root@izbp1a5bxfhn22fz3yercfz illuminatejs]# ./node_modules/@babel/cli/bin/babel.js --plugins "./babel-plugin-deobfuscate/lib/illuminatejs.js" apu.js
Unknown loop control variable
Unknown loop control variable
Unknown loop control variable
Unknown loop control variable
{ SyntaxError: 'return' outside of function (1:27)
at Parser.pp$5.raise (/root/illuminatejs/babel-plugin-deobfuscate/node_modules/babylon/lib/index.js:4454:13)
at Parser.pp$1.parseReturnStatement (/root/illuminatejs/babel-plugin-deobfuscate/node_modules/babylon/lib/index.js:2066:10)
at Parser.pp$1.parseStatement (/root/illuminatejs/babel-plugin-deobfuscate/node_modules/babylon/lib/index.js:1848:19)
at Parser.pp$1.parseBlockBody (/root/illuminatejs/babel-plugin-deobfuscate/node_modules/babylon/lib/index.js:2268:21)
at Parser.pp$1.parseBlock (/root/illuminatejs/babel-plugin-deobfuscate/node_modules/babylon/lib/index.js:2247:8)
at Parser.pp$1.parseStatement (/root/illuminatejs/babel-plugin-deobfuscate/node_modules/babylon/lib/index.js:1868:19)
at Parser.pp$1.parseIfStatement (/root/illuminatejs/babel-plugin-deobfuscate/node_modules/babylon/lib/index.js:2059:26)
at Parser.pp$1.parseStatement (/root/illuminatejs/babel-plugin-deobfuscate/node_modules/babylon/lib/index.js:1846:19)
at Parser.pp$1.parseBlockBody (/root/illuminatejs/babel-plugin-deobfuscate/node_modules/babylon/lib/index.js:2268:21)
at Parser.pp$1.parseBlock (/root/illuminatejs/babel-plugin-deobfuscate/node_modules/babylon/lib/index.js:2247:8) pos: 27, loc: Position { line: 1, column: 27 } }

the `js's url is https://deloplen.com/apu.php?zoneid=2498696.

@wizche
Copy link
Contributor

wizche commented May 11, 2019

Any chance to get a minimal version of the JS causing the same error?

@10142904
Copy link
Author

there is a minmal version of the js which cause the same error
a.js.txt

@10142904
Copy link
Author

10142904 commented May 14, 2019

I found a mimnaler version of the js:

function aa(i) { var str = "abcde"; var a = 0; var f; var e; var Y = 0; for (; e = str.charAt(Y++); f = a%4?0:e) { } }
deobfuscate it get error:

TypeError: Expected node path of type Expression
at NodePath.(anonymous function) [as assertExpression] (/root/illuminatejs/node_modules/@babel/traverse/lib/path/index.js:206:13)
at Object.evaluateExpression (/root/illuminatejs/babel-plugin-deobfuscate/lib/expressions.js:30:10)
at evaluateInit (/root/illuminatejs/babel-plugin-deobfuscate/lib/identifiers.js:76:26)
at evaluate (/root/illuminatejs/babel-plugin-deobfuscate/lib/identifiers.js:51:20)
at evaluateExpression (/root/illuminatejs/babel-plugin-deobfuscate/lib/expressions.js:32:12)
at evaluateConditionalExpression (/root/illuminatejs/babel-plugin-deobfuscate/lib/expressions.js:81:22)
at evaluateExpression (/root/illuminatejs/babel-plugin-deobfuscate/lib/expressions.js:32:12)
at PluginPass.deobfuscateExpression (/root/illuminatejs/babel-plugin-deobfuscate/lib/expressions.js:20:18)
at PluginPass.newFn (/root/illuminatejs/node_modules/@babel/traverse/lib/visitors.js:230:17)
at newFn (/root/illuminatejs/node_modules/@babel/traverse/lib/visitors.js:193:21)

@Pghgqx3h
Copy link

Pghgqx3h commented Jun 25, 2019

INFO duplicate of issue#5

I have the second issue too: TypeError: Expected node path of type Expression

I broke it down to:

var a;
a % 4;

Full stack trace:

TypeError: Expected node path of type Expression
    at NodePath.(anonymous function) [as assertExpression] (/home/Pghgqx3h/Downloads/195/node_modules/@babel/traverse/lib/path/index.js:206:13)
    at Object.evaluateExpression (/home/Pghgqx3h/Downloads/195/babel-plugin-deobfuscate/lib/expressions.js:30:10)
    at evaluateInit (/home/Pghgqx3h/Downloads/195/babel-plugin-deobfuscate/lib/identifiers.js:76:26)
    at evaluate (/home/Pghgqx3h/Downloads/195/babel-plugin-deobfuscate/lib/identifiers.js:19:20)
    at Object.evaluateExpression (/home/Pghgqx3h/Downloads/195/babel-plugin-deobfuscate/lib/expressions.js:32:12)
    at /home/Pghgqx3h/Downloads/195/babel-plugin-deobfuscate/lib/functions.js:70:76
    at Array.map (<anonymous>)
    at Object.evaluatedArguments (/home/Pghgqx3h/Downloads/195/babel-plugin-deobfuscate/lib/functions.js:70:34)
    at evaluateMemberCall (/home/Pghgqx3h/Downloads/195/babel-plugin-deobfuscate/lib/call-expressions.js:122:26)
    at evaluate (/home/Pghgqx3h/Downloads/195/babel-plugin-deobfuscate/lib/call-expressions.js:28:22)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants