Quantum Safe
Quantum Safe is a sanitized challenge note from the local HTB archive, organized for quick review by category, difficulty, evidence flow, and reusable operator
Scenario
Quantum Safe attack path
Quantum Safe is a sanitized challenge note from the local HTB archive, organized for quick review by category, difficulty, evidence flow, and reusable operator
Objective
Challenge walkthrough focused on Crypto evidence, validation, and reusable operator lessons.
Walkthrough flow
Extracted the HTB archive and found source.sage plus...
Identified the encryption as a per-character integer...
Observed that the fixed offset vector r has only 11^3...
Brute-forced r, inverted the public matrix over exact...
Filtered candidates by printable proof characters and...
Source coverage
High source coverage
Status: complete. This article is generated from 6 sanitized Markdown sources and keeps raw flags, credentials, keys, cookies, and reusable secrets out of the rendered blog.
High confidence: the page is reconstructed from a primary walkthrough plus multiple supporting notes or evidence sources. Treat the chain as source-backed, while still checking the listed source files for sensitive values.
- Crypto/Quantum-Safe/writeup.md
- htb-challenge/Crypto/Quantum-Safe/notes.md
- htb-challenge/Crypto/Quantum-Safe/memory-summary.md
- htb-challenge/Crypto/Quantum-Safe/hypothesis-board.md
- HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/challenge__Crypto__Quantum-Safe__memory-summary.md.c4efb25cb1.md
- HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/challenge__Crypto__Quantum-Safe__notes.md.922ae8e2e8.md
Technical Walkthrough
Writeup
Challenge
- Name: Quantum-Safe
- Category: Crypto
- Difficulty: Easy
- Mode: file
Summary
The challenge presents itself as “quantum safe,” but the provided Sage source uses a small linear transformation over the integers. The only unknown global value is a three-entry offset vector sampled from 0..10, so the solve is exact linear algebra plus a tiny brute force.
Artifact Inventory
Reference analysis/artifact-inventory.json and summarize the relevant files or remote surface.
source.sage: encryption source that definespubkey, the fixed random offset vectorr, and the per-character encoding.output.txt: one transformed 3-vector per flag character.- No remote instance is required.
Analysis
The Sage source writes each character as:
[ord(c), random_1, random_2] * pubkey + rThe two random coordinates are bounded to 0..100, and the shared offset vector r is bounded to 0..10 for each coordinate. Because pubkey is invertible, every candidate r can be tested by subtracting it from each output row and multiplying by pubkey^-1.
The correct offset is the only candidate that makes every recovered vector integral, keeps the first coordinate printable, and keeps the two random coordinates inside 0..100.
Solve
Run:
python3 solve/solve.pyThe script parses output.txt, brute-forces all 11^3 possible offset vectors, inverts the matrix using exact rational arithmetic, filters invalid candidates, and prints the unique HTB-format flag.
Flag
Raw flag is stored in loot/flag.txt and intentionally not reproduced here.
Lessons
- A source-provided “post-quantum” theme can still reduce to ordinary linear algebra.
- Small global randomness should be brute-forced before attempting heavier tooling.
- Exact rational arithmetic avoids false positives from floating-point matrix inversion.
Source-Backed Dossier
The sections below are merged from companion Markdown notes for the same case. They are rendered after sanitization so the article stays precise without publishing raw flags, credentials, or target-specific secrets.
Notes
Scope
- Challenge: Quantum-Safe
- Category: Crypto
- Difficulty: Easy
- Mode: file
- Remote instance: none
- Start time: 2026-06-10T09:03:10Z
- Operator: harness
- State file:
challenge-state.json
Harness Status
- Current phase: see
challenge-state.json - Next allowed actions: see
next-action.json - Raw flags and sensitive material stay in
loot/only. Do not paste them here.
Artifact Inventory
| File | Size | SHA256 | Type | Notes |
|---|---|---|---|---|
files/a12c7372-6265-41cb-8cf6-f2e93630c2d4.zip | 1261 | <hash redacted> | Zip archive data, at least v1.0 to extract, compression method=store | zip entries: 3 shown in artifact inventory JSON |
files/extracted/crypto_quantum_safe/output.txt | 947 | <hash redacted> | CSV text | |
files/extracted/crypto_quantum_safe/source.sage | 320 | <hash redacted> | ASCII text, with CRLF line terminators |
Evidence Ledger
| Time | Action | Output/File | Finding | Confidence | Next |
|---|---|---|---|---|---|
| 2026-06-10T09:03:10Z | harness init | challenge-state.json | Workspace initialized with deterministic state file | High | Inventory artifacts |
| 2026-06-10T09:03:21Z | artifact inventory | analysis/artifact-inventory.json | 3 artifact(s) inventoried | High | Build or update hypotheses |
| 2026-06-10T09:04:44Z | hypothesis recorded | hypothesis-board.md | Invert the provided linear map after brute-forcing the tiny fixed offset vector r. | Medium | Brute-force r in 11^3 candidates, invert pubkey over exact rationals, and require printable chars plus noise coordinates in 0..100. |
| 2026-06-10T09:04:44Z | research record | analysis/research/research-records.md | Research tagged MATCHED | Medium | Validate against current evidence |
| 2026-06-10T09:04:44Z | flag capture | loot/flag.txt | HTB-format flag captured; raw value kept in loot only | High | Write solution and run completion gate |
| 2026-06-10T09:05:32Z | completion gate | challenge-state.json | Completion gate passed; state marked COMPLETE | High | Optional sanitized memory summary approval |
Key Findings
source.sageis the authoritative encryption logic.- Each flag character is encoded independently as
[ord(c), randint(0,100), randint(0,100)] * pubkey + r. - The fixed offset
ris sampled once as a 3-vector with values in0..10, making exhaustive search only11^3candidates. - For the correct
r, multiplying each adjusted output vector bypubkey^-1over exact rationals recovers integral triples. - The first recovered coordinate is the flag character, while the second and third coordinates must remain within
0..100. - The solver found a unique HTB-format candidate and captured it via the harness into
loot/flag.txt.
RAG / Advisory Memory
RAG output is advisory only. Record evaluated retrievals with:
scripts/challenge_harness.py rag-record <workspace> --query "..." --tag MATCHED|PARTIAL|MISSING|<secret redacted>|GENERIC --validation "..."Secrets/Flags
Raw flags and sensitive material stay in loot/ only. Use scripts/challenge_harness.py capture-flag to validate and record flag capture without printing the value.
Memory Summary
Metadata
- Platform: HackTheBox Challenges
- Category: Crypto
- Challenge: Quantum-Safe
- Difficulty: Easy
- Source workspace:
<local workspace>
Validated Solve Chain
Concepts only. Do not include raw flags, reusable credentials, tokens, cookies, private keys, or live secrets.
- Extracted the HTB archive and found
source.sageplusoutput.txt. - Identified the encryption as a per-character integer vector transformation:
[ord(c), noise1, noise2] * pubkey + r. - Observed that the fixed offset vector
rhas only11^3possible values. - Brute-forced
r, inverted the public matrix over exact rationals, and required each recovered row to be integral. - Filtered candidates by printable flag characters and bounded noise coordinates in
0..100. - Recovered one unique HTB-format flag and captured it with the challenge harness.
Reusable Lessons
- For source-based crypto challenges, inspect the data model and randomness bounds before reaching for specialized tooling.
- If a linear map is invertible and the global random offset is small, brute-force the offset and solve exactly.
- Use rational/integer arithmetic for matrix recovery to avoid floating-point precision mistakes.
Dead Ends
- Sage was not installed locally, but it was unnecessary because the source translated cleanly to Python.
- Heavy crypto or quantum-specific tooling was not needed.
Tool Quirks
- Local
tool_readiness.pyreported Sage, sympy, and z3 missing. - The final solver uses only Python standard library modules.
Evidence Paths
files/extracted/crypto_quantum_safe/source.sagefiles/extracted/crypto_quantum_safe/output.txtanalysis/research/local-crypto-strategy.mdsolve/solve.pyloot/flag.txt
Ingestion Decision
- Proposed for LightRAG: yes
- Requires user approval before ingestion: yes
Hypothesis Board
Keep no more than 3 active hypotheses on Easy/Medium and 5 on Hard unless the user explicitly asks for breadth.
| Rank | Path | Evidence | Missing Proof | Cheapest Validation | Confidence | Status |
|---|---|---|---|---|---|---|
| 1 | Invert the provided linear map after brute-forcing the tiny fixed offset vector r. | source.sage encrypts [ord(c), randint(0,100), randint(0,100)] * pubkey + r, with r entries in 0..10. | Brute-force r in 11^3 candidates, invert pubkey over exact rationals, and require printable chars plus noise coordinates in 0..100. | Medium | Active |
Closed Branches
| Branch | Evidence Tested | Failure Output | Reason Closed | Revisit Condition |
|---|
Memory Summary
approval_required: true
Sanitized Memory Summary
Metadata
- Platform: HackTheBox Challenges
- Category: Crypto
- Challenge: Quantum-Safe
- Difficulty: Easy
- Source workspace:
<local workspace>
Validated Solve Chain
Concepts only. Do not include raw flags, reusable credentials, tokens, cookies, private keys, or live secrets.
- Extracted the HTB archive and found
source.sageplusoutput.txt. - Identified the encryption as a per-character integer vector transformation:
[ord(c), noise1, noise2] * pubkey + r. - Observed that the fixed offset vector
rhas only11^3possible values. - Brute-forced
r, inverted the public matrix over exact rationals, and required each recovered row to be integral. - Filtered candidates by printable flag characters and bounded noise coordinates in
0..100. - Recovered one unique HTB-format flag and captured it with the challenge harness.
Reusable Lessons
- For source-based crypto challenges, inspect the data model and randomness bounds before reaching for specialized tooling.
- If a linear map is invertible and the global random offset is small, brute-force the offset and solve exactly.
- Use rational/integer arithmetic for matrix recovery to avoid floating-point precision mistakes.
Dead Ends
- Sage was not installed locally, but it was unnecessary because the source translated cleanly to Python.
- Heavy crypto or quantum-specific tooling was not needed.
Tool Quirks
- Local
tool_readiness.pyreported Sage, sympy, and z3 missing. - The final solver uses only Python standard library modules.
Evidence Paths
files/extracted/crypto_quantum_safe/source.sagefiles/extracted/crypto_quantum_safe/output.txtanalysis/research/local-crypto-strategy.mdsolve/solve.pyloot/flag.txt
Ingestion Decision
- Proposed for LightRAG: yes
- Requires user approval before ingestion: yes
Notes
Notes
Scope
- Challenge: Quantum-Safe
- Category: Crypto
- Difficulty: Easy
- Mode: file
- Remote instance: none
- Start time: 2026-06-10T09:03:10Z
- Operator: harness
- State file:
challenge-state.json
Harness Status
- Current phase: see
challenge-state.json - Next allowed actions: see
next-action.json - Raw flags and sensitive material stay in
loot/only. Do not paste them here.
Artifact Inventory
| File | Size | SHA256 | Type | Notes |
|---|---|---|---|---|
files/a12c7372-6265-41cb-8cf6-f2e93630c2d4.zip | 1261 | <hash redacted> | Zip archive data, at least v1.0 to extract, compression method=store | zip entries: 3 shown in artifact inventory JSON |
files/extracted/crypto_quantum_safe/output.txt | 947 | <hash redacted> | CSV text | |
files/extracted/crypto_quantum_safe/source.sage | 320 | <hash redacted> | ASCII text, with CRLF line terminators |
Evidence Ledger
| Time | Action | Output/File | Finding | Confidence | Next |
|---|---|---|---|---|---|
| 2026-06-10T09:03:10Z | harness init | challenge-state.json | Workspace initialized with deterministic state file | High | Inventory artifacts |
| 2026-06-10T09:03:21Z | artifact inventory | analysis/artifact-inventory.json | 3 artifact(s) inventoried | High | Build or update hypotheses |
| 2026-06-10T09:04:44Z | hypothesis recorded | hypothesis-board.md | Invert the provided linear map after brute-forcing the tiny fixed offset vector r. | Medium | Brute-force r in 11^3 candidates, invert pubkey over exact rationals, and require printable chars plus noise coordinates in 0..100. |
| 2026-06-10T09:04:44Z | research record | analysis/research/research-records.md | Research tagged MATCHED | Medium | Validate against current evidence |
| 2026-06-10T09: <REDACTED> | |||||
| 2026-06-10T09:05:32Z | completion gate | challenge-state.json | Completion gate passed; state marked COMPLETE | High | Optional sanitized memory summary approval |
Key Findings
source.sageis the authoritative encryption logic.- Each flag character is encoded independently as
[ord(c), randint(0,100), randint(0,100)] * pubkey + r. - The fixed offset
ris sampled once as a 3-vector with values in0..10, making exhaustive search only11^3candidates. - For the correct
r, multiplying each adjusted output vector bypubkey^-1over exact rationals recovers integral triples. - The first recovered coordinate is the flag character, while the second and third coordinates must remain within
0..100. - The solver found a unique HTB-format candidate and captured it via the harness into
loot/flag.txt.
RAG / Advisory Memory
RAG output is advisory only. Record evaluated retrievals with:
scripts/challenge_harness.py rag-record <workspace> --query "..." --tag MATCHED|PARTIAL|MISSING|<secret redacted>|GENERIC --validation "..."Secrets/Flags
Raw flags and sensitive material stay in loot/ only. Use scripts/challenge_harness.py capture-flag to validate and record flag capture without printing the value.
Technical analogy
How to remember this solve
Think of the challenge like a locked box where the lock is mathematical but slightly flawed. The goal is not to smash the box; it is to notice which part of the lock repeats, leaks, or trusts the wrong assumption.
For Quantum Safe, keep the mental model simple: identify the trusted assumption, prove it with the smallest safe test, then automate or repeat only the part that directly leads to the flag.