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

Performance Issue with resolveFunctionToArray when Dealing with Large Arrays #89

Open
lanvent opened this issue Sep 4, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@lanvent
Copy link
Contributor

lanvent commented Sep 4, 2023

Description:

When deobfuscating code that contains large array initializations (e.g., var item=Array(200000);), the library becomes unresponsive for an extended period of time. The resolveFunctionToArray function tries to expand the array to its full size, bloating the AST and causing performance issues.

Reproduce:

  1. Obfuscate the following code snippet using Obfuscator.io with the "Low" preset:
var item=Array(200000);
function hi() {
  item[2]=3;
  console.log("Hello World!");
}
  1. Attempt to deobfuscate the resulting code.

Possible Solutions:

  1. Implement a filter to skip array initializations over a certain size (e.g., 10,000 elements). If size field is a binary expression, need to evaluate to determine if it should be skipped.
  2. Add a timeout feature to resolveFunctionToArray.
  3. Limit the maximum size of an array that can be expanded in the AST.

I am not certain which approach is best, and would appreciate input from more experienced contributors like you.
Thanks again for developing such an excellent tool. Looking forward to future improvements.

@BenBaryoPX BenBaryoPX added the bug Something isn't working label Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants