Challenge / ICS

Flow Override

Flow Override is a sanitized challenge note from the local HTB archive, organized for quick review by category, difficulty, evidence flow, and reusable operator

MediumPublished 2024-11-19Sanitized local writeup

Scenario

Flow Override attack path

Flow Override 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 ICS evidence, validation, and reusable operator lessons.

Flow Override sanitized attack graph

Walkthrough flow

01

Artifact review

02

Hypothesis

03

Validated solve path

04

Proof captured

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.

100% coverage
Evidence verdict

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.

  • ICS/Flow-Override/writeup.md
  • htb-challenge/ICS/Flow-Override/notes.md
  • htb-challenge/ICS/Flow-Override/memory-summary.md
  • htb-challenge/ICS/Flow-Override/hypothesis-board.md
  • HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/challenge__ICS__Flow-Override__memory-summary.md.6dab2f8674.md
  • HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/challenge__ICS__Flow-Override__notes.md.d3c0bbbb07.md

Technical Walkthrough

Writeup

Challenge

  • Name: Flow-Override
  • Category: ICS
  • Difficulty: Medium
  • Mode: remote

Summary

The challenge exposed a water-treatment HMI on 31083/tcp and a Siemens S7comm-compatible PLC simulator on 30887/tcp. The HMI /status endpoint showed five equipment status fields plus a flag field. Read-only S7 probing confirmed DB1 was writable and controlled live process values.

Initial DB1-only missions could overheat the heat exchanger and briefly overspeed the mixer, but tank valves were repeatedly overwritten because manual_mode stayed disabled. Advisory research then identified DB1 byte 4 as the missing manual-mode control. Validating that against the live instance allowed three simultaneous disruptions: water tank overflow, chlorine tank overflow, and heat exchanger overheat.

Artifact Inventory

Reference analysis/artifact-inventory.json and summarize the relevant files or remote surface.

  • Remote-only challenge; no local archive artifacts were provided.
  • analysis/nmap-two-ports.txt: identified 31083/tcp as the Werkzeug HMI and 30887/tcp as the PLC/S7 surface.
  • analysis/nmap-s7-info-30887-forced.txt: confirmed an S7/SNAP7 server presenting CPU information.
  • analysis/curl-31083-status.json: captured the HMI JSON fields used as the success signal.

Analysis

  1. The HMI root page polls /status and alerts the flag value when present. The response includes valve booleans, tank fill percentages, equipment status strings, manual_mode, and flag.
  2. DB1 read probes showed stable control/setpoint values, including mixer speed, mixer duration, heat exchanger hot-side temperature, and several packed valve bytes.
  3. Controlled writes proved DB1 writes affected the live HMI. Sustained writes against the heat setpoint produced heatexch_status: over heat.
  4. Whole-byte and exact-bit missions were insufficient because automatic logic kept restoring tank behavior while manual_mode remained false. Those failed branches are recorded in analysis/mission-mapped-transcript.txt and analysis/mission-exact-bit-transcript.txt.
  5. A third-party writeup was recorded only as advisory research in analysis/research/flow-override-ctfbase-20260611.md. Its key lead was DB1 byte 4 for manual mode. The final mission validated this live: the transcript shows manual_mode: true, then three faults and a flag.

Solve

The reproducible solver is solve/solve.py.

Final mission behavior:

  • Enable manual mode: DB1 byte 4 = 1.
  • Force water tank overflow: water input on, water output off.
  • Force chlorine tank overflow: chlorine input on, chlorine output off.
  • Force heat exchanger overheat: high hot-side temperature byte.
  • Poll /status and write the raw flag only to loot/flag-candidate.txt.

Final proof is in analysis/mission-manual-mode-transcript.txt. The flag was captured through the harness into loot/flag.txt.

Flag

Raw flag is stored in loot/flag.txt and intentionally not reproduced here.

Lessons

  • In S7/PLC challenges, DB write access alone is not enough; identify whether automatic control logic must be disabled before actuator writes will persist.
  • Treat external writeups as leads only. The decisive step was validating DB1 byte 4 against the live /status response.
  • Keep raw flags confined to loot/ and redact dashboard responses outside loot.

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: Flow-Override
  • Category: ICS
  • Difficulty: Medium
  • Mode: remote
  • Remote instance: <TARGET>:30887,<TARGET>:31083
  • Start time: 2026-06-11T06:40:50Z
  • 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

FileSizeSHA256TypeNotes
0remote-only or no provided filesNo local artifacts found under files/

Evidence Ledger

TimeActionOutput/FileFindingConfidenceNext
2026-06-11T06:40:50Zharness initchallenge-state.jsonWorkspace initialized with deterministic state fileHighInventory artifacts
2026-06-11T06:40:50Zartifact inventoryanalysis/artifact-inventory.json0 artifact(s) inventoriedHighBuild or update hypotheses
2026-06-11T06:40:50Zsession bootstrapnotes.mdChallenge metadata, scenario, and prior context seeded into workspaceHighRecord initial hypothesis and research
2026-06-11T06:40:50Zhypothesis recordedhypothesis-board.mdinitial triage from supplied challenge metadataMediuminventory files / inspect app surface / map routes depending on category
2026-06-11T06:40:50Zresearch taskanalysis/research/task-20260611T064050897034Z-8b12fc57.mdResearch task created for advisory investigationMediumRecord research output
2026-06-11T06:41:06Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T064106838750Z-f71f5f3a.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T06:41:41ZRAG queryanalysis/rag/rag-query-20260611T064129115856Z-a7cc93f7.txtRAG helper exited 0; output savedMediumRecord retrieval tag and validation
2026-06-11T06:42:08ZRAG recordanalysis/rag-records.mdRetrieved memory tagged GENERICMediumValidate or reject with live evidence
2026-06-11T06:42:08Zinstrumentation plananalysis/instrumentation-plan.mdIdentify which provided port is the dashboard/helper and which is S7comm, map any read-only equipment/state surface, then perform only the minimal bounded writes needed to disrupt at least three equipment items and retrieve the dashboard flag.HighStop after any alarm/reset-like signal, ambiguous write prompt, failed S7 negotiation, or two mutation attempts without a new fact; record failure and refresh hypotheses.
2026-06-11T06:42:28Zlocal memory recordanalysis/local-memory-records.mdPrior local notes reviewed as fallback/advisory contextMediumValidate against current evidence
2026-06-11T06:42:28Zevaluatoranalysis/evaluator-20260611T064228658144Z-04fbaa13.mdProceedHighUse challenge_exec for read-only nmap and banner/dashboard probes; save all transcripts under analysis/.
2026-06-11T06:45:10Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T064510837957Z-fc44d1c5.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T06:48:46Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T064846339899Z-ed974a5b.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T06:48:46Zevaluatoranalysis/evaluator-20260611T064846392332Z-8f07c07f.mdProceedHighRun solve.py write for DB1 byte 81=1 through challenge_exec; save transcript.
2026-06-11T06:51:25Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T065125574912Z-4916b1f7.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T06:51:25Zevaluatoranalysis/evaluator-20260611T065125631918Z-5ef35f2e.mdProceedHighRun controlled write/observe/restore tests through challenge_exec and save JSON transcripts.
2026-06-11T06:53:32Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T065332301615Z-1d5d72c1.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T06:53:32Zevaluatoranalysis/evaluator-20260611T065332352509Z-19d68771.mdProceedHighRun mission through challenge_exec and capture loot/flag-candidate.txt if produced.
2026-06-11T06:55:57Zbranch closedhypothesis-board.mdSustained writes successfully faulted the heat exchanger via DB1 word 48, but automatic process logic kept or restored valve states and only one equipment status became faulty; no flag appeared.HighRerank hypotheses
2026-06-11T06:55:57Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T065557385958Z-2e88a21d.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T06:56:32Zevaluatoranalysis/evaluator-20260611T065632532106Z-5e22c00a.mdProceedHighRun solve.py map-bytes on likely DB1 control offsets and review deltas.
2026-06-11T07:00:03Zevaluatoranalysis/evaluator-20260611T070003534628Z-a47a14db.mdProceedHighRun 0xff candidate mapping and review manual_mode/control deltas.
2026-06-11T07:05:45Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T070545994970Z-d7577ae5.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T07:05:45Zevaluatoranalysis/evaluator-20260611T070545998401Z-36c83aff.mdProceedHighRun solve.py mission through challenge_exec and capture loot/flag-candidate.txt if produced.
2026-06-11T07:10:46Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T071046044350Z-395abd8f.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T07:10:58Zevaluatoranalysis/evaluator-20260611T071058561588Z-b9f4089b.mdProceedHighRun solve.py map-bits through challenge_exec on offsets 0,1,30,50,61,62,90,91,112.
2026-06-11T07:10:58Zbranch closedhypothesis-board.mdThe 120-second mapped mission sustained whole-byte writes against water, chlorine, mixer, and heat controls, but only heat exchanger became faulty. This branch is too coarse because whole-byte writes clobber adjacent packed controls while automatic logic remains active.HighRerank hypotheses
2026-06-11T07:17:20Zevaluatoranalysis/evaluator-20260611T071720014177Z-c8688487.mdProceedHighRun solve.py mission through challenge_exec; capture loot/flag-candidate.txt if produced.
2026-06-11T07:17:20Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T071720016254Z-6630df7a.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T07:21:34Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T072134466265Z-69f6a2c2.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T07:21:34Zbranch closedhypothesis-board.mdExact DB1 bit reassertion improved from one to two faults, but tank statuses remained healthy and no flag appeared. DB1-only control is insufficient as currently mapped.HighRerank hypotheses
2026-06-11T07:21:49Zevaluatoranalysis/evaluator-20260611T072149554533Z-45c6acae.mdProceedHighRun a one-shot area-write validation through challenge_exec and save analysis/area-write-offset0.json.
2026-06-11T07:23:55Zresearch recordanalysis/research/research-records.mdResearch tagged PARTIALMediumValidate against current evidence
2026-06-11T07:23:55Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T072355929660Z-20130a1b.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T07:24:19Zevaluatoranalysis/evaluator-20260611T072419425354Z-d39bd9bb.mdProceedHighRun solve.py mission through challenge_exec with output analysis/mission-manual-mode-transcript.txt.
2026-06-11T07:24:49Zflag captureloot/flag.txtHTB-format flag captured; raw value kept in loot onlyHighWrite solution and run completion gate
2026-06-11T07:26:23Zcompletion gatechallenge-state.jsonCompletion gate passed; state marked COMPLETEHighOptional sanitized memory summary approval

Key Findings

-

RAG / Advisory Memory

RAG output is advisory only. Record evaluated retrievals with:

bash
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.

Scenario

A trusted friend gives you full access to his water treatment plant for a security test. The Siemens PLCs use S7comm—can you break in and disrupt at least three pieces of equipment?

Operator Question

What prior HTB patterns and local challenge notes are most relevant to ICS Medium Flow Override S7comm Siemens PLC remote-only challenge requiring disrupting at least three pieces of equipment?

Memory Summary

Metadata

  • Platform: HackTheBox Challenges
  • Category: ICS
  • Challenge: Flow-Override
  • Difficulty: Medium
  • Source workspace: <local workspace>

Validated Solve Chain

Concepts only. Do not include raw flags, reusable credentials, tokens, cookies, private keys, or live secrets.

1.

Reusable Lessons

-

Dead Ends

-

Tool Quirks

-

Evidence Paths

-

Ingestion Decision

  • Proposed for LightRAG: yes/no
  • 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.

RankPathEvidenceMissing ProofCheapest ValidationConfidenceStatus
1initial triage from supplied challenge metadatachallenge name, category, difficulty, scenario, and remote target were provided by operatorinventory files / inspect app surface / map routes depending on categoryMediumActive

Closed Branches

BranchEvidence TestedFailure OutputReason ClosedRevisit Condition
sustained disruption without manual-mode controlanalysis/mission-transcript.txtanalysis/mission-transcript.txtSustained writes successfully faulted the heat exchanger via DB1 word 48, but automatic process logic kept or restored valve states and only one equipment status became faulty; no flag appeared.Find the manual_mode control bit or another stable control primitive, then rerun a bounded three-equipment disruption.
mapped-control mission without exact bit controlanalysis/mission-mapped-transcript.txtThe 120-second mapped mission sustained whole-byte writes against water, chlorine, mixer, and heat controls, but only heat exchanger became faulty. This branch is too coarse because whole-byte writes clobber adjacent packed controls while automatic logic remains active.Only revisit after exact bit mapping or a faster minimal write loop is available.
exact-bit DB1-only missionanalysis/mission-exact-bit-transcript.txtExact DB1 bit reassertion improved from one to two faults, but tank statuses remained healthy and no flag appeared. DB1-only control is insufficient as currently mapped.Only revisit if new area/manual-mode mapping shows why tank valves can be held or direct status thresholds can be crossed.

Memory Summary

approval_required: true

Sanitized Memory Summary

Metadata

  • Platform: HackTheBox Challenges
  • Category: ICS
  • Challenge: Flow-Override
  • Difficulty: Medium
  • Source workspace: <local workspace>

Validated Solve Chain

Concepts only. Do not include raw flags, reusable credentials, tokens, cookies, private keys, or live secrets.

1.

Reusable Lessons

-

Dead Ends

-

Tool Quirks

-

Evidence Paths

-

Ingestion Decision

  • Proposed for LightRAG: yes/no
  • Requires user approval before ingestion: yes

Notes

Notes

Scope

  • Challenge: Flow-Override
  • Category: ICS
  • Difficulty: Medium
  • Mode: remote
  • Remote instance: <TARGET>:30887,<TARGET>:31083
  • Start time: 2026-06-11T06:40:50Z
  • 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

FileSizeSHA256TypeNotes
0remote-only or no provided filesNo local artifacts found under files/

Evidence Ledger

TimeActionOutput/FileFindingConfidenceNext
2026-06-11T06:40:50Zharness initchallenge-state.jsonWorkspace initialized with deterministic state fileHighInventory artifacts
2026-06-11T06:40:50Zartifact inventoryanalysis/artifact-inventory.json0 artifact(s) inventoriedHighBuild or update hypotheses
2026-06-11T06:40:50Zsession bootstrapnotes.mdChallenge metadata, scenario, and prior context seeded into workspaceHighRecord initial hypothesis and research
2026-06-11T06:40:50Zhypothesis recordedhypothesis-board.mdinitial triage from supplied challenge metadataMediuminventory files / inspect app surface / map routes depending on category
2026-06-11T06:40:50Zresearch taskanalysis/research/task-20260611T064050897034Z-8b12fc57.mdResearch task created for advisory investigationMediumRecord research output
2026-06-11T06:41:06Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T064106838750Z-f71f5f3a.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T06:41:41ZRAG queryanalysis/rag/rag-query-20260611T064129115856Z-a7cc93f7.txtRAG helper exited 0; output savedMediumRecord retrieval tag and validation
2026-06-11T06:42:08ZRAG recordanalysis/rag-records.mdRetrieved memory tagged GENERICMediumValidate or reject with live evidence
2026-06-11T06: <REDACTED>, map any read-only equipment/state surface, then perform only the minimal bounded writes needed to disrupt at least three equipment items and retrieve the dashboard flag.HighStop after any alarm/reset-like signal, ambiguous write prompt, failed S7 negotiation, or two mutation attempts without a new fact; record failure and refresh hypotheses.
2026-06-11T06:42:28Zlocal memory recordanalysis/local-memory-records.mdPrior local notes reviewed as fallback/advisory contextMediumValidate against current evidence
2026-06-11T06:42:28Zevaluatoranalysis/evaluator-20260611T064228658144Z-04fbaa13.mdProceedHighUse challenge_exec for read-only nmap and banner/dashboard probes; save all transcripts under analysis/.
2026-06-11T06:45:10Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T064510837957Z-fc44d1c5.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T06:48:46Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T064846339899Z-ed974a5b.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T06:48:46Zevaluatoranalysis/evaluator-20260611T064846392332Z-8f07c07f.mdProceedHighRun solve.py write for DB1 byte 81=1 through challenge_exec; save transcript.
2026-06-11T06:51:25Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T065125574912Z-4916b1f7.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T06:51:25Zevaluatoranalysis/evaluator-20260611T065125631918Z-5ef35f2e.mdProceedHighRun controlled write/observe/restore tests through challenge_exec and save JSON transcripts.
2026-06-11T06:53:32Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T065332301615Z-1d5d72c1.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T06: <REDACTED>
2026-06-11T06: <REDACTED>, but automatic process logic kept or restored valve states and only one equipment status became faulty; no flag appeared.HighRerank hypotheses
2026-06-11T06:55:57Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T065557385958Z-2e88a21d.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T06:56:32Zevaluatoranalysis/evaluator-20260611T065632532106Z-5e22c00a.mdProceedHighRun solve.py map-bytes on likely DB1 control offsets and review deltas.
2026-06-11T07:00:03Zevaluatoranalysis/evaluator-20260611T070003534628Z-a47a14db.mdProceedHighRun 0xff candidate mapping and review manual_mode/control deltas.
2026-06-11T07:05:45Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T070545994970Z-d7577ae5.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T07: <REDACTED>
2026-06-11T07:10:46Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T071046044350Z-395abd8f.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T07:10:58Zevaluatoranalysis/evaluator-20260611T071058561588Z-b9f4089b.mdProceedHighRun solve.py map-bits through challenge_exec on offsets 0,1,30,50,61,62,90,91,112.
2026-06-11T07:10:58Zbranch closedhypothesis-board.mdThe 120-second mapped mission sustained whole-byte writes against water, chlorine, mixer, and heat controls, but only heat exchanger became faulty. This branch is too coarse because whole-byte writes clobber adjacent packed controls while automatic logic remains active.HighRerank hypotheses
2026-06-11T07: <REDACTED>
2026-06-11T07:17:20Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T071720016254Z-6630df7a.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T07:21:34Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T072134466265Z-69f6a2c2.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T07: <REDACTED>, but tank statuses remained healthy and no flag appeared. DB1-only control is insufficient as currently mapped.HighRerank hypotheses
2026-06-11T07:21:49Zevaluatoranalysis/evaluator-20260611T072149554533Z-45c6acae.mdProceedHighRun a one-shot area-write validation through challenge_exec and save analysis/area-write-offset0.json.
2026-06-11T07:23:55Zresearch recordanalysis/research/research-records.mdResearch tagged PARTIALMediumValidate against current evidence
2026-06-11T07:23:55Zcheckpoint recordedanalysis/checkpoint-analysis-20260611T072355929660Z-20130a1b.mdCheckpoint for ANALYSISHighUse checkpoint to drive next decision
2026-06-11T07:24:19Zevaluatoranalysis/evaluator-20260611T072419425354Z-d39bd9bb.mdProceedHighRun solve.py mission through challenge_exec with output analysis/mission-manual-mode-transcript.txt.
2026-06-11T07: <REDACTED>
2026-06-11T07:26:23Zcompletion gatechallenge-state.jsonCompletion gate passed; state marked COMPLETEHighOptional sanitized memory summary approval

Key Findings

-

RAG / Advisory Memory

RAG output is advisory only. Record evaluated retrievals with:

bash
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.

Scenario

A trusted friend gives you full access to his water treatment plant for a security test. The Siemens PLCs use S7comm—can you break in and disrupt at least three pieces of equipment?

Operator Question

What prior HTB patterns and local challenge notes are most relevant to ICS Medium Flow Override S7comm Siemens PLC remote-only challenge requiring disrupting at least three pieces of equipment?

Technical analogy

How to remember this solve

Think of the industrial system like a control-room checklist. You map the inputs, outputs, and assumptions, then find the one control path that accepts a state it should have rejected.

For Flow Override, 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.