I have a source code for an application that recently started undergoing obfuscation. Each new version alters the names of symbols, shuffles the order of classes, and employs other strategies. However, in spite of the obfuscation, a human can easily determine the original unobfuscated symbol to which each obfuscated one corresponds by examining the surrounding context, their placement, and other hints.

Here's a sample of what the codes resemble: Side-By-Side Comparison of Unobfuscated and Obfuscated Source Codes

As you might notice, I've utilized different colors to indicate various pairings of matches. Recognizing the patterns surrounding each symbol is straightforward for a human, for example, you can easily deduce that FFIGNHDBKGD is meant to represent Data.

My goal to develop a machine learning model that can execute this mapping task autonomously, using unsupervised training. I've had varying success by testing proof-of-concepts with LSTM and CBOW models. However, I am strongly inclined to believe that a Transformer model would be best suited for this task.

I'm currently facing two main challenges:

  • The first one involves tokenizing the datasets. I can parse the code using an AST with 'tree-sitter,' but I am uncertain about handling the obfuscated symbols. Should I replace all instances of each symbol with a <MASK> token for example? Do I even need to parse the source code through an AST before?
  • The second challenge revolves around finding the most suitable model for this task. Would a pretrained GPT model be most effective, or should I consider training my own model from the beginning? What other alternatives might be available?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.