Obfuscated Clone Search in JavaScript based on Reinforcement Subsequence Learning
Finding similar code is important for software engineering, defense of intellectual property, and security, and one of the increasingly common ways adversaries use to defeat the detection of similar code is through obfuscations such as code transformation and scattering the code they wish to hide among long sequences. Moving code far enough apart poses a specific challenge for solutions with localized features (e.g., n-grams), or attention mechanisms as the code parts are distributed beyond the local context window. We introduce a neural network solution pattern called “Cybertron” that addresses this problem by utilizing reinforcement learning to train a code abstraction and summarization function; this converts arbitrarily long code into fixed-length real vectors in a way that is optimized for similarity search. The key to the design is the smart selection of important elements of the code and abstraction to preserve semantic function while minimizing syntactic feature information. We evaluated the approach on a three-challenge benchmark of obfuscated JavaScript, a scripting language that is commonly obfuscated and for which code-mixing is a rising challenge. The evaluation shows our approach identifies obfuscated code within even large scripts with an AUC of 78%, which outperforms current state-of-the-art sequence models by 7–35%.
Authors
- Weihan Ou (ORCID: https://orcid.org/0000-0002-6911-6146)
- Steven H. H. Ding (ORCID: https://orcid.org/0000-0003-4513-200X)
- Leo Song
- Philippe Charland (ORCID: https://orcid.org/0000-0003-4051-9942)
- Andrew Walenstein (ORCID: https://orcid.org/0000-0003-1103-2465)
- Litao Li (ORCID: https://orcid.org/0000-0001-7925-764X)
- Yuan Tian (ORCID: https://orcid.org/0000-0002-2208-3893)
Institutions
- Defence Research and Development Canada (CA)
- Queen's University (CA)
- Blackberry (Canada) (CA)
- McGill University (CA)
Publication Details
- Journal
- ACM Transactions on Software Engineering and Methodology
- Published
- 2025-02-07
- DOI
- https://doi.org/10.1145/3711903
- Primary Topic
- Software Engineering Research
- Type
- article
- Field-Weighted Citation Impact
- 0.00