Binscure is a Java code obfuscator created by x4e (as seen in the github link in the pom.xml). It's designed to make reverse engineering more difficult. It operates by parsing Java bytecode and applying a series of transformations to the code, while maintaining its functionality. The obfuscation techniques employed include:
- Renaming: Changing class, method, and variable names to meaningless identifiers (using a
NameGenerator).
- Control Flow Obfuscation: Making the code's execution flow harder to follow using techniques like
CfgFucker, FakeTryCatch, UselessTryCatch, and TryCatchDuplication.
- String Encryption: Hiding strings to prevent easy extraction of sensitive information (
StringObfuscator).
- Arithmetic Transformations: Modifying arithmetic operations to obscure calculations (
ArithmeticSubstitutionTransformer, MbaTransformer, NumberObfuscation).
- Dynamic Method/Field Invocation: Replacing direct calls with dynamic lookups (
DynamicCallObfuscation, DynamicFieldObfuscation).
- Removal of Debug Information: Stripping out debug symbols, source file names, and other metadata (
SourceStripper, KotlinMetadataStripper).
- Class Merging: Merging multiple classes into a single class (
StaticMethodMerger).
- Exploiting Bytecode Weaknesses: Using tricks like bad attributes and invalid constant pool entries to confuse decompilers (
BadAttributeExploit, BadIndyConstant).
- Resource Encryption/Obfuscation: Modifying manifest files and other resources (
ManifestResourceProcessor).
- Opaque Runtime Manager: Introduces code that interacts with a runtime component, making analysis more difficult.
- Other Optimizations: Includes optimizations like simplifying enum values (
EnumValuesOptimiser).
Binscure utilizes the ASM library for bytecode manipulation. It's configured via a configuration file (required argument when running). The project is written in Kotlin and uses Hoplite for configuration management.
A key aspect of Binscure is its licensing system. It requires a valid license file located at ~/.config/.binscure/license.txt. This license includes a username, password, timestamp, and a hash which is validated against a hardcoded product ID. The license is valid for a limited time (configurable, defaulting to two months), after which a new license needs to be generated presumably from the mentioned website https://binclub.dev/license/gen. Attempting to use Binscure without a valid license will result in an error message. The obfuscator even incorporates checks to ensure the integrity of the license file and performs XOR operations with parts of the license hash to further complicate cracking attempts.