Cybersecurity for Developers
Hands-onBeginner 30 min· Modern threats and careers · 12 of 13

Practise legally: CTFs and labs

Learn the legal line in security testing, the best free places to practise, and complete your first labs: run OWASP Juice Shop locally, solve a CTF-style decoding puzzle, and plan a six-week path.

The best way to learn security is to practise, but you must do it legally. This tutorial shows you where to practise safely, the rules you must follow, and walks you through your first hands-on lab: running OWASP Juice Shop on your own computer and completing your first challenges. Prerequisites: Docker Desktop (or Docker Engine) and a web browser, plus the basics from *The OWASP Top 10 explained* and *Injection attacks: SQL, command and XSS*.

The legal line

Hacking is not illegal because of the technique. It is illegal because of the missing permission. Trying to get into a system you do not own, without the owner's written permission, can be a criminal offence in India (the Information Technology Act, 2000 covers unauthorised access and damage to computers) and in most countries. "I was only testing" or "I told them afterwards" is not a defence. This is general information, not legal advice.

Is it allowed?

WhereLegal?Notes
Your own computer, your own apps, your own VMsYesBest place to start
Intentionally vulnerable apps run locally (Juice Shop, WebGoat, DVWA)YesBuilt for learning
CTF competitions and platforms (picoCTF, TryHackMe, Hack The Box and others)Yes, within their rulesOnly attack the machines the platform gives you
Bug bounty programmesYes, only inside the published scope and rulesRead the scope carefully; out-of-scope testing is not allowed
Your college, employer or a friend's websiteOnly with written permissionAsk first; get it in writing
Any random websiteNoDo not scan or probe

Rules to remember

Never run scanners, password guessers or exploit tools against a system unless you own it or have clear written authorisation. Not even "just a quick look" at your college website. If you accidentally find a real problem somewhere, do not exploit it. Report it politely to the owner, or to CERT-In (India's national cyber-security agency) if you cannot reach them.

Ways to practise

Beginner-friendly practice platforms

PlatformTypeGood forCost
OWASP Juice ShopLocal vulnerable web app with a scoreboardWeb security, OWASP Top 10Free, open source
PortSwigger Web Security AcademyOnline lessons and labsDeep web security trainingFree (an account is needed)
picoCTFBeginner-friendly CTF by Carnegie Mellon UniversityStudents, first CTFFree
OverTheWire (Bandit)Command-line wargamesLearning Linux and the shellFree
TryHackMeGuided rooms in the browserAbsolute beginners, career pathsFree rooms and paid subscription; check the site
Hack The BoxMachines and challengesIntermediate and advanced practiceFree and paid tiers; check the site
OWASP WebGoatLocal lessons for Java web flawsLearning by guided lessonsFree, open source

Features, tiers and prices of platforms change, so check each site for what is free today.

A CTF (Capture The Flag) is a game where you solve security puzzles to find a hidden text string, the flag, such as flag{example}. Challenges are grouped into categories: web (flaws in web apps), crypto (broken or weak encryption), forensics (find clues in files, images and network captures), reverse engineering (understand a program without its source), pwn (memory-corruption bugs; advanced) and misc. Two formats are common: jeopardy (a board of independent challenges) and attack-defence (teams attack each other's services while defending their own).

Lab 1: Run OWASP Juice Shop

  1. 1Install Docker Desktop (Windows or macOS) or Docker Engine (Linux) and start it.
  2. 2Open a terminal and run the command below. The first run downloads the image.
  3. 3Open http://localhost:3000 in your browser. You should see a juice shop.
  4. 4Browse like a customer: look at the products, register an account, add things to the basket. Understanding the normal flow comes before breaking it.
  5. 5Stop the app any time with Ctrl+C in the terminal. Running it again gives you a fresh state.
Terminal
docker run --rm -p 3000:3000 bkimminich/juice-shop

Starts Juice Shop on http://localhost:3000. --rm removes the container when it stops. Keep it bound to your own machine and do not expose it to the internet, because it is deliberately insecure.

Your first challenge: the scoreboard

Juice Shop tracks your progress on a hidden Score Board page listing all challenges by difficulty. Finding it is the first challenge. A good habit for every web challenge is to look at what the browser already received:

1. Open your browser's developer tools (F12) and go to the Sources or Debugger tab. 2. Look at the JavaScript files the page loaded (for example main.js). Front-end code often lists page routes. 3. Search the file (Ctrl+F) for words like score. 4. Try the route you find by typing it into the address bar after http://localhost:3000/#/.

If you get stuck, the Juice Shop community has a free companion guide called the Pwning OWASP Juice Shop book, and each challenge on the scoreboard has a hint button.

What this teaches

The lesson is bigger than the challenge: never rely on hiding a page. Anything the browser downloads can be read by the user. A page that must be private needs real authorisation checks on the server (see *Authorisation and broken access control*).

More Juice Shop challenges to try

Start with the 1-star challenges, then move up

Challenge ideaOWASP areaWhat to learn
Find the Score BoardSecurity misconfiguration / hidden pagesFront-end code is public
DOM XSS (the simple search-box challenge)Injection (XSS)Why output must be escaped
View another user's basketBroken access controlChanging an id in a request is not allowed to work, but often does
Log in as a user by bypassing the login formInjectionHow string-built SQL queries fail
Find the confidential document in the folder listingSecurity misconfigurationExposed files and directories

Use the scoreboard hints. For every challenge you solve, write a short note in your own words: what was the flaw, why did it exist, and how the developer should fix it. The "how to fix" part is what makes you a better developer, not just a better player.

Lab 2: Your first CTF-style puzzle (no setup needed)

Many CTF challenges start with decoding. Try this one. The text below is a flag hidden with Base64, an encoding (not encryption: anyone can reverse it without a key, see *Cryptography basics: hashing, encryption and TLS*).

Challenge
ZmxhZ3tiYXNlNjRfaXNfbm90X2VuY3J5cHRpb259

Decode this in your terminal or with Python.

Terminal
# Linux, macOS or Git Bash
echo 'ZmxhZ3tiYXNlNjRfaXNfbm90X2VuY3J5cHRpb259' | base64 -d

# Python, works everywhere
python -c "import base64; print(base64.b64decode('ZmxhZ3tiYXNlNjRfaXNfbm90X2VuY3J5cHRpb259').decode())"

Both print the flag.

Output
flag{base64_is_not_encryption}

This is exactly how real mistakes happen: a developer "hides" a password or token in Base64 and thinks it is secret. Anyone can decode it.

A beginner's path

Six weeks to a first portfolio

  1. 1Week 1: learn the Linux command line with OverTheWire Bandit (free, runs through SSH to their servers, which they provide for this purpose).
  2. 2Week 2-3: do the picoCTF practice area and solve beginner challenges in web, crypto and forensics.
  3. 3Week 4-6: work through PortSwigger Web Security Academy topics that match what you learned: SQL injection, XSS, access control.
  4. 4Then: run Juice Shop and WebGoat locally, and a guided path on TryHackMe if you like step-by-step rooms.
  5. 5Join a team or a live CTF. picoCTF and many college clubs run events, and CTFtime.org lists competitions worldwide.
  6. 6Write about what you learn (a short blog post or GitHub notes per challenge). A write-up is also portfolio proof for interviews.

Bug bounty: later, carefully

A bug bounty programme is an invitation from a company to find and report security bugs in their systems, often with rewards. Platforms such as HackerOne and Bugcrowd list programmes. It is real work with real rules: only test what the scope lists, follow the rules (no data destruction, no testing other users' accounts, no denial of service), and report privately. Beginners often get duplicates or invalid reports at first, so build skills in labs and CTFs before you start, and do not expect it to be an income.

Prompt · Explain a CTF challenge I solved or got stuck on
I am practising on [platform, e.g. picoCTF]. The challenge category is [web/crypto/forensics/etc.]. I got stuck here: [describe what you tried and what you saw, without pasting anything from a live system you do not own]. Do not give me the flag. Give me one hint at a time, starting with the most general, and explain the underlying concept so I learn it.

What to expect: Using AI for hints is fine in practice labs. Check each platform's and competition's rules: live CTFs often ban outside help or AI during the event.

Try it: Complete three challenges and write them up

Solve three 1-star Juice Shop challenges. For each, write five lines: what you did, what the flaw was, which OWASP Top 10 category it fits, how a developer would fix it, and what you learned. Keep the notes in a GitHub repository called security-labs.

Try it: Create your own mini challenge

Hide a flag for a friend: encode flag{your_message} with Base64, then again with hex (use xxd -p on Linux/macOS or Python's bytes.hex()). Give them only the final text and ask them to decode it.

Before you practise

  1. I only test my own systems, labs and CTF targets.
  2. I read the rules or scope before starting on any platform or programme.
  3. I keep practice apps like Juice Shop off the public internet.
  4. I write down the fix for every flaw I find.
  5. I never use real people's data or accounts.

Key takeaways

  1. Hacking without permission is a crime; practise only on your own systems, labs, CTFs and in-scope bug bounty targets.
  2. OWASP Juice Shop, PortSwigger Web Security Academy, picoCTF, OverTheWire and TryHackMe are good free starting points (check each site for current free features).
  3. A CTF flag is a hidden string; categories include web, crypto, forensics, reverse engineering and pwn.
  4. Encoding such as Base64 is not encryption.
  5. Always write down how a developer would fix each flaw, and keep notes as a portfolio.
  6. Build skills in labs before trying bug bounty, and always respect the scope.

Check yourself

Finishing the quiz marks the lesson as done.

1. Why is port scanning your college's website without asking a bad idea, even if you mean well?

2. What is a CTF flag?

3. The text ZmxhZ3s... decodes easily with base64 -d. What does this show?

4. In a bug bounty programme, a site subdomain is not listed in the scope. What should you do?

5. What is the best habit after solving a vulnerable-app challenge?

Saved on this device. Create a free account to keep it on every device.

Practise this with Sam

A real mock interview, out loud, with an honest scorecard. Free to start.

Start free