Why confuse the JS code?
Source exposure risk
JavaScript is explicitly running. The attackers can read your front-end business logic, API. The mode of call and the core encryption algorithms, which enable the launching of targeted attacks.
Confusion of the shield.
The confusion tool makes the code extremely obscure by changing the variable name, flattening the control stream and encrypting strings. Even if stolen, the cost of reading and debugging increases exponentially.
Core Mixer Technology Resolution
-
Variable Rename
: Name of variable(s) that will make sense (e. g.
userData) Replace with the meaningless short name (e.g._0x1a2b)。 - String Array : Rip all explicit strings into an encrypted array and dynamically decrypt them while running.
- Dead code injection. : Randomly insert jamming codes that do not affect the logic of execution, and confuse debugger tracking.
- Control flow flattening : Change the logical structure of the program so that the code execution path is not visible.
Recommendations for best practices
1. Balance performance and security : The more complex the confusion (e.g. control flow flattening) has an impact on performance, the more sensitive the core documents should be used.
2. Source Map Management : When the production environment is confused, it is important that the Source Map file be properly preserved for debugging in the event of the Bug.
3. Multi-layer protection : Confusion is only the first step towards front-end security, and CSP, HTTPS and back-end verification is the complete security system.