Disappearing Ink: Obfuscation Breaks N-gram Code Watermarks in Theory and Practice
Gehao Zhang, Eugene Bagdasarian, Juan Zhai, Shiqing Ma

TL;DR
This paper demonstrates that N-gram-based code watermarks are fundamentally vulnerable to obfuscation, providing formal proofs and experimental evidence that such watermarks cannot be reliably robust against sophisticated code transformations.
Contribution
The work formally proves the impossibility of robust N-gram watermarking under obfuscation and empirically validates this vulnerability across multiple schemes, models, and languages.
Findings
Watermarks fail to detect obfuscated code (AUROC ~ 0.5).
Obfuscation can reduce detection accuracy below 0.6.
Formal proof of the fundamental vulnerability of N-gram watermarking.
Abstract
Distinguishing AI-generated code from human-written code is becoming crucial for tasks such as authorship attribution, content tracking, and misuse detection. Based on this, N-gram-based watermarking schemes have emerged as prominent, which inject secret watermarks to be detected during the generation. However, their robustness in code content remains insufficiently evaluated. Most claims rely solely on defenses against simple code transformations or code optimizations as a simulation of attack, creating a questionable sense of robustness. In contrast, more sophisticated schemes already exist in the software engineering world, e.g., code obfuscation, which significantly alters code while preserving functionality. Although obfuscation is commonly used to protect intellectual property or evade software scanners, the robustness of code watermarking techniques against such transformations…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Malware Detection Techniques · Adversarial Robustness in Machine Learning · Software Engineering Research
