Obfuscation (software) explained
In software development, obfuscation is the act of creating source or machine code that is difficult for humans or computers to understand. Like obfuscation in natural language, it may use needlessly roundabout expressions to compose statements. Programmers may deliberately obfuscate code to conceal its purpose (security through obscurity) or its logic or implicit values embedded in it, primarily, in order to prevent tampering, deter reverse engineering, or even to create a puzzle or recreational challenge for someone reading the source code. This can be done manually or by using an automated tool, the latter being the preferred technique in industry.[1]
Overview
The architecture and characteristics of some languages may make them easier to obfuscate than others.[2] [3] C,[4] C++,[5] [6] and the Perl programming language[7] are some examples of languages easy to obfuscate. Haskell is also quite obfuscatable[8] despite being quite different in structure.
The properties that make a language obfuscatable are not immediately obvious.
Techniques
Types of obfuscations include simple keyword substitution, use or non-use of whitespace to create artistic effects, and self-generating or heavily compressed programs.
According to Nick Montfort, techniques may include:
- naming obfuscation, which includes naming variables in a meaningless or deceptive way;
- data/code/comment confusion, which includes making some actual code look like comments or confusing syntax with data;
- double coding, which can be displaying code in poetry form or interesting shapes.[9]
Automated tools
A variety of tools exist to perform or assist with code obfuscation. These include experimental research tools created by academics, hobbyist tools, commercial products written by professionals, and open-source software. Deobfuscation tools also exist that attempt to perform the reverse transformation.
Although the majority of commercial obfuscation solutions work by transforming either program source code, or platform-independent bytecode as used by Java and .NET, there are also some that work directly on compiled binaries.
Recreational
Writing and reading obfuscated source code can be a brain teaser. A number of programming contests reward the most creatively obfuscated code, such as the International Obfuscated C Code Contest and the Obfuscated Perl Contest.
Short obfuscated Perl programs may be used in signatures of Perl programmers. These are JAPHs ("Just another Perl hacker").[14]
Cryptographic
Cryptographers have explored the idea of obfuscating code so that reverse-engineering the code is cryptographically hard. This is formalized in the many proposals for indistinguishability obfuscation, a cryptographic primitive that, if possible to build securely, would allow one to construct many other kinds of cryptography, including completely novel types that no one knows how to make. (A stronger notion, black-box obfuscation, is known to be impossible in general.)[15] [16]
Disadvantages of obfuscation
- While obfuscation can make reading, writing, and reverse-engineering a program difficult and time-consuming, it will not necessarily make it impossible.[17]
- It adds time and complexity to the build process for the developers.
- It can make debugging issues after the software has been obfuscated extremely difficult.
- Once code is no longer maintained, hobbyists may want to maintain the program, add mods, or understand it better. Obfuscation makes it hard for end users to do useful things with the code.
- Certain kinds of obfuscation (i.e. code that isn't just a local binary and downloads mini binaries from a web server as needed) can degrade performance and/or require Internet.
Notifying users of obfuscated code
Some anti-virus softwares, such as AVG AntiVirus,[18] will also alert their users when they land on a website with code that is manually obfuscated, as one of the purposes of obfuscation can be to hide malicious code. However, some developers may employ code obfuscation for the purpose of reducing file size or increasing security. The average user may not expect their antivirus software to provide alerts about an otherwise harmless piece of code, especially from trusted corporations, so such a feature may actually deter users from using legitimate software.
Mozilla and Google disallow browser extensions containing obfuscated code in their add-ons store.[19] [20]
Obfuscation and copyleft licenses
There has been debate on whether it is illegal to skirt copyleft software licenses by releasing source code in obfuscated form, such as in cases in which the author is less willing to make the source code available. The issue is addressed in the GNU General Public License by requiring the "preferred form for making modifications" to be made available.[21] The GNU website states "Obfuscated 'source code' is not real source code and does not count as source code."[22]
Decompilers
A decompiler can reverse-engineer source code from an executable or library. Decompilation is sometimes called a man-in-the-end (mite) attack, based on the traditional cryptographic attack known as "man-in-the-middle". It puts source code in the hands of the user, although this source code is often difficult to read. The source code is likely to have random function and variable names, incorrect variable types, and use different logic than the original source code (due to compiler optimizations).
Model obfuscation
Model obfuscation is a technique to hide the internal structure of a machine learning model.[23] Obfuscation turns a model into a black box. It is contrary to explainable AI. Obfuscation models can also be applied to training data before feeding it into the model to add random noise. This hides sensitive information about the properties of individual and groups of samples.[24]
See also
Further reading
- Seyyedhamzeh, Javad, ABCME: A Novel Metamorphic Engine, 17th National Computer Conference, Sharif University of Technology, Tehran, Iran, 2012.
- B. Barak, O. Goldreich, R. Impagliazzo, S. Rudich, A. Sahai, S. Vadhan and K. Yang. "On the (Im)possibility of Obfuscating Programs". 21st Annual International Cryptology Conference, Santa Barbara, California, USA. Springer Verlag LNCS Volume 2139, 2001.
- Mateas. Michael. Nick Montfort. A Box, Darkly: Obfuscation, Weird Languages, and Code Aesthetics. Proceedings of the 6th Digital Arts and Culture Conference, IT University of Copenhagen, 1–3 December 2005. 144–153. June 28, 2008. June 23, 2008. https://web.archive.org/web/20080623200755/http://nickm.com/cis/a_box_darkly.pdf. live.
External links
Notes and References
- Web site: What is obfuscation (obfu)? - Definition from WhatIs.com. SearchSoftwareQuality. en. 2019-02-01. February 2, 2019. https://web.archive.org/web/20190202041700/https://searchsoftwarequality.techtarget.com/definition/obfuscation. live.
- Web site: Binstock . Andrew . Obfuscation: Cloaking your Code from Prying Eyes . 2003-03-06 . 2013-11-25 . dead . https://web.archive.org/web/20080420165109/http://www.devx.com/microsoftISV/Article/11351 . April 20, 2008 .
- Web site: Atwood . Jeff . Jeff Atwood, May 15, 2005 . Codinghorror.com . 2005-05-15 . 2013-11-25 . January 9, 2010 . https://web.archive.org/web/20100109174819/http://www.codinghorror.com/blog/archives/000291.html . dead .
- Web site: Obfuscation . Kenter.demon.nl . 2013-11-25 . https://web.archive.org/web/20160304033430/http://www.kenter.demon.nl/obfuscate.html . March 4, 2016 . dead .
- Web site: C++ Tutorials – Obfuscated Code – A Simple Introduction . DreamInCode.net . 2013-11-25 . June 28, 2008 . https://web.archive.org/web/20080628050430/http://www.dreamincode.net/forums/index.php?showtopic=38102 . live .
- Web site: C Tutorials – Obfuscated Code in C . 2011-07-07 . 2013-11-25 . December 27, 2013 . https://web.archive.org/web/20131227102549/https://sites.google.com/site/rcorcs/posts/obfuscatedcode . dead .
- Web site: As of 2013-11-25 18:22 GMT . Pe(a)rls in line noise . Perlmonks.org . 2013-11-25 . January 16, 2009 . https://web.archive.org/web/20090116074243/http://www.perlmonks.org/index.pl?node_id=291267 . live .
- Web site: Obfuscation – Haskell Wiki . 2006-02-16 . 2020-03-03 . live . https://web.archive.org/web/20170830203204/https://wiki.haskell.org/Obfuscation . August 30, 2017 .
- Web site: Montfort . Nick . Obfuscated code . dead . https://web.archive.org/web/20190424012657/http://obfuscationsymposium.org/wp-content/uploads/2014/01/Montfort__Obfuscated_Code.pdf . April 24, 2019 . 2017-11-24.
- Web site: Ben Kurtovic . Obfuscating "Hello world!" . benkurtovic.com . October 18, 2017 . September 14, 2017 . https://web.archive.org/web/20170914093302/http://benkurtovic.com/2014/06/01/obfuscating-hello-world.html . live .
- Web site: Obfuscated Python . wiki.c2.com . October 18, 2017 . February 14, 2017 . https://web.archive.org/web/20170214190515/http://wiki.c2.com/?ObfuscatedPython . live .
- Web site: The First Annual Obfuscated Python Content . code.activestate.com . October 18, 2017 . May 25, 2023 . https://web.archive.org/web/20230525195529/https://code.activestate.com/lists/python-list/16171 . dead .
- Web site: One Instruction To Rule Them All: C Compiler Emits Only MOV . Williams . Al . . 2021-03-21 . 2023-10-23 .
- Web site: JAPH – Just Another Perl Hacker . . pm.org . Perl Mongers . https://web.archive.org/web/20130516074850/http://rochester.pm.org/talks/japh_discussion.txt . 16 May 2013 . 27 February 2015 .
- Cryptography Breakthrough Could Make Software Unhackable . Wired . en-us . 1059-1028 . 2021-03-14 . April 14, 2022 . https://web.archive.org/web/20220414061648/https://www.wired.com/2014/02/cryptography-breakthrough/ . live .
- Jain . Aayush . Lin . Huijia . Huijia (Rachel) Lin. Sahai . Amit . 2020 . Indistinguishability Obfuscation from Well-Founded Assumptions . Cryptology ePrint Archive . 2008.09317 . March 14, 2021 . March 3, 2022 . https://web.archive.org/web/20220303200221/https://eprint.iacr.org/2020/1003 . live .
- Web site: "Can We Obfuscate Programs?" by Boaz Barak. https://web.archive.org/web/20160323104433/http://www.math.ias.edu/~boaz/Papers/obf_informal.html. March 23, 2016. 2013-11-25. Math.ias.edu.
- Web site: 2020-07-21 . Blocking website and only way to fix is disabling HTTPS s... AVG . 2022-02-04 . support.avg.com . en . February 4, 2022 . https://web.archive.org/web/20220204155910/https://support.avg.com/answers?id=9060N000000gbDLQAY . live .
- Web site: at 05:01 . Thomas Claburn in San Francisco 2 Oct 2018 . Google taking action against disguised code in Chrome Web Store . 2019-11-12 . www.theregister.co.uk . en . November 12, 2019 . https://web.archive.org/web/20191112154156/https://www.theregister.co.uk/2018/10/02/google_chrome_web_store/ . live .
- Web site: Cimpanu . Catalin . Mozilla announces ban on Firefox extensions containing obfuscated code . 2019-11-12 . ZDNet . en . March 5, 2020 . https://web.archive.org/web/20200305184837/https://www.zdnet.com/article/mozilla-announces-ban-on-firefox-extensions-containing-obfuscated-code/ . live .
- Web site: Reasoning behind the "preferred form of the work for making modifications to it" language in the GPL . 2013-11-25 . Lwn.net . December 2, 2013 . https://web.archive.org/web/20131202231646/http://lwn.net/Articles/431651/ . live .
- Web site: What is free software? . 2014-12-18 . gnu.org . October 14, 2013 . https://web.archive.org/web/20131014132149/http://www.gnu.org/philosophy/free-sw.html . live .
- Zhou . Mingyi . Gao . Xiang . Wu . Jing . Grundy . John C. . Chen . Xiao . Chen . Chunyang . Li . Li . Model Obfuscation for Securing Deployed Neural Networks . 2023 . en.
- Zhang . Tianwei . Privacy-preserving Machine Learning through Data Obfuscation . 2018-07-12 . 1807.01860 . He . Zecheng . Lee . Ruby B.. cs.CR .