Security

Exploit

An exploit is a program, a piece of code or a sequence of actions that takes advantage of a specific vulnerability to make a system do something it should not, such as running code or giving access to data.

In this post

An exploit is a program, a piece of code or a technique that takes advantage of a specific flaw in a system to achieve something that was never intended. That might be getting in without permission, gaining more privileges or running commands on someone else’s machine. The word comes from the English verb to exploit, in the sense of taking advantage of something. It is the tool that turns a defect, called a vulnerability, into a real attack.

One way to understand it is to think of a door with a defective lock. The defect is the vulnerability, and it can go unnoticed for years. The lock pick made specifically to open that particular lock is the exploit. As long as it does not exist, the risk is theoretical. Once it appears, anyone who gets hold of it can open every door with that lock, without needing to be an expert.

The vulnerability is the broken lock and the exploit is the lock pick made for it. Fixing the lock makes the pick useless.

What is an exploit?

An exploit exists because every program has bugs, and some of them affect security. When a researcher, or a criminal, discovers a bug of that kind, they can write an exploit that takes advantage of it reliably. Not every flaw allows an exploit, and many require very specific conditions. But when one works, it turns a programming slip into a key that opens systems all over the world.

Not every exploit circulating on the internet is malicious. Authorised security testing teams use them to check whether a system is vulnerable, and there are public collections for educational and defensive purposes. The code itself is neutral. What makes it good or bad is who uses it and with what permission. But its public availability means criminals can reuse it too, hence the importance of fixing flaws as soon as possible.

Vulnerability, exploit and malware, three different things

The three terms are often mixed up, but they refer to different pieces of the same attack. The vulnerability is the flaw, the weakness in a program or a device. The exploit is the method or program that takes advantage of that flaw, the tool that opens the door. Malware is what gets installed or run afterwards, once inside, and it is what causes the final damage, such as stealing data or encrypting files. This distinction matters because each phase has its own defence, the patch closes the vulnerability, controls block the exploit and endpoint protection detects the malware.

Difference between vulnerability, exploit and malware

Exploits in video games

The word has a second use outside security. In video games, an exploit is taking advantage of a flaw in the game to gain an advantage the designers did not foresee, such as walking through walls, multiplying items or gaining speed with a repeated jump. It is not usually a crime, but many online games forbid it in their rules and penalise anyone who uses it against other players.

Exploit kits

Criminals do not usually write their own tools. There are exploit kits, ready-made packages that bundle several exploits and automatically try them against the visitors of a compromised page. The user lands on a website, sometimes through a malicious advert, and the kit checks which browser and plug-ins they have, chooses the right exploit and, if it finds an unpatched flaw, installs the harmful program without anyone doing anything.

These kits are rented out on underground markets as a service, which allows criminals with no technical knowledge to launch mass campaigns. They have become less common since browsers started updating themselves and dropped the most vulnerable plug-ins, but they still exist, and they show why keeping software up to date is an effective and cheap defence.

Types of exploit

Remote and local attacks

Exploits are usually classified according to what they achieve. Some allow commands to be run remotely, in other words controlling a machine without being physically in front of it. Others allow privileges to be gained, becoming an administrator from a limited account. Others reveal information that should be private. The most dangerous are those that require no action from the victim, not even opening a file or clicking a link, and that work simply because the device is connected. That is why a distinction is made between remote exploits, which work over the network, and local ones, which need prior access to the machine and are usually used to escalate privileges.

Flaws that are already patched, most of the cases

The vast majority of exploits used in real life target flaws that already have a patch. Vendors publish fixes, but many organisations take weeks or months to apply them. During that time, criminals, who study every patch to understand which flaw it fixes, build exploits and look for anyone who has not updated yet. It is a race in which the defender’s speed is decisive.

That is why experts keep repeating that most successful attacks do not use novel techniques, but flaws that have been known for a long time. The lists of actively exploited vulnerabilities published by bodies such as the US cybersecurity agency include flaws that are years old. Anyone who keeps their systems up to date is safe from almost all of them, without needing sophisticated tools.

Zero-day flaws without a patch

A zero-day exploit takes advantage of a flaw that the vendor does not yet know about or has not fixed. The name indicates that the vendor has had zero days to solve it. Since there is no patch, nobody can protect themselves by updating. They are very valuable, and they sell for high sums, both on legal research markets and in underground circles. The most advanced groups save them for important targets. Once it is discovered and used publicly, a zero-day stops being one. The vendor publishes the patch, and the exploit loses its edge over time. That is why attackers use them cautiously, so as not to burn them. For the defender, the strategy against zero-days is defence in depth, which limits the damage even if the first barrier falls, together with monitoring for anomalous behaviour.

Browsers and document readers

Many exploits target programs that process content from external sources, such as browsers, document readers and email clients.

A specially crafted file or page triggers a flaw in the program and allows code to be executed. That is why it is advisable to keep these programs up to date and to be wary of unexpected files, even if they seem to come from known contacts.

Browser vendors have invested heavily in isolating their programs, so that a flaw in one tab does not give access to the rest of the system. Even so, serious flaws are still being discovered. The best defence for an ordinary user is to leave automatic updates switched on, since they fix these problems quickly, often within days, without any action on their part.

Processors and mobile phones

Exploitable flaws are not only found in software programs. In January 2018, Spectre and Meltdown were published, two families of flaws in processor design that made it possible to read other processes’ memory by abusing speculative execution, and that affected almost every chip made over two decades. On mobile phones, the most feared exploits are zero-click ones. In 2021 it was discovered that the Pegasus spyware was getting into iPhones through a simple message that the victim did not even have to open.

Exploit chains and system mitigations

Several flaws chained together

Modern systems have several barriers, and a single flaw is rarely enough. That is why advanced attacks chain exploits together. The first runs code inside the browser, the second escapes the sandbox in which the tab runs and the third takes advantage of a flaw in the system kernel to gain full control. Each link on its own seems limited, but together they turn a visit to a page into a complete takeover of a machine.

Mitigations such as DEP and ASLR

Operating systems added defences that make it harder to write reliable exploits, even when the flaw exists. Data execution prevention, known as DEP, prevents code from running from memory areas reserved for data, and it arrived in Windows in 2004. Address space layout randomisation, ASLR, places components at different positions on every boot so the attacker does not know where to aim. On top of these come browser sandboxes and control flow protections.

Exploits against websites and content management systems

In the world of content management systems and online shops, such as WordPress, Joomla, PrestaShop or Magento, exploits usually target extensions and templates with known flaws. When a security company publishes the details of a vulnerability, often in a widely used extension, automated tools appear that search for websites running that specific version. Within hours or days, thousands of unpatched websites are attacked. Owners of small sites usually find out when it is already too late.

That is why speed in applying patches is essential against an exploit. Enabling automatic security updates for critical extensions, watching the advisories of specialised companies and removing abandoned extensions greatly reduces the risk. An extension that has gone years without an update, with a public flaw and no fix, is the ideal scenario for an attacker. The best solution in that case is to replace it with a maintained one. WordPress malware removal reviews files, the database and users so that the clean-up is complete.

It also helps to reduce the website’s attack surface. The fewer extensions and templates, the fewer possible flaws. A well-configured server, with limited permissions and a web application firewall that recognises attempts to exploit known flaws, offers an extra layer of protection while the fix arrives. Specialised firewalls update their rules quickly and block many attempts before they reach the website.

From flaw to patch, and exposure to an exploit

From discovered flaw to installed patch

The life of an exploit follows a well-known path. First someone discovers a vulnerability, whether a researcher, a vendor or an attacker. If a researcher finds it, they warn the vendor privately and a deadline for fixing it is agreed. The flaw receives a public identifier, the CVE, when it is published, and from that moment anyone can study how to take advantage of it.

The most dangerous period runs from the release of the patch until users install it. Anyone who takes weeks to update stays exposed for that whole time. That is why speed in applying patches is one of the measures that most reduces risk, especially on systems visible from the internet.

How to tell whether you are exposed

The key question is which known flaws your systems have left unfixed. Automated vulnerability scans reveal them, and for each platform there are services that compare the core, the extensions and the template with lists of published flaws. Running one every month is a very worthwhile habit. If something critical shows up, you update immediately or disable the component until a fix is available.

Another useful indicator is your average time to apply updates. How many days pass between the release of a patch and its application on your systems? If the answer is weeks or months, you are in the situation that WannaCry exploited. Setting a maximum deadline, for example two days for critical flaws, and checking that it is met is one of the most effective and least costly measures in all of security.

Finally, it is worth subscribing to your suppliers’ security advisories. National cybersecurity agencies and specialised companies publish free alerts about serious flaws and exploits in circulation. Someone in your organisation, or your provider, should read them. Finding out on the same day that there is an exploit for a product you use lets you act before the attacks arrive, and it makes the difference between a scare and a disaster.

A leaked exploit that fuelled a global ransomware outbreak

On 14 March 2017, Microsoft released a security update, identified as MS17-010, that fixed a serious flaw in a Windows file sharing component. A month later, on 14 April, a group called the Shadow Brokers leaked a set of tools attributed to the US National Security Agency, including an exploit for that flaw, known as EternalBlue. Anyone who had already installed the update was safe.

How WannaCry spread after the EternalBlue patch

On 12 May 2017, a ransomware program called WannaCry began to spread at great speed. It used EternalBlue to get into unpatched Windows machines and jumped from one to another without human intervention. Within a few days it had reached more than 150 countries. Hospitals in the British health service had to cancel appointments, and transport companies, telecoms firms and factories halted their activity.

Faced with the scale of the attack, Microsoft took an exceptional step. It also released the update for old versions of Windows that were no longer supported, such as XP, something it does not normally do. A researcher, meanwhile, found almost by chance a mechanism that stopped the spread of the first version of the program. But hundreds of thousands of machines had already been infected, many of them for a single reason, not having installed a patch that had been available for two months.

The lesson left by that leaked exploit is compelling. The flaw had a fix and the attack tool had been leaked, but it was the delay in updating that caused the damage. Two months between the patch and the attack were enough to give thousands of organisations time to act, and millions did not. Since then, security teams have insisted that critical patches must be applied in days, not months.

The evolution of exploits and their tools

The first major internet exploit arrived in November 1988 with the Morris worm. It took advantage of a buffer overflow in the finger service and a debugging feature of the sendmail mail program, and within hours it infected a significant part of the few thousand machines connected at the time.

In 1996 a researcher who signed as Aleph One published in Phrack magazine the article Smashing the Stack for Fun and Profit, which explained in detail how to exploit stack overflows. The text turned exploit writing into a discipline that many people learned from it.

In 2003 the researcher HD Moore launched Metasploit, a framework that brought together ready-to-use exploits for penetration testing. Its arrival democratised offensive auditing and forced vendors to fix flaws faster, because a flaw with a Metasploit module was within anyone’s reach.

Frequently asked questions

Frequently asked questions about Exploit

What is an exploit?

It is a program or technique that takes advantage of a specific flaw in a system to achieve something unintended, such as getting in without permission, gaining more privileges or running commands. It is the tool that turns a vulnerability, in other words a defect, into a real attack.

Where does the word exploit come from?

It comes from the English verb to exploit, in the sense of taking advantage of something. It describes the act of profiting from a flaw, just as a resource or an opportunity is exploited.

What is the difference between a vulnerability and an exploit?

The vulnerability is the flaw, like a defective lock. The exploit is the tool that takes advantage of it, like the lock pick that opens it. There can be vulnerabilities with no known exploit, but when one appears, the risk for anyone who has not fixed the flaw rises enormously.

What is a zero-day exploit?

It is one that takes advantage of a vulnerability the vendor does not yet know about or has not fixed. Since there is no patch, nobody can protect themselves with an update. They are very valuable, and they are bought and sold on specialised markets, both legal and underground.

What is an exploit kit?

It is a ready-made package that bundles several exploits and automatically tries them against the visitors of a compromised page. It checks which browser and plug-ins the victim has, chooses the right exploit and, if it finds an unpatched flaw, installs the harmful program without anyone doing anything. They are rented out on underground markets as a service.

What is a CVE and how does it relate to an exploit?

A CVE is the public identifier a vulnerability receives when it is disclosed. From that moment, anyone can study how to take advantage of it. The most dangerous period runs from the release of the patch until users install it, because attackers analyse the patch to build the exploit within hours or days.

How do I protect myself from an exploit?

By applying security updates as soon as possible, retiring unsupported software, limiting the services exposed to the internet and watching the advisories of cybersecurity agencies. Exploits only work against specific flaws, and fixing the flaw makes them useless.

Why are exploits published?

Researchers publish them to demonstrate the risk and put pressure on vendors, and authorised testing teams use them to check defences. But criminals reuse them too. That is why speed in updating is key after any serious flaw is published.

I keep your website free of known vulnerabilities

I can check whether your website uses versions of the core, the extensions or the server with known vulnerabilities and public exploits available.

About the author

Javier Afán

WordPress developer specialised in security, WooCommerce, and hacked website recovery.

I work on WordPress from a technical angle focused on security, architecture, and the decisions that really affect a project's continuity.