Skip to content

Files

Latest commit

author
Markus Bauer
May 10, 2021
87337c5 · May 10, 2021

History

History
This branch is 16 commits ahead of, 20 commits behind nename0/saarctf-gameserver:faustctf-2023.

flag-submission-server

Building

You need libev, openssl, libhiredis and libpq. On Ubuntu: apt install libev-dev libssl-dev libpq-dev postgresql-server-dev-all libhiredis-dev cmake

Build using CMake:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make

Usage

./flag-submission-server <port> <threads>

Default port: 31337, default threads: 1.

Flag format

SAAR{32-websafe-base64-bytes} (example: SAAR{vQA2AAYAAACXlPecBGL77CAqZOuU4BTa}, regex SAAR\{[A-Za-z0-9-_]{32}\})

Binary data consists of (all numbers are little-endian):

  • 2 bytes tick (this flag was stored)
  • 2 bytes team id
  • 2 bytes service id
  • 2 payload bytes
  • 16 bytes SHA256-HMAC (over the other parts of the flag)

Configure in flagchecker.h and flagchecker.cpp.

Configuration

In config.json: set everything you need (database, redis, secret key, ...)

In flagcache.cpp: Set flag rate and number of valid flags per service/team/round.

In flagchecker.h: Enable/disable what to check for.

In database.cpp: Enable or disable asynchronous commits.

Run make afterwards.

Database

This server needs the database layout from the saarctf gameserver.