Generating Adversarial Computer Programs using Optimized Obfuscations
Shashank Srikant, Sijia Liu, Tamara Mitrovska, Shiyu Chang, Quanfu Fan, Gaoyuan Zhang, Una-May O'Reilly
Abstract
Machine learning (ML) models that learn and predict properties of computer programs are increasingly being adopted and deployed. These models have demonstrated success in applications such as auto-completing code, summarizing large programs, and detecting bugs and malware in programs. In this work, we investigate principled ways to adversarially perturb a computer program to fool such learned models, and thus determine their adversarial robustness. We use program obfuscations, which have conventionally been used to avoid attempts at reverse engineering programs, as adversarial perturbations. These perturbations modify programs in ways that do not alter their functionality but can be crafted to deceive an ML model when making a decision. We provide a general formulation for an adversarial program that allows applying multiple obfuscation transformations to a program in any language. We develop first-order optimization algorithms to efficiently determine two key aspects -- which parts of the program to transform, and what transformations to use. We show that it is important to optimize both these aspects to generate the best adversarially perturbed program. Due to the discrete nature of this problem, we also propose using randomized smoothing to improve the attack loss landscape to ease optimization. We evaluate our work on Python and Java programs on the problem of program summarization. We show that our best attack proposal achieves a improvement over a state-of-the-art attack generation approach for programs trained on a seq2seq model. We further show that our formulation is better at training models that are robust to adversarial attacks.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
19 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- ContraBERT: Enhancing Code Pre-trained Models via Contrastive Learning cites Adversarial examples for models of code
- ContraBERT: Enhancing Code Pre-trained Models via Contrastive Learning cites Generating Adversarial Examples for Holding Robustness of Source Code Processing Models
- ContraBERT: Enhancing Code Pre-trained Models via Contrastive Learning cites Natural Attack for Pre-trained Models of Code
- Generating Adversarial Examples for Holding Robustness of Source Code Processing Models cites Towards Evaluating the Robustness of Neural Networks
- RoPGen: Towards Robust Code Authorship Attribution via Automatic Coding Style Transformation cites Adversarial examples for models of code
- RoPGen: Towards Robust Code Authorship Attribution via Automatic Coding Style Transformation cites Generating Adversarial Examples for Holding Robustness of Source Code Processing Models
- RoPGen: Towards Robust Code Authorship Attribution via Automatic Coding Style Transformation cites Misleading Authorship Attribution of Source Code using Adversarial Learning
- Natural Attack for Pre-trained Models of Code cites Adversarial examples for models of code
- Natural Attack for Pre-trained Models of Code cites Generating Adversarial Examples for Holding Robustness of Source Code Processing Models
- Intriguing Properties of Adversarial ML Attacks in the Problem Space cites Towards Evaluating the Robustness of Neural Networks
- Intriguing Properties of Adversarial ML Attacks in the Problem Space cites Misleading Authorship Attribution of Source Code using Adversarial Learning
- An extensive study on pre-trained models for program understanding and generation cites Adversarial examples for models of code
- Uncovering the Limits of Machine Learning for Automatic Vulnerability Detection cites Adversarial examples for models of code
- Uncovering the Limits of Machine Learning for Automatic Vulnerability Detection cites Generating Adversarial Examples for Holding Robustness of Source Code Processing Models
- Uncovering the Limits of Machine Learning for Automatic Vulnerability Detection cites Natural Attack for Pre-trained Models of Code
- Misleading Authorship Attribution of Source Code using Adversarial Learning cites Towards Evaluating the Robustness of Neural Networks
Cited by top-tier papers19
- Natural Attack for Pre-trained Models of CodeZhou Yang, Jieke Shi, Junda He, David LoICSE 2022 · 150 citations
- An extensive study on pre-trained models for program understanding and generationZhengran Zeng, Hanzhuo Tan, Haotian Zhang, Jing Li et al.ISSTA 2022 · 142 citations
- Uncovering the Limits of Machine Learning for Automatic Vulnerability DetectionNiklas Risse, Marcel BöhmeUSENIX Security 2024 · 63 citations
- ContraBERT: Enhancing Code Pre-trained Models via Contrastive LearningShangqing Liu, Bozhi Wu, Xiaofei Xie, Guozhu Meng et al.ICSE 2023 · 56 citations
- RoPGen: Towards Robust Code Authorship Attribution via Automatic Coding Style TransformationZhen Li, Qian (Guenevere) Chen, Chen Chen, Yayi Zou et al.ICSE 2022 · 39 citations
Builds on6
- Towards Evaluating the Robustness of Neural NetworksNicholas Carlini, David A. WagnerS&P 2017 · 9,786 citations
- Intriguing Properties of Adversarial ML Attacks in the Problem SpaceFabio Pierazzi, Feargus Pendlebury, Jacopo Cortellazzi, Lorenzo CavallaroS&P 2020 · 334 citations
- Adversarial examples for models of codeNoam Yefet, Uri Alon, Eran YahavOOPSLA 2020 · 162 citations
- Generating Adversarial Examples for Holding Robustness of Source Code Processing ModelsHuangzhao Zhang, Zhuo Li, Ge Li, Lei Ma et al.AAAI 2020 · 148 citations
- Misleading Authorship Attribution of Source Code using Adversarial LearningErwin Quiring, Alwin Maier, Konrad RieckUSENIX Security 2019 · 123 citations
Related papers
- Adversarial Robustness for CodePavol Bielik, Martin T. VechevICML 2020 · 101 citations
- ObscuraCoder: Powering Efficient Code LM Pre-Training Via Obfuscation GroundingIndraneil Paul, Haoyi Yang, Goran Glavas, Kristian Kersting et al.ICLR 2025
- Attacks against Abstractive Text Summarization Models through Lead Bias and Influence FunctionsPoojitha Thota, Shirin NilizadehEMNLP Findings 2024 · 7 citations
- Discrete Adversarial Attack to Models of CodeFengjuan Gao, Yu Wang, Ke WangPLDI 2023 · 23 citations
- Trust Me, I Know This Function: Hijacking LLM Static Analysis using BiasShir Bernstein, David Beste, Daniel Ayzenshteyn, Lea Schönherr et al.NDSS 2026 · 7 citations
