There’s a Snake in My Boot Drive

Python is a high-level, object-oriented programming language with an easy-to-learn syntax that can benefit programmers of all skill levels. It is miles away from the complexities of managing computer memory, abstracting away these concepts, which are unnecessary anachronisms to the modern pragmatic programmer, and letting you get on with the important stuff.

The Python programming language is the top choice among cybersecurity professionals due to the vast number of powerful third-party libraries available. The ability to use these libraries to do the heavy lifting greatly reduces the time required to piece together scripts and develop applications. Python is also highly versatile: Security professionals can use it to write software for penetration testing, web development, applications or to simply throw a quick script together.

Sssscript Kiddies

It is well-known that the difference between being a script kiddie and a legitimate, card-carrying hacker is the ability to write your own code and tooling to perform better security assessments. Making the leap from blindly using shrink-wrapped code to creating and working with bespoke tooling can seem a bit daunting to newbie ethical hackers. Luckily, one area of security where Python has found a particularly strong (and slithery) grip is in the penetration testing industry.

Python has been used to create all kinds of well-known tools that would be instantly familiar to any hardened member of the security community. These include everything from simple scripts to full-blown exploit frameworks.

Let’s Get Modular

Due to Python’s widespread uptake, a penetration tester who has gained access to an endpoint will likely find Python installed, meaning that the programming language can be used to create code that manages networking. This is important if you are performing a penetration test because, upon gaining access to a target machine, you will be greeted with the grim reality that the hacking tools you know and love are nowhere to be found. This means that you occasionally need to make your own. Python has a particularly useful module called socket, which gives hackers all the tools they need to set up and execute basic network tasks.

Another very powerful module well worth your time and research is Scapy. This adds protocol analyzer (packet sniffer) capabilities to your Python code and can be used to read traffic, perform Address Resolution Protocol (ARP) cache poisoning, set up man-in-the-middle (MitM) attacks and more.

But Python tooling isn’t just used by white hats; black-hat fraudsters used the language in the 2016 ransomware CryPy, which used the power of Python to innovate on the ransomware genre. It would be very unsurprising to see more and more threats being perpetrated with Python in the near future. Like traditional software development, the cybercrime industry is driven by quick time to value and the ability to stay agile and ahead of competitors. Python is designed with fast, efficient development in mind.

Add Python Programming Language to Your Skillset

Not only is Python the preferred language for penetration testers, it is also a language of choice for service professionals when configuring and integrating security tooling. For example, many application frameworks use Python, as do the application programming interface (API) examples provided on the IBM Security Intelligence GitHub.

Many incident response platforms come with Python modules, which provide a framework for writing action processors and API integrations. IBM product professional services integration engineers frequently build reusable Python modules for common customer integrations such as ServiceNow, Splunk and JIRA.

When you put it all together, you have a fast, efficient language with wide uptake, many cybersecurity applications and all the modules you need to get started fast. It’s easy to see why this is becoming a must-have skill for operating in the security industry, and why the Python programming language is a part of some of the most cutting-edge tooling out there.

More from Application Security

Patch Tuesday -> Exploit Wednesday: Pwning Windows Ancillary Function Driver for WinSock (afd.sys) in 24 Hours

‘Patch Tuesday, Exploit Wednesday’ is an old hacker adage that refers to the weaponization of vulnerabilities the day after monthly security patches become publicly available. As security improves and exploit mitigations become more sophisticated, the amount of research and development required to craft a weaponized exploit has increased. This is especially relevant for memory corruption vulnerabilities.Figure 1 — Exploitation timelineHowever, with the addition of new features (and memory-unsafe C code) in the Windows 11 kernel, ripe new attack surfaces can…

Backdoor Deployment and Ransomware: Top Threats Identified in X-Force Threat Intelligence Index 2023

Deployment of backdoors was the number one action on objective taken by threat actors last year, according to the 2023 IBM Security X-Force Threat Intelligence Index — a comprehensive analysis of our research data collected throughout the year. Backdoor access is now among the hottest commodities on the dark web and can sell for thousands of dollars, compared to credit card data — which can go for as low as $10. On the dark web — a veritable eBay for…

Direct Kernel Object Manipulation (DKOM) Attacks on ETW Providers

Overview In this post, IBM Security X-Force Red offensive hackers analyze how attackers, with elevated privileges, can use their access to stage Windows Kernel post-exploitation capabilities. Over the last few years, public accounts have increasingly shown that less sophisticated attackers are using this technique to achieve their objectives. It is therefore important that we put a spotlight on this capability and learn more about its potential impact. Specifically, in this post, we will evaluate how Kernel post-exploitation can be used…

Detecting the Undetected: The Risk to Your Info

IBM’s Advanced Threat Detection and Response Team (ATDR) has seen an increase in the malware family known as information stealers in the wild over the past year. Info stealers are malware with the capability of scanning for and exfiltrating data and credentials from your device. When executed, they begin scanning for and copying various directories that usually contain some sort of sensitive information or credentials including web and login data from Chrome, Firefox, and Microsoft Edge. In other instances, they…