agentleFS
buzzer-rebuzzer-re/Rikugan/skills/ctf/SKILL.md

ctf

Skill715 starsChanged 5 days agoMITView on GitHub

Capture-the-flag reverse engineering — find the flag efficiently

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Direct extraction: If the flag is compared byte-by-byte or XOR'd with a known key, extract both operands and compute the flag directly.

    line 33
  2. Distinctive:

    Transformation reversal: If the input goes through a series of reversible transforms (XOR, rotate, shuffle, substitution), reverse each …

    line 49
  3. Distinctive:

    If you find encrypted/encoded data, try to reverse the algorithm from the decompiled code

    line 55
  4. Very specific:

    Check xrefs_to on comparison/validation functions to find where the flag is checked

    line 58
  5. Distinctive:

    Look at string xrefs — flag-related strings often lead directly to the validation logic

    line 59
  6. Distinctive:

    If stuck, check for hardcoded keys or constants near the comparison code

    line 60

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Task: CTF Challenge. You are solving a capture-the-flag reverse engineering challenge. The goal is finding the flag.

Approach

Be targeted and efficient. CTF binaries are usually small, purpose-built, and contain a clear solve path. Don't over-analyze — find the check/validation function, understand the constraint, solve it.

Workflow

  1. get_binary_info + list_functions — orient yourself, find main or entry (batch these)
  2. decompile_function on main — identify the input path and validation logic
  3. Trace the check function: usually a comparison, hash check, or transformation chain
  4. Identify the algorithm: XOR, custom cipher, hash, math constraints, maze/game, VM-based
  5. search_strings for flag format strings (CTF{, flag{, HTB{, etc.)
  6. Solve: extract the key/flag directly, reverse the transformation, or write a solver

Common Patterns

  • Flag format strings visible in list_strings or search_strings
  • Input validation concentrated in a single function
  • XOR with static key — extract key and data, XOR to get flag
  • Base64 or custom encoding — identify the table, decode
  • Constraint satisfaction — extract constraints, use z3 via execute_python
  • Anti-debug checks (ptrace, IsDebuggerPresent) guarding the real logic — bypass or ignore
  • Multi-stage: unpacking → decryption → flag check
  • VM-based: custom bytecode interpreter — map opcodes, trace execution, extract constraints

Solving Strategies

Direct extraction: If the flag is compared byte-by-byte or XOR'd with a known key, extract both operands and compute the flag directly.

Constraint solving: For complex validation (many conditions, polynomial checks, matrix transforms), extract constraints and write a z3 solver:

from z3 import *
s = Solver()
flag = [BitVec(f'c{i}', 8) for i in range(N)]
# Add constraints from decompiled validation...
s.add(...)
if s.check() == sat:
    m = s.model()
    print(''.join(chr(m[c].as_long()) for c in flag))

Transformation reversal: If the input goes through a series of reversible transforms (XOR, rotate, shuffle, substitution), reverse each step in order.

Tips

  • If you find encrypted/encoded data, try to reverse the algorithm from the decompiled code
  • For constraint solving, write and execute a Python script with execute_python
  • Focus on the solve path — don't enumerate every function or produce threat reports
  • Check xrefs_to on comparison/validation functions to find where the flag is checked
  • Look at string xrefs — flag-related strings often lead directly to the validation logic
  • If stuck, check for hardcoded keys or constants near the comparison code

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.