This project implements a polymorphic malware demonstration for educational and research purposes. The implementation showcases various malware techniques while maintaining safety controls.
- Uses Fernet symmetric encryption from the cryptography library
- Generates unique encryption keys for each infection
- Implements code encryption and decryption mechanisms
- Dynamic code generation
- Random instruction insertion
- Register manipulation
- Code obfuscation techniques
- Targets specific file types (
.exeextension) - Implements backup creation before modification
- Uses signature-based infection prevention
- Limited to maximum of 10 files per run
- File backup creation
- Infection signature checking
- File count limitation
- Isolated test environment support
-
generate_cipher_suite()- Creates new encryption key
- Initializes Fernet cipher
-
encrypt_malware_code()- Encrypts payload using Fernet
- Returns encrypted bytes
-
generate_junk_code()- Creates random assembly-like instructions
- Uses predefined instruction sets
- Implements register randomization
-
find_exe_files()- Recursively searches for target files
- Implements file count limitation
- Returns list of valid targets
-
infect_file()- Creates backup of original file
- Implements infection signature
- Injects encrypted payload
- Preserves original content
-
File Operations
- Backup creation
- Signature verification
- File count limits
- Extension restrictions
-
Environment Controls
- Isolated test directory
- Controlled file access
- Limited scope of operations
- Use isolated test directory
- Implement file backups
- Monitor file modifications
- Verify safety controls
- Never run on production systems
- Use virtual environments
- Implement proper access controls
- Monitor system changes
This implementation demonstrates:
- Malware techniques
- Security concepts
- File system operations
- Encryption methods
- Code obfuscation
- Safety controls
This documentation is for educational purposes only. The actual implementation includes safety controls and is intended for research and learning about malware behavior and prevention techniques.