Dynamic Flags #34
Labels
Challenges
Anything related directly to challenges (i.e. how they're displayed, their deployment, etc.)
Far Future
Feature Suggestion
General feature ideas that should be implemented/incorporated with the existing platform.
Infrastructure
Something that would increase the reliability or ease of deployment of the CTF's challenges.
This one will require a lot of reworking, so it's very far into the future.
The basic idea of this are individual flags for each team1 to discourage/ban/monitor flag sharing.
Optimally, there will be some sort of algorithm so that we won't need to store the individual flags for every single team. This is one possible idea:
To generate the target for the team:
DYNAMIC_FLAG_GEN_KEY
.Needs to be kept secret, because otherwise the teams could derive their hash themselves.
a. Create string
const string = `${inner.length}${inner}+${teamId}+${dynamicFlagGenKey}`;
b. Hash the string and get a hex digest
I. This probably is good enough with SHA or MD5, as long as the flag gen key is long enough.
As far as I'm aware, those are only meaningfully weak against preimage attacks. (LMK IF I'M WRONG THOUGH PLEASE.)
Increasing the time for generating/verifying the flags will probably not be a good idea for large numbers of teams.
c. Take the first 10 characters of the digest.
I. This gives us about 1 billion unique hashes, which should be more than sufficient without making the flags too much longer.
II. In the future, it may make sense to allow the challenge author to control the length of the hash, with some lower bound for safety.
const flag = `<flagPrefix>{${inner}-${hashChars}}`;
To verify a flag submission for the team:
a. Strip
<flagPrefix>{
from the beginning and}
from the endb. Strip the
-
and the hash from the end, and return do something with it if it doesn't match2.This is just 1 idea for the algorithm.
Propose other ones, discuss the pros/cons of individual pre-stored flags, etc.
For Webhook:
This one will take a bit of work.
It's currently being rewritten in rust, so I'll just put some highlights:
DYNAMIC_FLAG_GEN_KEY
solve_attempts
andsolve_successes
tables.For Deploy:
DYNAMIC_FLAG_GEN_KEY
For Frontend:
It's likely that not much will need to be done.
The frontend doesn't store flags at all, and just echos what the webhook server returns in terms of flag correctness.
Footnotes
This may be slightly infeasible for certain challenges.
With on-demand instances, it may be easier though? Not sure ↩
Well now we have timing attack problems. Great. ↩ ↩2
The text was updated successfully, but these errors were encountered: