November 23, 2026
VAPT Basics Made Simple โ Think Like an Attacker (Safely and Legally)
Part of the DevSecOps series: Securing the Pipeline You Already Use

By krishnaachauhan
9 min read
Introduction
In the earlier posts, we built defenses: pipeline security, image scanning, secrets management, code scanning, and Kubernetes hardening. But how do you know those defenses actually work?
The only honest way to find out is to test them the way an attacker would. That is what VAPT is for.
This post gives you the basics in plain English:
- What VAPT means
- How a simple test flows from start to finish
- The tools beginners start with
- How to practice safely and legally
You do not need to become a full-time penetration tester. Even a basic attacker's view makes you a much better DevOps engineer, because you start seeing your own systems the way someone trying to break in would see them.
The Most Important Rule (Read This First)
Only test systems that you own, or that you have clear written permission to test.
Testing someone else's system without permission is illegal in most countries. In India, for example, unauthorized access to computer systems is an offence under the IT Act. "I was only curious" or "I wanted to help" is not a defense.
A real penetration test always starts with a written agreement that says:
- Scope: exactly which systems and addresses you may test
- Rules of engagement: what is allowed (and what is not), and when
- Contacts: who to call if something breaks
Everything in this post is meant to be practiced on your own machine, your own lab, or on platforms built for practice. We will list those near the end.
What Does VAPT Mean?
VAPT is two things joined together:
- VA: Vulnerability Assessment. Find weaknesses and make a list. This is about breadth: scan widely, find as many problems as possible. The tools in earlier posts (Trivy, Semgrep, ZAP baseline) are all vulnerability assessment tools.
- PT: Penetration Testing. Take some of those weaknesses and try to actually exploit them, to prove what an attacker could really achieve. This is about depth: how far can we go?
A simple way to see the difference:
- VA says: "This door has a weak lock."
- PT says: "I opened the door, walked to the office, and here is the document I took."
PT matters because it shows the real impact. A list of 200 findings is hard to act on. A story that says "starting from this one small bug, I reached the production database" gets fixed quickly.
Three styles of testing
- Black box: the tester knows nothing about the system, like a real outsider
- White box: the tester has full information (code, diagrams, accounts). Deeper and faster
- Grey box: a middle path, with some information such as a normal user account. Very common in practice
The Flow of a Simple Test
Most tests follow the same steps. Learn this flow and every tool will make more sense.
1. Planning and permission โ scope and rules agreed in writing
2. Reconnaissance โ learn about the target
3. Scanning and enumeration โ find open doors and what runs behind them
4. Gaining access โ try to exploit weaknesses
5. Going further โ what can I do once I am in? (privilege escalation)
6. Reporting โ explain findings, impact, and fixes
7. Fix and retest โ confirm the problems are really gone1. Planning and permission โ scope and rules agreed in writing
2. Reconnaissance โ learn about the target
3. Scanning and enumeration โ find open doors and what runs behind them
4. Gaining access โ try to exploit weaknesses
5. Going further โ what can I do once I am in? (privilege escalation)
6. Reporting โ explain findings, impact, and fixes
7. Fix and retest โ confirm the problems are really gone
Let's walk through each one.
Step 1: Planning and permission
Covered above. Never skip it. It protects you and the client.
Step 2: Reconnaissance (learning about the target)
An attacker starts by collecting information, often without touching the target at all:
- What domains and subdomains exist?
- What technology does the site use?
- Are there leaked details in public code repositories, job posts, or old files?
Lesson for defenders: everything you expose publicly can be used for recon. Error pages that show software versions, forgotten test sites, and leaked keys in public repos all help the attacker.
Step 3: Scanning and enumeration (finding the doors)
Now you actively probe the target to see which services are listening. The classic tool is nmap:
# Find live machines in a small network you own
nmap -sn 192.168.1.0/24
# Check a machine: what ports are open, and what software versions run?
nmap -sV -sC <your-target>
# Check all 65535 ports (slower)
nmap -p- <your-target># Find live machines in a small network you own
nmap -sn 192.168.1.0/24
# Check a machine: what ports are open, and what software versions run?
nmap -sV -sC <your-target>
# Check all 65535 ports (slower)
nmap -p- <your-target>What the flags mean:
-snonly checks which hosts are alive, with no port scan-sVtries to detect the version of each service-sCruns a set of safe, default information-gathering scripts-p-scans every port, not just the common ones
For web applications, a simple scanner like nikto checks for known weak spots and risky files:
nikto -h http://<your-test-site>nikto -h http://<your-test-site>And a proxy tool such as Burp Suite Community or ZAP lets you watch and change the requests between your browser and the app, which is the core skill of web testing.
You already know from the networking post what these tools are really seeing: open ports are just sockets in the LISTEN state. Nmap is asking each port, "Is anyone home?"
Step 4: Gaining access (trying the weakness)
Here the tester checks whether a weakness is truly exploitable. The most common web problems come from the OWASP Top 10, a well-known list of the most frequent risks. In simple words, the big ones are:
- Broken access control: a normal user can reach things meant for admins, or another person's data
- Injection: user input is treated as a command or query (like the SQL example in the last post)
- Cryptographic failures: weak or missing encryption, secrets exposed
- Security misconfiguration: defaults left on, debug pages open, too much permission
- Vulnerable and outdated components: old libraries with known holes
- Authentication failures: weak passwords, no rate limiting, bad session handling
In practice, most real-world access does not come from clever tricks. It comes from simple mistakes: a default password, an exposed admin panel, an old unpatched component, or a leaked key.
Step 5: Going further (privilege escalation)
Getting a foothold is often only the start. The next question is: "With this small access, can I get more?" This is called privilege escalation.
On a Linux machine, testers commonly look at things you already learned about in this series:
- SUID files that run with the owner's power (the permissions post)
- Sudo rules that allow more than intended
- Files with weak permissions, such as scripts run by root that anyone can edit
- Scheduled jobs (cron) that run with high privilege
- Old kernel or software versions
You can check the first one on your own machine today:
find / -perm -4000 2>/dev/nullfind / -perm -4000 2>/dev/nullIn a DevOps world, there are extra places to look:
- A privileged container, or a container with the Docker socket mounted (the Docker internals post)
- A pod with a powerful ServiceAccount token (the Kubernetes hardening post)
- Over-powerful cloud keys found in an environment variable or a config file
- Secrets left in CI/CD variables or in old Git history (the pipeline and secrets posts)
This is the heart of the DevSecOps idea: each setting we hardened in earlier posts closes one of these paths.
Step 6: Reporting
A test that is not written down helps nobody. A good report has:
- Summary: a short, plain-language overview a manager can read in two minutes
- Findings: each with a title, a severity, and where it was found
- Evidence: screenshots or output showing the issue is real
- Impact: what an attacker could do with it, in business terms
- Fix: clear steps to resolve it
Severity is often given using CVSS, a score from 0 to 10, grouped as Low, Medium, High, and Critical.
A tip that makes you better quickly: write for the person who has to fix it. "SQL injection found" is weak. "The name parameter on the /users page is pasted into a database query. Use parameterized queries. Here is an example" is useful.
Step 7: Fix and retest
After the team fixes the issues, test again to confirm. A fix that was never verified is only a hope.
Where You Can Practice Safely and Legally
Use targets that exist to be attacked:
- OWASP Juice Shop: a modern web app full of deliberate bugs, easy to run in Docker
- DVWA: another deliberately vulnerable web app, good for beginners
- TryHackMe and Hack The Box: online platforms with guided lessons and practice machines
- VulnHub: downloadable vulnerable machines for your own lab
- Kubernetes Goat: a deliberately vulnerable Kubernetes environment (great for your cluster skills)
- flaws.cloud and CloudGoat: practice for cloud misconfigurations
You can also build a small lab at home using virtual machines on your own computer. Keep it isolated from your real network.
If you later want a formal path, entry-level certificates such as eJPT are a gentle start, and OSCP is the well-known hands-on one for more advanced learners. They are optional. Skills matter more than papers.
Red Team, Blue Team, and You
You will hear these terms:
- Red team: the attackers (in a test)
- Blue team: the defenders who detect and respond
- Purple team: both sides working together so lessons are shared
As a DevOps/DevSecOps engineer, you mostly live on the blue side: you build and defend. But knowing the red side tells you what to log, what to alert on, and what to harden.
A great exercise is to run a safe scan against your own test environment, and then look at your logs and monitoring. Ask: "Would I have noticed this? Would an alert have fired?" If the answer is no, you have found a gap worth fixing.
Hands-On Lab (60 Minutes, All on Your Own Machine)
Part 1: Start a practice target
docker run -d --rm --name juice -p 3000:3000 bkimminich/juice-shopdocker run -d --rm --name juice -p 3000:3000 bkimminich/juice-shopOpen http://localhost:3000 in your browser and click around like a normal user for a few minutes.
Part 2: Reconnaissance and scanning
nmap -sV -p 3000 127.0.0.1
nikto -h http://localhost:3000nmap -sV -p 3000 127.0.0.1
nikto -h http://localhost:3000Write down what each tool tells you: the open port, the detected software, and any risky findings.
Part 3: Look at the traffic
Open Burp Suite Community or ZAP and set your browser to use it as a proxy. Browse Juice Shop and watch the requests. Pick one request and read it carefully: which parts come from the user? Those are the parts an attacker controls.
Part 4: Try the guided challenges
Juice Shop has a built-in scoreboard with challenges and hints. Pick one or two easy ones from the top of the list. This is a safe place to see what injection or broken access control really looks like.
Part 5: Check your own Linux machine for escalation paths
find / -perm -4000 2>/dev/null
sudo -lfind / -perm -4000 2>/dev/null
sudo -lLook at each SUID file and each sudo rule. Do you understand why each one exists?
Part 6: Write a mini report
Choose two findings from your lab. For each, write: title, severity (Low, Medium, High, or Critical), what you found, the impact, and a fix. Keep each one under ten lines. This one habit is what separates a "hacker" from a professional.
Part 7: Clean up
docker stop juicedocker stop juiceProduction Interview Questions
Q: What is the difference between a vulnerability assessment and a penetration test?
A vulnerability assessment finds and lists weaknesses, usually with automated scanners, and aims for wide coverage. A penetration test goes further by trying to exploit weaknesses to prove the real impact, and aims for depth. Most real engagements use both.
Q: What are the main phases of a penetration test?
Planning and scoping with written permission, reconnaissance, scanning and enumeration, gaining access, post-exploitation and privilege escalation, reporting, and finally fixing and retesting.
Q: Why is scope and written authorization so important?
Without them, testing is unauthorized access, which is illegal. The scope defines exactly what may be tested, and the rules of engagement define how, so nothing outside the agreement is touched and the client knows who to contact if something goes wrong.
Q: What is privilege escalation?
It is moving from limited access to higher access, for example from a normal user to root, or from one compromised pod to the whole cluster. Common causes are misconfigured SUID files or sudo rules, weak file permissions, over-privileged containers, and overly powerful tokens or cloud keys.
Q: What is the difference between black box, grey box, and white box testing?
In black box testing the tester has no inside knowledge, like an outsider. In white box testing the tester has full access to code, architecture, and accounts. Grey box is in between, such as having a normal user login. White and grey box tests are usually faster and find deeper issues.
Q: You found a critical issue during a test. What do you do?
Stop and tell the client right away through the agreed contact, instead of waiting for the final report, especially if the issue is being actively exposed. Document it with evidence, avoid causing damage while confirming it, and recommend an immediate mitigation.
Q: How does knowing penetration testing make you a better DevOps engineer?
It teaches me how attackers actually move through a system, so I know where to add controls, what to log, and what to alert on. It also helps me prioritize fixes by real impact, instead of treating every finding the same.
The Simple Mental Model
A penetration tester is a locksmith you hire to test your locks._ First you give written permission and agree which doors they may try. Then they look at the building, try the doors, and see how far they can get. At the end they hand you a report: which doors opened, how, and how to fix them. Then they come back and check your repairs._
Three questions for any system you review:
- What would an outsider see and learn about it? (recon)
- What is the easiest way in? (usually a simple mistake, not a clever trick)
- If they got in, how far could they go? (escalation and blast radius)
What's Next
In the final post of this series, we look at cloud IAM and least privilege on AWS, Azure, and OCI. Many real-world breaches come from over-powerful cloud permissions and leaked keys. We will cover how to give people and systems only the access they need, and how to find and fix risky permissions.