Evasion Tools
π€ Automated Obfuscation: Advanced tools for bypassing sophisticated security mechanisms
Overview
If we are dealing with advanced security tools, we may not be able to use basic, manual obfuscation techniques. In such cases, it may be best to resort to automated obfuscation tools. This section will discuss examples of these types of tools, one for Linux and another for Windows.
These automated tools are particularly useful when:
Manual obfuscation techniques fail
Multiple filter layers are present
WAF detection is highly sophisticated
Time constraints require rapid payload generation
Custom evasion patterns are needed
Linux (Bashfuscator)
π§ Bash Command Obfuscation: Automated tool for Linux/Unix environments
Installation
A handy tool we can utilize for obfuscating bash commands is Bashfuscator. We can clone the repository from GitHub and then install its requirements:
# Clone the repository
git clone https://github.com/Bashfuscator/Bashfuscator
# Navigate to directory
cd Bashfuscator
# Install requirements
pip3 install setuptools==65
python3 setup.py install --userBasic Usage
Once we have the tool set up, we can start using it from the ./bashfuscator/bin/ directory. There are many flags we can use with the tool to fine-tune our final obfuscated command:
Help Menu Overview:
Simple Obfuscation
Basic Command Obfuscation:
Warning: Running the tool this way will randomly pick an obfuscation technique, which can output a command length ranging from a few hundred characters to over a million characters!
Optimized Obfuscation
For shorter and simpler obfuscated commands, use specific flags:
Testing Obfuscated Commands
Verify the obfuscated command works:
Key Bashfuscator Flags
-c
Command to obfuscate
--command 'whoami'
-s
Size parameter (1-6)
-s 1 (smallest)
-t
Time parameter (1-6)
-t 1 (fastest)
--no-mangling
Disable identifier mangling
Cleaner output
--layers
Number of obfuscation layers
--layers 1
-l
List available techniques
View all mutators
Web Application Testing
Exercise Challenge: Try testing the obfuscated command with our web application to see if it can successfully bypass the filters.
Potential Issues:
Space characters in obfuscated payload
Special characters that may be filtered
Payload length restrictions
Troubleshooting:
Windows (DOSfuscation)
πͺ Windows Command Obfuscation: Interactive tool for Windows environments
Installation
There is a very similar tool for Windows called DOSfuscation. Unlike Bashfuscator, this is an interactive tool - we run it once and interact with it to get the desired obfuscated command.
Interactive Usage
Help Menu:
Tutorial Option: We can use tutorial to see an example of how the tool works.
Practical Example
Step 1: Set Command
Step 2: Choose Encoding
Step 3: Get Obfuscated Result
Testing Windows Obfuscation
Execute on Windows CMD:
Cross-Platform Testing
Linux PowerShell Alternative: If we do not have access to a Windows VM, we can run the above code on a Linux VM through pwsh:
Note: This tool is installed by default in your Pwnbox instance.
DOSfuscation Techniques
Environment Variable Encoding
How it Works: DOSfuscation uses Windows environment variables to construct characters:
Advanced Obfuscation Options
Available Techniques:
BINARY - Obfuscated binary syntax for cmd.exe & powershell.exe
ENCODING - Environment variable encoding
PAYLOAD - Obfuscated payload via DOSfuscation
Interactive Navigation:
Tool Comparison
Bashfuscator vs DOSfuscation
Platform
Linux/Unix
Windows
Interface
Command-line
Interactive
Output Size
Variable (100-1M+ chars)
Moderate (50-200 chars)
Customization
High (many flags)
Medium (preset options)
Ease of Use
Moderate
High (guided)
Techniques
Multiple layers
Env var extraction
When to Use Each Tool
Use Bashfuscator when:
β Targeting Linux/Unix systems
β Need highly customized obfuscation
β Multiple obfuscation layers required
β Automated scripting needed
Use DOSfuscation when:
β Targeting Windows systems
β Need environment variable techniques
β Interactive exploration preferred
β Moderate obfuscation sufficient
Practical Integration
Web Application Testing Workflow
Step 1: Generate Obfuscated Payload
Step 2: Filter Adaptation
Step 3: Web Injection
Automation Scripts
Bashfuscator Automation:
PowerShell Automation (DOSfuscation):
Advanced References
Additional Resources
For more advanced obfuscation methods, refer to:
Secure Coding 101: JavaScript module - Advanced obfuscation methods
PayloadsAllTheThings - Community obfuscation techniques
OWASP Testing Guide - Injection testing methodologies
Tool Updates
Stay Current:
β οΈ Tools may require updates for new OS versions
β οΈ Signature detection evolves constantly
β οΈ New techniques emerge regularly
Best Practices:
β Test obfuscated payloads before deployment
β Have multiple obfuscation options ready
β Combine manual and automated techniques
β Keep tools updated to latest versions
Key Takeaways
Automated Advantages
π Speed - Rapid payload generation
π Consistency - Reliable obfuscation patterns
π― Variety - Multiple technique options
π οΈ Customization - Tunable parameters
Integration Strategy
π Assessment - Identify filter sophistication
π οΈ Tool Selection - Choose appropriate platform tool
π Obfuscation - Generate automated payloads
π§ Adaptation - Modify for specific filters
β‘ Execution - Deploy via injection vectors
These automated evasion tools provide penetration testers with powerful capabilities to bypass sophisticated filtering mechanisms while maintaining efficiency and effectiveness in assessments.
Last updated