Introduction to Penetration Testing
Introduction: What Is Penetration Testing?
Welcome to Penetration Testing Basics! Penetration testing, often called ethical hacking, is the practice of testing a computer system, network, or web application to find security vulnerabilities that an attacker could exploit. The main goal is to identify security weaknesses before malicious hackers do, allowing the organization to fix them and strengthen their defenses.
It is crucial to understand the distinction between a penetration tester and a malicious hacker. While both use similar tools and techniques, the difference lies entirely in intent and permission. A malicious hacker attacks systems to steal data, cause damage, or demand a ransom. A penetration tester works with the organization's explicit permission to improve security. By the end of this course, you will understand how to assess systems professionally and safely.
Ethical Foundations and Legal Boundaries
The most critical component of penetration testing is not technical skill, but legal authorization. Without permission, the activities you perform during a penetration test are illegal in most parts of the world. Even if your intentions are good and you plan to report the bugs you find, accessing a system without ownership or permission is considered a crime.
This brings us to the concept of the Scope of Work (SOW). Before you ever touch a keyboard to test a system, you must have a signed agreement that outlines exactly what you are allowed to test and how. This document protects both you and the client. It specifies which IP addresses, URLs, or applications are in scope for testing, and which are out of scope and must be left alone. The SOW may also limit which tools and techniques you are permitted to use — for example, a client might prohibit denial-of-service attacks or social engineering tactics that could disrupt business operations.
Imagine you are hired to test a company's website. If you accidentally attack a third-party server that hosts their images because you didn't check the scope, you could be liable for damages.
- Always obtain written authorization.
- Never test systems you do not own or have permission to test.
- Respect the boundaries set in the scope.
Thinking Like an Attacker
To effectively protect a system, you must understand how to break it. This requires adopting the attacker's mindset. While a developer looks at an application and thinks about how to make it work or how to add new features, an attacker looks at the same application and asks, "How can I make this behave in a way it wasn't intended to?"
Attackers are driven by curiosity, persistence, and creativity. They look for assumptions that developers made but didn't verify. For example, a developer might assume that a user will always enter a number for their age. An attacker will try entering letters, symbols, or massive numbers to see if the system crashes or reveals sensitive errors. This mindset shift is about looking for the "unhappy path" — the scenarios that weren't planned for.
Let's look at a simple example using our Pastebin application. Here is a basic web server setup using TypeScript and Express.
When a normal user visits the /api/status page, they just see that the site is online. However, when we think like an attacker, we see valuable information. The code reveals the version (1.0.0) and the environment. If we know the exact version of the application or the libraries it uses, we can search for known vulnerabilities specific to that version. This seemingly harmless status page is actually a form of information leakage.
