InvisibleJS Tool Hides Executable ES Modules in Empty Files Using Zero-Width Steganography
InvisibleJS is an open-source tool designed to obfuscate JavaScript code using invisible zero-width Unicode characters. This tool is available on GitHub, created by a developer under the alias oscarmine. The technique uses steganography to embed source…
InvisibleJS is an open-source tool designed to obfuscate JavaScript code using invisible zero-width Unicode characters. This tool is available on GitHub, created by a developer under the alias oscarmine. The technique uses steganography to embed source code into files that appear blank. It converts JavaScript into binary strings, mapping 0s to Zero Width Space (U+200B) and 1s to Zero Width Non-Joiner (U+200C).
A bootstrap loader decodes and executes the concealed payload at runtime, rendering the code invisible in text editors such as VS Code.
Two Versions for Different Environments
Version 1 (Classic with eval): Suitable for CommonJS and legacy Node.js environments, supporting native require and module.exports. Version 2 (Modern with import): Targets ES Modules, utilizing dynamic await import() for top-level await and exports. It requires .mjs files or "type": module configuration.
To hide code, the following command-line interface (CLI) commands are used:
Version 1: node hideV1.mjs -i input.js -o hidden.js Version 2: node hideV2.mjs -i input.js -o hidden.js
Execution is performed with node hidden.js , which results in normal output despite the code's blank appearance.
InvisibleJS is an open-source tool designed to obfuscate JavaScript code using invisible zero-width Unicode characters.
Feature Version 1 (eval) Version 2 (import)
Invisibility 100% 100%
CommonJS Support Native Limited
ESM Support No Full
Top-Level Await No Yes
Execution Synchronous Asynchronous
Decoder Length Short Long
This method is similar to previous zero-width JavaScript proofs-of-concept from 2018, now adapted for phishing attacks. Attackers have used similar Unicode obfuscation methods with Hangul characters to conceal payloads in scripts, bypassing scanners with anti-debug checks.
InvisibleJS could facilitate such threats, enabling stealthy malware loaders in Node.js environments or web applications, thereby complicating threat detection. As obfuscation tools become more prevalent, security teams are advised to enhance Unicode-aware scanning and behavioral analysis processes. While developed for experimental purposes, InvisibleJS highlights the dual-use potential of coding innovations in cybersecurity.
Based on reporting by Cyber Security News.
