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

Parenthesis removed, resulting in altered execution #26

Open
greg00000 opened this issue Jan 8, 2020 · 2 comments
Open

Parenthesis removed, resulting in altered execution #26

greg00000 opened this issue Jan 8, 2020 · 2 comments

Comments

@greg00000
Copy link

var obj = {val:true}
alert( true  ||  (true &&  obj.value == true))  //true
alert( true  ||  true &&  obj.value == true)  //false
 
 becomes
 
var obj = { 'val': !![] };
alert(!![] || !![] && obj['value'] == !![]); //false
alert(!![] || !![] && obj['value'] == !![]); //false

Tested in Adobe ESTK after running Gulp with the following options:
{
compact: false,
controlFlowFlattening: false, //KILLS JSX
deadCodeInjection: false, //KILLS JSX
disableConsoleOutput: false,
identifierNamesGenerator: 'mangled',
renameGlobals: false,
selfDefending: false,
sourceMap: false,
stringArray: false,
rotateStringArray: false,
stringArrayEncoding: false,
splitStrings: false,
transformObjectKeys: false,
unicodeEscapeSequence: false
}

@greg00000
Copy link
Author

Here's another example where removal of parenthesis causes nested ternary to fail...

Original:
var shouldBeTrue = true ? (true? true : false) : false
alert( shouldBeTrue ) //true

Obfuscated:
var shouldBeTrue = !![] ? !![] ? !![] : ![] : ![];
alert(shouldBeTrue); //error

Thanks!

@greg00000
Copy link
Author

Also tested this at https://obfuscator.io/ and the removal of the parenthesis there is ok. Again, probably a matter of older ECMAscript, but without at least an option to leave the parenthesis alone during obfuscation, a lot of code will fail with Adobe products.

Also, my example would probably be more clear as:
alert( true || (true && "undefined" == true)) //true in ESTK
alert( true || true && "undefined" == true) //false in ESTK,

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

1 participant