Code obfuscation encompasses the techniques used to make a mobile app more difficult to understand or reverse engineer while preserving its functionality. The primary goal of code obfuscation is to protect an app’s intellectual property, such as proprietary algorithms or sensitive data, by making it harder for unauthorized individuals to analyze, decompile, or tamper with the code.
While the term "code obfuscation" may imply a focus on app’s source code, code obfuscation techniques can also be employed with app binaries. The choice depends on particular needs and the stage of the software development process.
Techniques that can be used to obfuscate mobile app binaries include:
Aggregation Obfuscation. This refers to aggregation and structure removal techniques to obfuscate mobile app binaries to frustrate reverse engineering. The compiled app is disassembled down to assembly instructions, then reassembled without any symbolic information or meaningful structure. Function boundaries are blurred through inlining and merging, control flow is obscured by reordering instructions, and segments are woven together into homogeneous bits without delimiters. Any modularity and high level components blend into dense, difficult to analyze binary blobs. The aggregated app binary retains full functionality but lacks the abstractions and organization inherent in the source representation. Analyzing assembly-level instructions without any architectural context raises the time, skill, and effort required for comprehensive reverse engineering. Structure removal at the binary level provides an added layer of security against tampering.
Arithmetic Obfuscation. This technique replaces arithmetic operations with equivalent but more complex mathematical expressions. When applied to mobile app binaries, key arithmetic operations in the disassembled code can be substituted with convoluted mathematical formulas that ultimately compute the same results. For example, a simple addition is replaced with a formula using bitwise operations, modulus division, and exponentiation. Constants are encoded as complex polynomial expressions and simple variable references are substituted with mathematical derivations. The mobile app still functions identically as one that has not had arithmetic obfuscation applied to it, but the underlying calculations are obscured.
Call Hiding. This approach uses a variety of techniques to obscure or hide function or method calls within a mobile app. This can frustrate reverse engineering efforts, as the attacker must spend more time and effort deciphering the code and identifying the functions' purposes. The goal of call hiding is to make it more challenging for an attacker to understand the flow of the mobile app or identify specific functions being called. Example techniques include
Code and Resource Encryption. This technique is used to make the binary or other resources in a mobile app difficult to understand and reverse engineer. It involves encrypting code or files before distribution so that even if they are accessed or extracted, they will appear scrambled and unreadable. To run an obfuscated app that uses code and resource encryption, the encrypted code and resources must be decrypted at runtime by the app using a decryption key or algorithm. This prevents attackers from easily studying the code to see how it works, modify it, or extract hard-coded values like API keys or passwords. While not completely impervious, encryption raises the barrier for reverse engineering and casual inspection of code and resources.
Code Transposition. In this code obfuscation technique, a precompiled binary is rearranged to hide the purpose and logic of the mobile app. When applying code transposition to a compiled mobile app, the binary is disassembled to gain access to the machine code instructions within. While retaining semantic equivalence, the order of functions, basic blocks, and individual instructions are randomized. Critical functions are fragmented across non-contiguous sections. Independent instructions are reordered to distort program logic and control flow, disguising the true execution sequence. These transformations on the disassembled code obfuscate the mobile app binary while maintaining full functionality. The transposed binary is then reassembled and linked to produce an obfuscated mobile app executable where logical program structure is no longer apparent. Reverse engineering now requires manually deobfuscating and piecing together the jumbled binary through tedious static and dynamic analysis. Binary-level transposition provides cost-effective protection for mobile apps without requiring source code or rebuild.
Renaming Obfuscation. Renaming obfuscation is also called name obfuscation. It is a simple but effective technique that replaces meaningful names for code elements like classes, variables, functions, etc. with meaningless, confusing, or misleading names. For example, a variable called
total_amount could be renamed
xghq_123abc. The new name reveals no information about its purpose in the mobile app. This frustrates reverse engineering analysis which relies heavily on descriptive names to understand the mobile app’s functionality and data flows.
Storage Obfuscation. This refers to techniques that obscure how data is stored and accessed within a mobile app. Storage obfuscation aims to make reverse engineering difficult by manipulating the location, representation, and flow of data variables and structures. Storage patterns are distorted without affecting end functionality, only comprehensibility. Common storage obfuscation techniques include splitting variables across multiple locations, scrambling array indices, encoding values, and introducing bogus variables. The data itself remains unchanged, but is dispersed across the mobile app in convoluted ways. Relationships between data elements are hidden, preventing attackers from deducing the underlying logic. When storage obfuscation is applied to a mobile app, reverse engineers are forced to spend significant effort mapping and reconstructing obfuscated data flows to make sense of the program.
String Encryption. This obfuscation technique is used to hide meaningful strings like API keys, URLs, debug messages, and other literals embedded in a mobile app. Strings are encrypted at compile-time and decrypted at runtime behind the scenes. An attacker viewing the compiled code will only see meaningless ciphertexts. Without the decryption key, the original plaintext strings remain concealed. This frustrates reverse engineering analysis which often relies on readable string literals to infer program logic and identify external dependencies. String encryption also defeats search tools that scan mobile app binaries for sensitive terms. By hiding verbatim strings, attackers are deprived of contextual clues within the mobile app. The encryption keys must be stored securely and revealed only to authorized components. When applied selectively to sensitive strings, encryption can be an effective and lightweight obfuscation technique as part of a broader anti-tampering strategy.
Blue Cedar Enforce, a component of Blue Cedar Mobile App Security, provides code obfuscation. Blue Cedar obfuscates precompiled mobile apps, which means that app’s source code is not required in order to ensure app protection.
Blue Cedar Mobile App Security and the Workflow Builder are delivered by the Blue Cedar Platform, a CI/CD friendly SaaS solution.
You can try all of what Blue Cedar offers for NO CHARGE with as many mobile apps as you want. Blue Cedar Mobile App Security. Blue Cedar Enhance. The Blue Cedar Platform. All of it is free to use until integrated or secured mobile apps are pushed to production.