- Notifications
You must be signed in to change notification settings - Fork15
Anti-Debugger + SSL-Pinning, to defeat fiddlers (distinguish debug-proxied connection and secure ur programs)
xtekky/Python-Anti-Debug
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository is home to a demo of an advanced anti-debug and tamper detection system written in Python. The system can be used as a means of securing your codebase, ensuring that it runs only as intended and preventing unauthorized modifications.
The code, which is purely designed for demonstration purposes, is split into two main classes:SSLPinner
andAntidebug
.
This class is used to performSSL pinning, a security measure that ties an HTTP client to a server's public key instead of any server in the CA chain that the client system trusts. This can prevent man-in-the-middle attacks by ensuring that the client always communicates with the intended server.
This class first obtains the certificate of the specified host. If there's an error in the process, it returnsFalse
. It then compares the acquired certificate against a hardcoded certificate and if the match (measured by thesimilar
function) is >0.8, it returnsTrue
, otherwise,False
.
classSSLPinner:def__init__(self,host):self.host=hostdefget_cert(self):# Code to fetch certificatepassdefpin(self):# Code to verify certificatepass
This class,Antidebug
, forms the crux of the antidebugging and anti-tampering measures. It includes multiple checks to identify commonly known debugging, tampering or sandboxing environments, and attempts to terminate the program when ones are detected. To achieve this,Antidebug
employs a series of system details and environment checks, such as a user, hardware, IP and MAC checks, GPU and system platform checks, DLL, registry, and process checks.
classAntidebug:def__init__(self):passdefuser_check(self):# Checks for specific userspass# Other checks...defcheck(self):# Running all the defined checkspass
Anti-debugging and tampering measures are highly significant, especially in sensitive applications dealing with data security, digital rights management, game cheating protection, or preventing malware analysis. By integrating such measures, developers can deter malicious actors from analyzing, reverse engineering, or manipulating their code.
The featured code in this repository goes beyond basic anti-debugging methods, employing an array of checks, recognising both commonly used debugging tools and giveaways of a system operating under a debugger environment.
It is important to note that while this system enhances the security of your application, no anti-debugging method is foolproof due to the ongoing evolution of debugging and reverse engineering techniques. Hence, this system should be seen as an added layer of security, deterring most attackers, but not as a standalone ultimate solution.
The anti-debugging and anti-tampering detection system demonstrated here showcases some advanced techniques for discovering debugger environments and attempts to modify a Python application's code. SSL pinning, processes check, environment characteristics, to name a few, are all employed to mount a robust guard against unwanted interference within an application's execution.
As developers and security professionals, understanding and applying anti-debugging and tampering mechanisms is a critical step in strengthening software security. It ensures not only the integrity of your application but also helps protect your users' data from potential security breaches.
More usage examples, educational resources, and demo materials to come, so stay tuned! Feel free to contribute, open issues, and use for teaching or using for improving your own software security.
Note: The purpose of this code and repository is purely educational. After all, with great power comes great responsibility.
About
Anti-Debugger + SSL-Pinning, to defeat fiddlers (distinguish debug-proxied connection and secure ur programs)