Create Your Own Custom Encryption in Python
Learn how to create your own symmetric key encryption in Python 3 to evade antivirus controls, high entropy detection, and utilize a initialization vector
During a typical penetration testing engagement; I’ve often run into issues trying basic encoding or encryption techniques even with live off the land binaries (LOLbins) due to more aggressive endpoint security. Some customers are taking note of typical base64, RC4, and other commonly utilized encryption and or obfuscation techniques for files written to disk as well as any modules loaded into memory.
This is where some creativity must come in to prevent your payload or exfiltration staging data to trigger an alert in security tools. In such instances, it’s common for these types of customers to have other technology departments full of automation and scripting. Please note that the functions we create and our implementation is considered by cryptographically “weak”. However, we’re not storing state secrets here; we’re just trying to get through a security testing engagement without getting picked up by endpoint and network security. In this article, we’re going to utilize Python 3 to create a custom program and library to encode, encrypt, and decrypt data. Let’s get to it!