All Projects → stypr → Flagchecker

stypr / Flagchecker

For effective cheating detection in competitions. Utilizes Linux Kernel Module (LKM) for generating flags.

Projects that are alternatives of or similar to Flagchecker

execmon
Advanced process execution monitoring utility for linux (procmon like)
Stars: ✭ 77 (+220.83%)
Mutual labels:  hooks, linux-kernel
Linux-Kernel-Exploitation
Linux kernel development & exploitation lab.
Stars: ✭ 130 (+441.67%)
Mutual labels:  linux-kernel, ctf
Awesome Object Detection
Awesome Object Detection based on handong1587 github: https://handong1587.github.io/deep_learning/2015/10/09/object-detection.html
Stars: ✭ 6,628 (+27516.67%)
Mutual labels:  detection
Tffrcnn
FastER RCNN built on tensorflow
Stars: ✭ 898 (+3641.67%)
Mutual labels:  detection
Web3 React
🧰 A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps
Stars: ✭ 788 (+3183.33%)
Mutual labels:  hooks
Fbctf
Platform to host Capture the Flag competitions
Stars: ✭ 6,407 (+26595.83%)
Mutual labels:  ctf
Ciphey
⚡ Automatically decrypt encryptions without knowing the key or cipher, decode encodings, and crack hashes ⚡
Stars: ✭ 9,116 (+37883.33%)
Mutual labels:  ctf
Linux Lab
Docker/Qemu Based Linux Kernel Learning, Development and Testing Environment; New Linux ELF Video Course from this project author: https://www.cctalk.com/m/group/88089283
Stars: ✭ 771 (+3112.5%)
Mutual labels:  linux-kernel
Pre Commit Terraform
pre-commit git hooks to take care of Terraform configurations
Stars: ✭ 902 (+3658.33%)
Mutual labels:  hooks
Safety Helmet Wearing Dataset
Safety helmet wearing detect dataset, with pretrained model
Stars: ✭ 802 (+3241.67%)
Mutual labels:  detection
Rooks
Essential hooks ⚓ to super charge your components!
Stars: ✭ 889 (+3604.17%)
Mutual labels:  hooks
Awesome React Hooks
Awesome React Hooks
Stars: ✭ 7,616 (+31633.33%)
Mutual labels:  hooks
Code Audit Challenges
Code-Audit-Challenges
Stars: ✭ 779 (+3145.83%)
Mutual labels:  ctf
Ebpf exporter
Prometheus exporter for custom eBPF metrics
Stars: ✭ 829 (+3354.17%)
Mutual labels:  linux-kernel
Webhook
webhook is a lightweight incoming webhook server to run shell commands
Stars: ✭ 7,201 (+29904.17%)
Mutual labels:  hooks
Riceteacatpanda
repo with challenge material for riceteacatpanda (2020)
Stars: ✭ 18 (-25%)
Mutual labels:  ctf
Yolo tensorflow
Tensorflow implementation of YOLO, including training and test phase.
Stars: ✭ 772 (+3116.67%)
Mutual labels:  detection
Shellen
🌸 Interactive shellcoding environment to easily craft shellcodes
Stars: ✭ 799 (+3229.17%)
Mutual labels:  ctf
Brutedet
Generalized proof of concept tool which can be used for drop-in bruteforce protection when needed.
Stars: ✭ 5 (-79.17%)
Mutual labels:  detection
Medicaldetectiontoolkit
The Medical Detection Toolkit contains 2D + 3D implementations of prevalent object detectors such as Mask R-CNN, Retina Net, Retina U-Net, as well as a training and inference framework focused on dealing with medical images.
Stars: ✭ 917 (+3720.83%)
Mutual labels:  detection

flagchecker

Effective Cheating Detection for CTFs/competitions. Feel free to submit PR.

This idea was inspired by the way flags were generated in the Korean domestic CTF contest called Cyber Conflict Exercise.

I decided to create this from the scratch.

How it works

In many recent CTF competitions, docker has been used for effective competition management such as container isolation and log tracing.

docker image

All Docker containers use the host kernel, which eventually means that inserting kernel modules could affect the docker instance. Wikipedia says that

Docker uses resource isolation features of the Linux kernel such as cgroups and kernel namespaces to allow independent "containers" to run within a single Linux instance, avoiding the overhead of starting virtual machines.

This also means that hooking a syscall from the host kernel will eventually affect the container too.

With this in mind, I developed a simple Linux kernel module called flagchecker that generates a random flag and records it somewhere within the host instance to keep the record of user's flag submissions.

patched-docker-structure

What flagchecker does is as follows:

  1. Hooks the read() syscall.

  2. When the binary calls for a read() syscall, it looks for the string.

    To ensure that the server does not suffer from the performance bottleneck, the module only reads for the first 255 byte.

  3. When there is a value that matches with the hardcoded flag value

    1. The random value is generated. (0-9, a-f)

    2. Replaces the original string with the randomly generated value.

    3. /srv/flag.py is then executed to record the randomly generated value.

docker2

This project was tested on a small CTF named BingoCTF sponsored by Power of Commmunity (POC).

During the test, I created an additional server within the instance to gather the flag and and communicate with the scoreboard server.

docker3

Having the flagchecker on the same machine made it easier for the scoreboard server to integrate and for organizers to check cheating attempts.

How to use

Please refer to the each directory for more information.

Known Issues

  1. Reading partial data of the flag will leak the original content of the flag.

    For example, head -c68 /flag will only read the partial data of the flag, leading to the leakage of the original flag. Make sure that the original value of flag is randomly generated and does not conflict with other flags.

  2. Kernel will crash when you rmmod after insmod multiple times.

    It is better off to reboot the server to remove multiple kernel modules.

  3. Side Channel Attacks

    I haven't verified or succeed on exploiting this bug, but it may be possible that strstr is vulnerable to timing attacks. (Reported by a person who tested this module during the initial development.)

  4. Does not work on latest kernels

    OS that ships with 5.x may not work. There seem to be many workarounds for this but I was not able to succeed on testing it. If anyone's interested to fix it, submitting PR would be really helpful.

Q&A

What was the result of the test?

Worth checking here.

We failed to catch direct flag trades but we managed to catch people who broke the rules.

I've played some challenges but my flag wasn't changing at that time. What happened to those challenges?

We had a lenient code to cover parts that didn't really require LKM. Check out the following code.

https://github.com/stypr/my-ctf-challenges/blob/master/BingoCTF_2020/temporary/internal/index.php#L6-L21

I've added the code to generate the flag but didn't disclose this part while handing out the dist file.

You said your idea was inspired from the other CTF i.e. CCE. Are you sure they implemented such codes?

It's just an assumption. I have not directly asked organizers how they implemented such behaviors, but I tried to make something similar because it seemed pretty interesting.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].