I recently saw an article from Mandiant that covered this technique used by UNC4990 on which it sparked my interest to develop a script that obfuscates and deobfuscates based from this technique. Can be useful for red team engagements or if you encountered a "blank" text file that appears to be suspicious, you can use the decoding script to see the deobfuscated version.
NOTE: This script does not employ New line characters as spaces
Reference: https://www.mandiant.com/resources/blog/unc4990-evolution-usb-malware
This script is to encode a text file from its ASCII format to "spaces" and "tabs".
- Below is a sample text file that contains an obfuscated version of a reverse shell.
- Use the script to convert the file from its ASCII format to "spaces" and "tabs".
- Checking the output file, the reverse shell appears to be hidden as "spaces" and "tabs".
This script is to decode a text file that contains "tabs" and "spaces" back to its ASCII format.
- Below is a sample "blank" text file that contains "tabs" and "spaces".
- Use the script to decode the "blank" text file back to its ASCII format.