Skip to content

Anti-cheat ​

CTFGarden collects evidence of cheating while the event runs, and gives admins the tools to review it, flag cheaters and lock the final scoreboard. Nothing affects the scoreboard without an admin: detectors only add to a suspicion score, and even verified flag sharing only marks an actor as suspected. An admin makes the final call.

None of these measures are foolproof. Most of them are signals that need context (a shared IP can be a university network), so always look at the evidence before flagging someone.

How it works ​

Every actor (the team in team CTFs, the user in solo CTFs) has a suspicion score. Detectors record suspicion events, and every event adds the weight of its kind to the actor's score. The default weights can be changed in event.yml.

Repeated evidence only counts once. Each event has a deduplication key (for example the challenge, or the other actor involved), and a second event with the same actor, kind and key is dropped. Flag sharing is the exception: every shared flag submission is stored, but repeated ones with a score of 0, so you can see how often it happened.

Weights are applied when an event is recorded. If you change them later, click Recompute suspicion scores on the cheat detection page to recalculate all scores with the current weights.

Reviewing suspicious actors ​

Everything happens on Administration → Cheat Detection in the frontend (admins only). The workflow at the end of an event is:

  1. Review queue. The Needs review tab lists every actor whose score is at least review_threshold (default 20), and every suspected actor, until an admin reviews them. If their score grows after a review, they're back in the queue, with the new score since the last review shown separately. Review opens the actor's details: the Evidence tab lists their suspicion events (filterable by kind), Connections shows which IP addresses connected to their TCP challenge instances, SSH pastes what they pasted into SSH sessions, and Audit log shows earlier decisions.
  2. Flag or clear. Decide with Flag as cheater or Clear, and explain the decision in the note, which is required. When flagging, choose when the actor is hidden from the scoreboard (cheater statuses). Every decision is stored with the note, the admin and the score at the time of the review, which serves as the audit log (the Audit log tab). Clearing an actor also counts as a review. You can flag actors below the threshold too, from the All teams (or All users) tab.
  3. Lock the scoreboard. Lock final scoreboard confirms the final scoreboard. It requires the event to be over and the review queue to be empty. If it isn't, the dialog explains why and lets you lock anyway.

Cheater statuses ​

Every actor has one of these statuses:

StatusSet byEffect on the scoreboard
Not flaggedDefault, or an admin clearing the actorNone
SuspectedAutomatic flaggingNone, until an admin confirms or clears it
Flagged — hidden after the eventAn adminNone while the event runs. Hidden once the event is over or the scoreboard is locked
FlaggedAn adminHidden immediately

Flagging after the event is the default: the actor is still shown while the event runs, so they don't notice they were caught and switch accounts or methods. Flag immediately if they distort the scoreboard for everyone else, for example by solving a lot through flag sharing. See effects of flagging for what hiding means.

Automatic flagging ​

Submitting a flag that belongs to another actor that actually exists (an actor flag of another team, or an owner returned by a validation function that matches an existing team or player) is certain evidence. The submitter is marked as suspected automatically. This doesn't affect the scoreboard: the actor is in the review queue (shown as Suspected — needs confirmation) until an admin flags or clears them. The flag owner is not marked, because their flag may have leaked without their intent.

Automatic decisions appear in the audit log as made by Automatic. Set auto_flag_flag_sharing: false in the configuration to only record the evidence.

If a validation function returns an actor that doesn't exist, the flag is treated as wrong, not as flag sharing.

While the scoreboard is locked, flag submissions, flagging and unflagging, bracket changes and recomputing scores are blocked. Use Unlock scoreboard to correct a decision, then lock it again.

Attendance certificates can only be downloaded once the scoreboard is locked.

Event kinds ​

KindDefault weightTriggered when
flag_sharing_submitter10The actor submitted a valid flag that belongs to another actor (actor flags or a validation function returning another actor)
flag_sharing_owner5Another actor submitted this actor's flag. Lower, because a flag can also leak unintentionally
fast_solve3The actor solved a challenge within fast_solve_seconds (30) of solving another one
submission_burst2The actor made at least submission_burst_count (10) submissions, valid or not, within a minute. Counted at most once per minute
impossible_solve_time8The time from the first interaction with a challenge to the solve is below the minimum for its difficulty, or far below the median of other actors
solve_without_interaction15The actor solved a challenge with an instance or attachments without ever starting the instance, downloading the handout or attachments, or sending traffic to it
solve_without_traffic10The actor solved a challenge that only has an instance (no attachments, no handout) and started it more than 60 seconds before the solve, but no traffic to it was seen. Only checked while the traffic agent is reporting
correlated_solves10The actor and another actor solved at least correlated_solves.threshold (3) challenges within correlated_solves.window_seconds (300) of each other. Reported again at every multiple of the threshold
shared_ip2Players of different actors logged in from the same public IP address
foreign_instance_access15An IP address used to log in to this actor's account accessed another actor's challenge instance
ssh_key_shared15The actor and another actor logged in to SSH challenges with the same SSH key
instance_accessed_by_other5This actor's instance was accessed from an IP address another actor logged in from
shared_rare_tls_fingerprint3The actor's instances were accessed with a rare JA4 TLS fingerprint that only a few other actors use
foreign_canary20Another actor's canary token was seen in traffic to this actor's instance
canary_leaked5This actor's canary token was used by another actor
decoy_solve50The actor solved a decoy challenge
decoy_submission15The actor submitted a flag for a decoy challenge
decoy_instance10The actor started an instance of a decoy challenge
honeypot_instance50No-LLM mode: started the instance of the built-in honeypot (or submitted a flag for it)
llm_self_report100No-LLM mode: answered the built-in challenge that asks AI agents which model they are
submission_ai_provider_ip25No-LLM mode: a flag was submitted from an AI provider's IP range
submission_ai_user_agent25No-LLM mode: a flag was submitted with the user agent of an AI agent (for example ChatGPT-User or Claude-User)
submission_automation_user_agent5No-LLM mode: a flag was submitted with a headless browser or automation user agent (for example HeadlessChrome, Playwright, Selenium)
traffic_ai_provider_ip25No-LLM mode: the actor's instance was accessed from an AI provider's IP range
traffic_ai_user_agent25No-LLM mode: the instance was accessed with the user agent of an AI agent
traffic_automation_user_agent5No-LLM mode: the instance was accessed with a headless browser or automation user agent
traffic_unknown_user_agent2No-LLM mode: the instance was accessed with a user agent that isn't a browser or a common tool (curl, python-requests, sqlmap, ...)
traffic_empty_user_agent1No-LLM mode: the instance was accessed without a user agent
traffic_ssh_library_client2No-LLM mode: logged in to an SSH service with an SSH library (Paramiko, AsyncSSH, Go, ...) instead of an interactive client. Weak, because players script SSH too (pwntools uses Paramiko)
traffic_ssh_no_pubkey1No-LLM mode: logged in to an SSH service without offering any SSH key, as from a fresh, temporary environment. Weak, because some players have no keys or turn them off

The traffic_* kinds (traffic_ssh_library_client, traffic_ssh_no_pubkey and the SSH part of traffic_ai_provider_ip come from the SSH gateway instead, like ssh_key_shared), foreign_instance_access, instance_accessed_by_other, shared_rare_tls_fingerprint, the canary kinds and solve_without_traffic need the traffic agent. All other kinds work without it.

Details of some detectors ​

  • Rate limits aren't events, they block submissions: by default, an actor can submit at most 10 flags per minute, and at most 30 invalid flags per challenge within 10 minutes. Only players are limited.
  • Interactions are instance starts, handout and attachment downloads, and traffic to an instance seen by the traffic agent. They are recorded per actor, so a teammate's download counts for the whole team.
  • Correlated solves ignore challenges that more than correlated_solves.max_crowd (5) other actors solved in the same window, for example easy challenges right at the start.
  • IP addresses used by more than shared_ip_max_actors (3) actors are treated as shared networks (universities, companies, carrier-grade NAT) and ignored. Private addresses and AI provider ranges are always ignored. foreign_instance_access is also skipped if the instance owner's own players use the same IP address.
  • TLS fingerprints are only evaluated once at least rare_fingerprint_min_population (20) actors have been seen with a fingerprint. A fingerprint is rare if at most rare_fingerprint_max_actors (2) actors use it.

Client IP addresses

The API uses the rightmost public address in X-Forwarded-For as the client IP, because entries further left are supplied by the client and can be spoofed. Make sure your proxies append the client IP to the header.

Turning indicators off ​

Some indicators don't make sense for every event. At an on-site CTF, for example, everyone uses the same network, so shared_ip would match every team. Turn such indicators off on the Indicators tab of Administration → Cheat Detection:

  • Turned-off indicators aren't recorded anymore, and evidence recorded before doesn't count for the suspicion score. All scores are recalculated when you change an indicator.
  • The evidence recorded before is kept, marked as Turned off. If you turn the indicator back on, it counts again.
  • Indicators can't be changed while the scoreboard is locked, because scores would change.

The setting is stored in the database, so it can be changed during the event. To change how much an indicator counts instead, set its weight in the configuration. A weight of 0 still records the evidence, so you can look at it without it raising scores.

Configuration ​

All settings go into an optional anticheat section in event.yml. This example shows the defaults:

YAML
anticheat:
  # Override the weights of event kinds, see the table above. Set a weight to 0 to disable a kind.
  weights:
    shared_ip: 0
    decoy_solve: 100
  review_threshold: 20
  fast_solve_seconds: 30
  submission_burst_count: 10
  rate_limit:
    submissions_per_minute: 10 # 0 = unlimited
    invalid_per_challenge: 30 # 0 = unlimited
    invalid_window_minutes: 10
  correlated_solves:
    window_seconds: 300
    threshold: 3
    max_crowd: 5
  solve_time:
    min_seconds: # Per difficulty ID, no minimum by default
      easy: 30
      hard: 300
    relative_factor: 0.1
    min_samples: 5
  shared_ip_max_actors: 3
  rare_fingerprint_max_actors: 2
  rare_fingerprint_min_population: 20
  lock_brackets_after_start: true
  auto_flag_flag_sharing: true
OptionDefaultDescription
weightsNoneOverrides for the weights of event kinds
review_threshold20Actors with at least this score need to be reviewed before the scoreboard can be locked
fast_solve_seconds30Two solves of the same actor within this many seconds are a fast_solve
submission_burst_count10This many submissions within a minute are a submission_burst
rate_limit.submissions_per_minute10Maximum flag submissions per actor and minute
rate_limit.invalid_per_challenge30Maximum invalid submissions per actor and challenge within invalid_window_minutes
rate_limit.invalid_window_minutes10
correlated_solves.window_seconds300Solves of the same challenge within this many seconds are simultaneous
correlated_solves.threshold3Report a pair of actors once they have this many simultaneous solves
correlated_solves.max_crowd5Ignore a simultaneous solve if more actors solved the challenge in the same window
solve_time.min_secondsNoneMinimum plausible seconds from the first interaction to the solve, per difficulty ID
solve_time.relative_factor0.1Solves faster than this fraction of the median solve time of other actors are suspicious
solve_time.min_samples5The relative check needs at least this many other solves with a known solve time
shared_ip_max_actors3IP addresses used by more actors than this are ignored
rare_fingerprint_max_actors2TLS fingerprints used by at most this many actors are rare
rare_fingerprint_min_population20Minimum number of actors with a fingerprint before rarity is evaluated
lock_brackets_after_starttrueTeams can't change their bracket after the event started. Admins still can
auto_flag_flag_sharingtrueMark actors as suspected when they submit another existing actor's flag. This doesn't affect the scoreboard

The solve time for solve_time is measured from the actor's first interaction with the challenge. Challenges the actor never interacted with are not checked.

WARNING

If the anticheat section is invalid (for example a string where a number is expected), the API logs an error and uses the defaults for all options. Unknown options are ignored silently. Check the API logs after changing the section.

The configuration is cached for 30 seconds, so changes apply shortly after syncing the repository.

No-LLM mode ​

You can forbid the use of LLMs for a whole bracket, or for the challenges of some categories:

YAML
brackets:
  humans:
    name: Humans only
    can_self_enter: true
    no_llm: true

categories:
  web:
    name: Web
    no_llm: true

No-LLM mode applies to a submission if the actor is in a no_llm bracket or the challenge is in a no_llm category. The bracket is the main switch, categories are useful if only some challenges should be solved without LLMs.

When no-LLM mode applies:

  • Submissions where the player answers that they used LLMs (the LLM Assistance question when submitting a flag) are rejected. Outside of no-LLM mode, they're accepted and stored with the mark.
  • The submission_ai_*, submission_automation_user_agent and traffic_* user agent and IP signals count. Outside of no-LLM mode, the API ignores them, because using LLMs is allowed there.

Because a team could otherwise use LLMs and move to a no-LLM bracket afterwards, teams can't change their bracket after the event started (see lock_brackets_after_start).

AI provider IP ranges ​

Both the API and the traffic agent check IP addresses against the published ranges of AI providers, which they use when a model fetches a web page or calls a tool:

  • Anthropic's outbound range is built in.
  • OpenAI's lists (GPTBot, ChatGPT-User, OAI-SearchBot) are downloaded at startup and every 6 hours. Set NO_OPENAI_DOWNLOAD=true to disable this.
  • xAI doesn't publish IP ranges.

You can add your own ranges with a file referenced by AI_IP_RANGES_FILE. Every line has the form <provider> <cidr>, comments start with #:

# provider  range
xai         192.0.2.0/24
myprovider  198.51.100.7

WARNING

Agents that run on a player's own machine (for example coding agents in a terminal) use the player's IP address and their own tools, so they can't be detected by IP address, and their user agent can be anything. User agents are trivial to fake in both directions. Treat these signals as hints, and use decoy challenges as well.

Decoy challenges ​

A decoy challenge is a honeypot for LLM agents. Mark it with decoy: true in the challenge metadata:

YAML
x-ctf-metadata:
  name: Bonus flag
  decoy: true
  flag: ctfgarden{this_is_a_trap}
  # ...

The API returns decoys like normal challenges and never tells players which challenges are decoys. The frontend fetches the list from the API's internal endpoint GET /internal/decoy-challenges (which needs INTERNAL_API_TOKEN) and hides these challenges from human players. An agent that reads the API or the page data still finds them, so interacting with a decoy is a strong signal: starting its instance (decoy_instance), submitting a flag for it (decoy_submission) and solving it (decoy_solve) are all recorded.

Admins see decoys with a [DECOY] prefix in the challenge name. Submissions for decoys are never announced in public Discord notifications, and private notifications contain the same prefix.

INFO

A decoy solve is stored like any other solve and counts for the scoreboard, so nobody can tell from the scoreboard that something happened. It's only a signal for admins. The frontend still hides the decoy challenge itself from non-admins, including on the scoreboard.

Built-in honeypots ​

For no-LLM brackets, the platform has two built-in challenges that aren't in the CTF repository. For teams in a no-LLM bracket, the API lists them like any other challenge, and the challenges page includes them, but hidden from people: they're invisible, and screen readers and keyboard navigation skip them. An AI agent that reads the page or uses the API finds them, a person using the page doesn't.

ChallengeWhat it does
Status Panel (status-panel)Looks like a normal web challenge with an instance. Starting the instance records honeypot_instance. The instance never comes up
Notice for AI agents (llm-disclosure)Asks AI agents to submit the model they are as the flag, with their agent framework if they know it, or LLM_USED. Any answer records llm_self_report with what was submitted, and is answered as correct so the agent moves on. It doesn't count as a solve

Both mark the team as suspected, so it's in the review queue, but the scoreboard isn't affected until an admin confirms it. The submitted answers are shown in the evidence, so you also learn which models and tools were used.

Both work through the same API calls as real challenges, so an agent can't tell them apart. For teams outside no-LLM brackets they don't exist: they're not in the list, starting the instance fails, and submissions are wrong. Admins see both as normal challenges named [HONEYPOT] ..., and can try them without being recorded. They use the event's easiest difficulty and a web and misc category (or the first category, if the event has no such category).

The IDs status-panel and llm-disclosure are reserved. A challenge in the repository with one of these IDs replaces the built-in one, ctfgarden lint warns about it.

Actor flags ​

Every actor gets their own challenge instance, so every actor can get their own flag. If an actor submits a flag that belongs to someone else, the submission is rejected, both actors get a flag sharing event, the submitter is marked as suspected, and the private invalid submissions notification contains a warning.

The easiest way is the built-in actor_flag metadata key with the flag() template function. You can also write a validation function that returns the actor a flag belongs to.

Canaries ​

Per-actor flags only help if the final flag is different for everyone. Many challenges have intermediate secrets, like a leaked password, an API key or a session cookie, and a team that gets help from another team often doesn't need the flag, only these secrets.

Canary tokens make these secrets per-actor too. Generate them with the canary() template function and declare their names in canaries in the metadata. The traffic agent searches the plaintext traffic into every instance for the canary tokens of all actors. If team B's instance receives team A's token (for example because B logs in with the password A found), B gets a foreign_canary event and A a canary_leaked event. This works even if the final flag is the same for everyone.

Effects of flagging ​

Once a flag takes effect (immediately, or after the event for Flagged — hidden after the event, see cheater statuses), actors flagged as cheaters:

  • are hidden from the public scoreboard, team and user lists (admins still see them, marked as flagged, and can hide them with a switch on the scoreboard; members of a flagged team can still see their own team),
  • are excluded from points calculation: their solves don't count for dynamic scoring and they don't count as competitors,
  • don't get public Discord notifications for their submissions anymore. Private notifications are still sent,
  • get the cheater certificate instead of the normal one. Certificates are only available once the scoreboard is locked, so this applies to both kinds of flags, but not to suspected actors whose flag was never confirmed.

They're not notified, and they can keep playing until the event ends.

Team hopping ​

Players can't leave a team, so they can't solve challenges in one team and then move to another. Solves are stored per user and attributed to the user's current team.

Cheater certificate ​

If certificates are enabled, flagged actors get an ironic "Certificate of Participation" instead of the normal one, with an appendix that lists the evidence against their team: every event that added to the score (up to 300), with the time, challenge, a description and the points. In team CTFs, the rows caused by the recipient are highlighted.

The descriptions never contain other actors, IP addresses, flags or canary values. Other actors are only mentioned as "another team" or "another player".

See cheater certificates to use your own template or preview it.

SSH keys ​

Players log in to SSH challenges with a password, but SSH clients offer the user's public keys first. The SSH gateway asks the client to sign with the first key it offers, like for a normal key login, and then still asks for the password. A signature proves the client has the private key, so a key can't be faked by offering someone else's public key (which are often public, GitHub publishes them).

If two actors signed with the same key, someone has access to both: a player in two teams, or a machine shared between them. Both get an ssh_key_shared event. Only signed keys are compared. Keys the client offered but didn't sign are stored, but anyone could have offered them.

Clients sign without asking with keys from an SSH agent and keys without passphrase. For a key with a passphrase that isn't in an agent, OpenSSH asks for the passphrase. Players can press Enter to skip it, the login then continues with the next key and the password. Set SSH_VERIFY_KEYS=false (sshGateway.verifyKeys: false in the Helm chart) to record offered keys without asking for signatures, which avoids the passphrase prompt but makes ssh_key_shared impossible.

In no-LLM mode, logging in without offering any key adds traffic_ssh_no_pubkey: interactive clients on a player's machine usually have keys, a fresh container or VM set up for an LLM agent doesn't.

SSH pastes ​

The SSH gateway logs what players paste into interactive SSH sessions (sessions with a terminal, so not piped input or file transfers). Pasting is normal, so pastes don't add to the suspicion score. They're there for reviewing a suspicious actor: what did they paste, and when? The SSH pastes tab of an actor on the cheat detection page lists them, and marks pastes that other teams pasted exactly the same (pastes shorter than 32 bytes are too common to compare).

Pastes are recognized in two ways:

  • Bracketed paste: terminals mark pasted text if the program in the session asks for it, which bash and zsh do by default. This is exact.
  • Bursts: otherwise, a paste arrives as many characters at once, while typing sends one key at a time. This also catches scripts that type into a terminal.

The first 16 KiB of every paste are stored, and its length and a hash of all of it (with line endings normalized, so the same text pasted on Windows and Linux matches).

Data protection ​

Cheat detection processes personal data. If your event is subject to the GDPR or similar laws, plan for it before the event:

  • What's stored: login IP addresses and user agents (sessions), the IP address, user agent and TLS fingerprint of every client that accesses a challenge instance, suspicion events with their details (which can contain IP addresses, user agents and submitted flags), what players paste into SSH sessions (which can contain anything a player copied, including their own secrets), and the fingerprints of their SSH keys.
  • Packet captures: the traffic agent stores the full traffic of all instances and of the ingress as pcap files. They contain everything players send to their instances, and the traffic of the ingress can contain plaintext requests to the platform itself. Restrict access to them.
  • Retention: decide how long you keep pcap files (for example until the scoreboard is locked and complaints are handled) and set PCAP_RETENTION_DAYS accordingly.
  • Inform players: describe in your rules_md what you collect, why (detecting cheating, enforcing the rules), how long you keep it, and what happens to flagged teams.

Imprint