Hands-On Guide

Capture The Flag

Understand CTF formats, challenge categories, tools and write-ups. Solve a small local challenge and build a repeatable learning method.

CybersecurityFree Guide

A cybersecurity CTF is an intentionally designed environment where you solve challenges and submit a specific answer, often called a flag. The platform defines the targets and rules; the surrounding website and other players are not automatically in scope.

Before You Start

  • Basic terminal navigation and the ability to read a short text file.
  • Python 3 for the local encoding example. No paid subscription is required for the project.

YOUR LEARNING ORDER

Learn, Practise and Build

  1. Choose a Format

    Understand CTFs, formats and what each competition expects.

  2. Choose One Category

    Start with an accessible challenge category and use its full tool and reading list.

  3. Build Your Toolkit

    Learn a small number of tools before adding more.

  4. Practise and Write Up

    Pick a beginner wargame and keep reproducible notes using the write-up resources.

Your project: Solve a synthetic log-and-encoding challenge, keep a hypothesis log and produce a write-up that explains the evidence rather than only revealing a flag.

Go to the practice project

SECTION 01

What is CTF?

Capture the Flag (CTF) is a type of cybersecurity competition that challenges competitors to solve various types of computer security problems. In these challenges, the contestant is usually asked to find a Flag, a specific piece of the word that may be hidden on the file, image, metadata, webpage or server. it depends on the challenge where the flag will be hidden. These competitions can be both team-based or individual, lasts a few hours, a full day, or several days and every interested security enthusiast can join the compaction.

CTFtime is one of the best CTF archives where you get the details related to previous, current and upcoming CTFs, CTF Teams, and Writeups of CTFs that have ended.

SECTION 02

Why CTF?

The CTF competitions help people to learn and practice cybersecurity and also to sharpen their skills and knowledge they have already learned. it gives them the creative and real-life experience to solve cybersecurity-related problems.

SECTION 03

CTF vs Hackathons

CTFs develop security problem-solving skills. Hackathons develop collaborative building skills and may focus on security or another subject.

The main difference between CTF and Hackathons is Capture The Flag (CTF) is a type of game in which competitors score points by solving a security-related task or challenge and by solving as many challenges as possible, the one who gets the most points first becomes the winner.

Hackathons (also known as a hack day, hackfest or codefest) is not an event where a bunch of computer hackers try to hack into a system. in this event developers, designers, and sometimes non-technical people collaborate to build an application or program or something new out of technology within an allotted time while following specific criteria.

SECTION 04

CTF Types

  • Jeopardy
  • Attack-Defense
  • King Of The Hill
  • Linear
  • Mixed

SECTION 05

Jeopardy

JeopardyOpen full-size image ↗
Jeopardy

Jeopardy-style CTFs present a board of challenges, usually grouped by category. Players can often choose their order; some events also use linked challenges. By revealing clues, contestants learn the right direction regarding techniques and methodologies that are needed going forward. Teams receive points for each solved task. The more difficult the task, the more points you can earn upon its successful completion.

SECTION 06

Attack-Defense

Attack-DefenseOpen full-size image ↗
Attack-Defense

This style of competition is much closer to the backyard capture the flag game than the Jeopardy style. In these types of events, teams defend a host PC while still trying to attack opposing teams’ target PCs. Each team starts off with an allotted time for patching and securing the PC, trying to discover as many vulnerabilities as possible before the opponent attacking teams can strike. Teams receive points for staving off attacks from opposing teams and successfully infiltrating other teams. The team with the most points wins.

SECTION 07

King Of The Hill

King Of The HillOpen full-size image ↗
King Of The Hill

King of the Hill is similar to Attack/Defend, but instead of everyone having their own machine (or small network) to defend, there are only preconfigured ones, which require all teams to exploit them. Once your team has successfully taken over the machine, the focus shifts to defending the machine from other teams attacks. Score is usually determined by a score reporting service on the machine, that reports a team token. When one team is able to gain access, they will remove the other teams token, and insert their own, thus making them the King of the Hill.

SECTION 08

Linear

LinearOpen full-size image ↗
Linear

Linear CTFs are usually story based and consist of a set of CTF challenges which need to be solved in order to reach the final flag. Linear CTFs are mostly used for recruitment purposes where the player can show its skills by solving all challenges. A downside of linear CTFs is that the challenges all need to be solved and also need to be solved in order. Getting stuck on a single challenge means not being able to continue. Because players can only work on one challenge at the time this type of CTF is more suitable for individual players instead of teams.

SECTION 09

Mixed

As the name suggests, mixed competitions are an amalgam of Jeopardy and Attack-Defend formats. Sometimes organizers will segment the competition into events. Other times organizers might split teams to compete in concurrent events of different styles.

SECTION 10

Challenge Types

Jeopardy style CTFs challenges are typically divided into misc, pwn, binary, reverse engineering, web, programming, networking, crypto, forensics, stego, osint, mobile security etc. categories.

SECTION 11

Miscellaneous

Many challenges in CTFs will be completely random and unprecedented, requiring simply logic, knowledge, and patience to be solved. There is no sure-fire way to prepare for these, but as you complete more CTFs you will be able to recognize and hopefully have more clues on how to solve them.

SECTION 12

Pwn

Pwnables are challenges where you need to exploit a specific local or remote vulnerability. These vulnerabilities van be hosted on Linux or Windows and can be Buffer overflows, Format strings or a different kind of vulnerability. The level of difficulty can be made harder with mitigations such as ASLR and NX. Pwnable challenges are sometimes also found in the Binary category.

Tools :

Resources :

SECTION 13

Binary Exploitation

Binary exploitation comes down to making an application act differently than how it was intended to run. By making the application run differently, you’re gaining valuable information that you’ll use to alter or commandeer the target.

Common binary exploits use a technique known as memory corruption, which can enable an attacker to gain unauthorized privileges to the system that is running the application, or by hijacking the control flow of the application and injecting their commands directly into the system.

Tools :

Resources :

SECTION 14

Reverse Engineering

Sometimes the flag will be a string hidden inside the application code. Depending on the challenge type and level of difficulty the task, you might need to use reverse engineering.

Reverse engineering challenges require an intimate knowledge debugger and disassembler software. The goal: Take a compiled binary, rip it apart, and find out how it works.

You will want to be familiar with how the application uses control flow, loops, and conditionals so that you can figure out how to bend the program to your will, and then hopefully capture the flag.

Tools :

Resources :

SECTION 15

Web Exploitation

These question types cover a wide range of different methods to exploit web-based resources. While the methods are broad, there’s are tools commonly associated with web exploitation, including Nmap, Wireshark, and Metasploit.

Some of the easier flags are even accessible through your web browser through “View Page Source” or the equivalent in your browser.

Tools :

Resources :

SECTION 16

Programming

In this type of challenge, we will have to develop a programme or script to perform a certain task. look at past programming challenges from CTF and other competitions - do them! Focus on creating a working solution rather than the fastest or most elegant solution, especially if you are just getting started.

Resources :

SECTION 17

Networking

In this type of challenge, we see challenges related to the network, such as analyzing packet captures (PCAPs) or network communication, port knocking etc.

Tools :

SECTION 18

Cryptography

Cryptography challenges are particularly fun. Even the definition for cryptography sounds fun. “Cryptography is the practice and study of techniques for secure communication in the presence of third parties.” In practice, however, they can be difficult. Often enough, these questions are based on string conversions from one format to another. Crypto can be classic crypto algorithms such as substitution, Vigenere and Ceasar (rot13) ciphers. But also encodings like Morse, Braille, Base64 and XOR. More advanced crypto challenges include weaknesses in ECB mode, bit flipping, padding oracle attacks (CBC) and hash function length extension attacks.

Tools :

Resources :

SECTION 19

Forensics

This type of question in a CTF environment can cover a lot of ground, but it is quite common that you’ll be asked to find files or information hidden within other file types. For instance, a simple jpg or png file could be manipulated to hold information such as text, or even an executable.

By digging into these files with scripts and tools, competitors can extract data (normally encrypted) and then run it against a series of other tools as they try to decode the coveted flag. There are many useful tutorials and write-ups online that can get you started.

Tools :

Resources :

  • Guide to Computer Forensics and Investigations - Reference title; the entry did not include a source link. - Book
  • Digital Evidence and Forensics - Reference title; the entry did not include a source link.
  • Computer Forensics - Reference title; the entry did not include a source link. (PDF)
  • Computer Forensics in a LAN Environment - Reference title; the entry did not include a source link. (PDF)
  • Digital Forensics - Reference title; the entry did not include a source link.
  • Forensic Examination of Digital Evidence: A Guide for Law Enforcement - Reference title; the entry did not include a source link. (PDF)

SECTION 20

Steganography

In the context of CTFs steganography usually involves finding the hints or flags that have been hidden with steganography. Most commonly a media file will be given as a task with no further instructions, and the participants have to be able to uncover the message that has been encoded in the media.

Tools :

Resources :

SECTION 21

OSINT

These challenges are quite scarce and we will rarely find them in a CTF. This type consists of investigating something or someone through public access sources (forums, social networks, blogs, wikis, magazines, press…)

Tools :

Resources :

SECTION 22

Mobile Security

In this type of challenge, we see mobile application security or app pwnable related challenges.

Tools :

Resources :

Challenges not fitting in the above categories are usually found in a Starter, Special or Bonus category. In smaller CTFs the categories might be combined. The challenge categories can also be adjusted for specific themed CTFs. In case of a specific Forensics CTF you could for example opt for: Malware, Memory forensics, System forensics & Logfiles.

SECTION 23

Where To Start?

CTF is a continuous learning process, and it takes time to develop your skills. Don't be discouraged if you encounter challenges that seem difficult at first. With practice and perseverance, you can improve your skills and become a successful CTF player.

SECTION 24

Learning

Before diving into CTF, it's essential to understand the fundamentals of cybersecurity. You can start by learning about networking, web application security, cryptography, and other related topics. Joining a CTF community can help you learn from experienced players and get access to various CTF challenges. There are several CTF communities available online, such as CTFtime and Reddit's r/securityCTF.

SECTION 25

Tools and Resource

Scripts, Frameworks and Tools.

SECTION 26

Number / Text Conversion Tools

SECTION 27

Collection of CTF Tools

  • Kali Linux Tools - Kali Linux Tools Listing
  • CTF Tools - Collection of setup scripts to install various security research tools
  • CTF-Katana - Listing of tools and commands that may help with CTF challenges

SECTION 28

Wargames

Several online platforms offer CTF challenges for free, such as HackTheBox, TryHackMe, and OverTheWire. These platforms provide a safe environment to practice your skills and learn new techniques.

  • Backdoor - The former hosted address is unavailable. The project repository is a source reference, not a running challenge service. SDSLabs Backdoor Project - Security Platform by SDSLabs
  • Crackmes - Reverse Engineering Challenges
  • CryptoHack - Fun cryptography challenges
  • CTFLearn - An ethical hacking platform that enables tens of thousands to learn, practice, & compete.
  • echoCTF.RED - Online CTF with a variety of targets to attack
  • Exploit Education (Formerly Exploit Exercises) - Variety of VMs to learn variety of computer security issues
  • Exploit Education - Variety of VMs to learn variety of computer security issues
  • Gracker - Binary challenges having a slow learning curve, and write-ups for each level
  • Hack The Box - Weekly CTFs for all types of security enthusiasts [HC]
  • Hack This Site - Training ground for hackers
  • Hacker101 - CTF from HackerOne
  • Hacking-Lab - Ethical hacking, computer network and security challenge platform
  • Hone Your Ninja Skills - The original address is unavailable. This reference is retained; the linked alternative covers the same learning area. OverTheWire Wargames - Web challenges starting from basic ones
  • IO - Wargame for binary challenges
  • Microcorruption - Embedded security CTF
  • Over The Wire - Wargame maintained by OvertheWire Community
  • PentesterLab - Variety of VM and online challenges (paid)
  • PicoCTF - CyLab Security Academy - picoCTF is a free computer security game for middle and high school students. [HC]
  • PWN Challenge - The original address is unavailable. This reference is retained; the linked alternative covers the same learning area. OverTheWire Wargames - Binary Exploitation Wargame
  • Pwnable.kr - Pwn Game
  • Pwnable.tw - Binary wargame
  • Pwnable.xyz - Binary Exploitation Wargame
  • Reversin.kr - Reversing challenge
  • Ringzer0Team - Ringzer0 Team Online CTF
  • Root-Me - Hacking and Information Security learning platform
  • ROP Wargames - ROP Wargames
  • SANS HHC - Challenges with a holiday theme released annually and maintained by SANS
  • SmashTheStack - A variety of wargames maintained by the SmashTheStack Community
  • TryHackMe - TryHackMe is an online platform for learning and teaching cyber security [HC]
  • Viblo CTF - Various amazing CTF challenges, in many different categories
  • VulnHub - VM-based machines for learning and practicing pentesting [HC]
  • W3Challs - training platform with various categories & challenges
  • WebHacking - Hacking challenges for web

SECTION 29

Writeups

After solving a CTF challenge, it's a good idea to read write-ups by other players. Write-ups provide detailed explanations of how a challenge was solved, which can help you learn new techniques and approaches.

  • 0e85dc6eaf - Write-ups for CTF challenges by 0e85dc6eaf
  • Captf - The original address is unavailable. This reference is retained; the linked alternative covers the same learning area. CTFtime Events and Write-Ups - Dumped CTF challenges and materials by psifertex
  • CTFtime - Explanations of solutions to past CTF challenges
  • CTF write-ups (community) - CTF challenges + write-ups archive maintained by the community
  • Corshine - The original write-up site is unavailable. CTFtime Write-ups - Publish write-ups from various pentesting platforms
  • CTFTime Scrapper - Scraps all writeup from CTF Time and organize which to read first
  • Hack The Box - Writeups for HacktheBox 'boot2root' machines
  • HackThisSite - CTF write-ups repo maintained by HackThisSite team
  • Mzfr - CTF competition write-ups by mzfr
  • pwntools writeups - A collection of CTF write-ups all using pwntools
  • SababaSec - A collection of CTF write-ups by the SababaSec team
  • Shell Storm - The original CTF archive is unavailable. CTFtime Write-ups - CTF challenge archive maintained by Jonathan Salwan
  • Smoke Leet Everyday - CTF write-ups repo maintained by SmokeLeetEveryday team
  • TryHackMe - Writeups for TryHackMe Rooms

Once you feel confident in your skills, you can participate in CTF competitions. There are several types of CTF competitions, such as Jeopardy-style, Attack-defence, and King of the Hill.

PRACTICE PROJECT

Your First CTF Case File

Solve a synthetic log-and-encoding challenge, keep a hypothesis log and produce a write-up that explains the evidence rather than only revealing a flag.

PROJECT STEP 01

Choose a CTF Format

Jeopardy-style CTFs offer challenges in categories and award points for correct answers. Many challenges are independent, although an organiser may add dependencies. Attack-and-defence events require teams to keep their own services running while investigating opponents’ assigned services under the competition rules. They demand more operational experience.

King of the Hill usually rewards maintaining control of an assigned system. Linear wargames unlock levels in order; mixed events combine formats. A hackathon usually focuses on building something, while a CTF focuses on solving security challenges. Read the actual event rules because scoring, allowed tools and collaboration policies vary.

Try It Yourself

Pick a beginner Jeopardy challenge or linear wargame. Write down the permitted target, flag format and hint policy before beginning.

Check Your Understanding

Does an event’s public domain name mean you can test its login system or infrastructure outside the challenge? Explain the scope distinction.

PROJECT STEP 02

Know What Each Category Trains

A challenge category is a clue about the skills to practise, not a guarantee that one tool will solve it. Start with general skills, simple forensics or web fundamentals, then add deeper specialisations. If a category repeatedly feels mysterious, return to the underlying subject instead of collecting payloads.

Some tasks cross categories: a packet capture may contain a web request with an encoded message. Inspect the evidence first, identify what you know and choose the smallest experiment that tests your next idea.

Try It Yourself

Choose two categories and name one foundation each requires. Keep one as your main practice area for the next few challenges.

Check Your Understanding

What evidence would make you investigate encoding before reaching for a password-cracking tool?

PROJECT STEP 03

Use a Small, Understandable Toolkit

Start with a terminal, a text editor, a browser and its developer tools. file, strings and a hex viewer help inspect unfamiliar files. Python can transform data reproducibly. Wireshark helps inspect supplied packet captures; Ghidra and a debugger become useful when you understand executable formats and basic programming.

Install tools from their official projects and inspect file types before opening challenge downloads. Run unknown executable content in a disposable isolated environment. A huge tool collection can hide weak understanding: for each tool, know what it receives, what it changes and what its output can actually prove.

  • Keep the original challenge files unchanged and record a checksum when file integrity matters.
  • Save commands and outputs in a dedicated folder for each challenge.
  • Use the built-in help and documentation before adding unfamiliar options.
  • Do not put competition secrets or restricted challenge material into a public AI service.

Try It Yourself

Create folders named input, notes and output. Write a short tool log with each command’s purpose and result.

Check Your Understanding

Why should a readable string in a binary be treated as a clue rather than proof of the program’s full behaviour?

PROJECT STEP 04

Create and Inspect a Tiny Challenge

This exercise uses invented data and stays entirely local. A log contains a Base64-encoded flag on a DEBUG line. Your job is to locate the relevant evidence, decode the value and explain why no secret key was required. The flag is intentionally simple so the method gets your attention.

Save the following text as challenge.log. Read it once as plain text, then use your editor’s search or grep to find DEBUG. Copy only the value after payload=; including the label would change the decoder’s input.

Synthetic Challenge Input

Text
INFO service started
INFO status healthy
DEBUG payload=RkxBR3tmaXJzdF9zdGVwfQ==
INFO service stopped

Expected Result

The suspicious line contains a string ending in ==, a clue that it may be Base64. Padding alone is not proof, so test the hypothesis.

Try It Yourself

Record an observation, a hypothesis and a proposed test before decoding. Example: “The value uses the Base64 alphabet; a strict Base64 decoder may produce readable text.”

Check Your Understanding

Why is “this looks encrypted” a weaker observation than describing the actual characters and context?

PROJECT STEP 05

Test the Encoding Hypothesis

Base64 represents bytes using a restricted alphabet. It is useful when a channel expects text, but it offers no confidentiality: anyone with the encoded value can decode it. Encryption instead requires an appropriate key to recover the protected plaintext.

Python’s standard library can decode the sample without sending it to an online tool. The validate option rejects characters outside the expected encoding. Decode bytes as text only when that interpretation makes sense; arbitrary binary output does not have to be readable UTF-8.

Decode the Evidence

Python
import base64

encoded = "RkxBR3tmaXJzdF9zdGVwfQ=="
raw = base64.b64decode(encoded, validate=True)
print(raw.decode("utf-8"))

Expected Result

The output is FLAG{first_step}. The method used a reversible representation, not a cryptographic attack.

Try It Yourself

Encode a different harmless message with base64.b64encode, then decode it. Record the original, encoded value and recovered value.

Check Your Understanding

Would Base64 be an appropriate way to hide an API key in a public JavaScript bundle? Why not?

PROJECT STEP 06

Use Hints without Losing the Learning

When you are stuck, return to the last observation you can defend. Write down the exact command, expected result and actual result. Check whether a path, encoding assumption or file type is wrong before trying unrelated tools. A hint is useful when it narrows the question and you can still reproduce the reasoning yourself.

Use a write-up in stages: read the next concept, close it and attempt that step. Afterwards repeat the challenge from clean notes. Competition rules may limit collaboration or AI use, so use those rules rather than assuming all assistance is allowed.

Try It Yourself

Intentionally copy a malformed encoded value and record the decoder error. Fix it by comparing the evidence, then explain why the first input failed.

Check Your Understanding

Can you describe a failed hypothesis and the evidence that made you abandon it?

PROJECT STEP 07

Write a Reproducible Explanation

A useful write-up names the challenge category, starting artefacts, key observations, failed ideas, successful method and the underlying concept. Include a small amount of relevant output and explain what it means. The flag alone teaches little; the reasoning is the reusable part.

Follow the event’s publication policy. Keep active challenge solutions private when required, redact credentials and do not include other participants’ information. For this self-created exercise, you can publish the whole example because it contains no real target or secret.

A Write-Up Outline

Text
Goal: Recover the value hidden in the synthetic log.
Evidence: DEBUG line with a padded text representation.
Hypothesis: The payload is Base64.
Test: Decode locally with strict validation.
Result: FLAG{first_step}.
Explanation: Encoding is reversible without a secret key.
Lesson: Inspect evidence before selecting tools.

Expected Result

Someone reading the outline should be able to repeat the exercise and explain the distinction between encoding and encryption.

Try It Yourself

Finish the case file and add a “What I would try next” paragraph. Keep the original input, script, output and write-up together.

Check Your Understanding

Can a second learner reproduce the result without guessing missing steps?

PROJECT STEP 08

Choose the Next Practice Resource

OverTheWire Bandit teaches command-line foundations through ordered levels. PortSwigger Web Security Academy offers web-security lessons and labs. Hacker101 provides web-security learning and CTF practice. The former picoCTF.org learning entry point directs learners to Carnegie Mellon’s CyLab Security Academy; use the official destination rather than assuming an old interface still exists.

Choose one resource that matches your current gap. Practice platforms may require an account and internet access; other platforms mix free and paid content. Keep your progress notebook local, and check each challenge’s scope and allowed publication rules before starting.

Try It Yourself

Complete one beginner challenge in your chosen category, then write a new explanation using the same case-file structure.

Check Your Understanding

Your next milestone is a repeatable method and a clear explanation, not a particular leaderboard position.

Check Your Finished Project

  • Describe the difference between Jeopardy, linear and attack-and-defence formats.
  • Explain the local flag from evidence to result.
  • Keep one failed hypothesis and what it taught you.
  • Publish only material the challenge rules permit.

Access and Offline Reading

The complete guide is free to read here. Linked providers may require accounts or offer paid features; check their own access conditions.

The guide text, examples and illustrations are included in this website’s local copy. External documentation, platform accounts, downloads and hosted labs need an internet connection.

Further Documentation

HACKTRONIAN_CLI // COMMAND PALETTE
QUICK_EXEC: