Day 7 of 760 minCipher CadetHands-on lab
Day 7: Capstone: Your Complete Recon Pipeline
Taught by Mr Elite Updated
By the end of today you can
- Run one script that collects and cleans data into a timestamped folder
- Build a fenced AI prompt from your findings and check the summary against raw evidence
- Re-run the pipeline and compare two runs with diff
- Write a one-page scoped report with evidence and verification notes
Warm-up
Answer from memory first, then tap to check. Recalling yesterday is what makes it stick.
Why can an AI not reliably tell your instructions from instructions hidden in collected data?
It reads everything as one stream of text, so wording inside the data can look like an order.
What two things do you ask the AI to give behind every claim, so you can verify it with grep?
An exact quote and the field name it came from.
For six days you have built separate pieces. A scope note, a curl command, a cleaning script, a prompt, a fence around hostile text. Each works on its own, but a pile of parts is not yet a method. If a colleague asked you to do it again next month and compare, you would be digging through old folders and guessing which command came first.
Today we join the parts into one run. One command collects, cleans and prepares the AI step, and a second check proves the summary against the raw evidence. Then you write a one-page report someone else could read and trust. Everything runs against your own local target or the SecurityElites lab, never anything else.
The five stages, in one picture
Let me put the whole course on the whiteboard. Every stage you built feeds the next, and each leaves a file behind as evidence. If a stage has no file, you cannot prove what it did.
- Scope
- The written note saying which target you may look at and what you will not touch. Day 1.
- Collection
- Gathering raw headers and page content with curl or Python. Output: headers.txt and page.html.
- Cleaning
- Turning messy raw output into findings.json or a CSV. Output: structured data.
- AI summary
- Asking an assistant to sort and summarise the fenced data. Output: summary.md.
- Verification
- Checking every claim in the summary against the raw files yourself. Output: your notes.
The order matters. Scope comes first because it decides whether anything else is allowed. Verification comes last because the AI is a helper that can be wrong, and you are the one who signs the report.
Quick check
Which stage produces the file you use to prove an AI claim is true or false?
Raw evidence is the ground truth. The summary and even the cleaned data are derived from it and can contain mistakes.
Watch me do it: joining the scripts into run.sh
I will build the chain on a local target. If you have Docker, a throwaway web server on port 8080 is ideal. If not, use the local target you used on Day 3. Do not point this at any site you do not own or have permission to test.
docker run --rm -d --name target -p 8080:80 nginx#!/usr/bin/env bash
set -e
TARGET=${1:-http://localhost:8080}
OUT=runs/$(date +%Y%m%d-%H%M%S)
mkdir -p "$OUT"
cp SCOPE.txt "$OUT/"
curl -s -D "$OUT/headers.txt" -o "$OUT/page.html" "$TARGET"
python3 clean.py "$OUT/headers.txt" "$OUT/page.html" "$OUT/findings.json"
{ cat prompt_v2.txt; echo '<data>'; cat "$OUT/findings.json"; echo '</data>'; } > "$OUT/prompt_full.txt"
echo "Done: $OUT"Notice what the script does not do. It does not send anything to the AI by itself. With a free chat account, you paste the contents of prompt_full.txt into the assistant yourself and save its reply as summary.md in the same run folder. That keeps a human between the data and any action, which is what Day 6 taught.
Verify the summary against the raw evidence
Now paste prompt_full.txt into your AI chat and save the reply as summary.md. Your Day 6 prompt asked for a quote and field name behind every claim. We use those to check each one.
grep -n -F 'Server: nginx' runs/20250101-120000/headers.txtQuick check
grep finds nothing for a quote the AI gave you. What is the right action?
An unverifiable claim does not belong in a report. Asking the AI to vouch for itself is not evidence.
Re-run and compare
A pipeline earns its keep when you run it twice. Change something small on your own target, such as editing the nginx page or adding a header in a config, then run ./run.sh again. You now have two timestamped folders.
ls runs/
diff runs/20250101-120000/findings.json runs/20250101-130000/findings.jsonLines starting with < come from the first file and lines starting with > from the second. That is your change record. If you changed nothing and still see differences, something in your data varies on its own, such as a Date header. Note it, because the report should say which differences are noise.
Lab: see the danger you are defending against
Your pipeline is only as safe as the way it treats data. The lab below lets you watch the failure you fenced against on Day 6, from the attacker's side, in a safe place built for it. Open the lab from your SecurityElites account before the practice steps in the mission.
Writing the one-page report
A report is a short, honest account that someone else can follow. Use plain headings in a file called REPORT.md. Aim for one page.
# Recon report: local nginx test target
## Scope
(paste SCOPE.txt: target, allowed actions, date)
## Method
run.sh, run folder name, tools used
## Findings
1. Claim, evidence file and line, CONFIRMED or NOT FOUND
## AI use
Model used, prompt file, what I changed or rejected
## Changes between runs
(diff summary, noise vs real)
## Limits
What this did not checkWhat to learn next
You now have a method, and the next skills plug into it. Scanning comes first: tools like nmap find open ports and services, and the output fits straight into your collect and clean stages. Learn it on your own machine or labs only.
After that comes web testing: how applications handle input, logins and sessions, and why flaws such as injection and broken access control happen. Your Day 2 habit of reading a site from outside is the foundation. Finally, AI agent security: agents that call tools and read documents widen the attack surface you met on Day 6. Study how they are hijacked so you can design them safely.
Your turn
AI Agent Hijacking
TaskBot is a tool-using agent that processes documents, and in this guided lab the steps are written beside it. It shows what happens when the text an AI reads is allowed to act like instructions. That is the weakness your fenced prompt and human review were built to reduce, so seeing it work against an unprotected agent makes the defence concrete.
What to try
What to notice
- The user only asked for a summary, yet something else happened
- The instruction arrived through the document, not through the person typing
- The agent had tools, so the result was an action and not just words
- Where a human check could have stopped it
If it did not work
Running the pipeline against a target you have not scoped
Write SCOPE.txt first and run only against localhost or the named lab. If the target is not in your scope note, do not run it.
Putting claims in the report because the AI sounded confident
Every claim needs a grep hit in raw evidence. Mark the rest NOT FOUND and leave them out.
Overwriting old results on each run
Keep the timestamped folder per run. Without it you cannot compare runs or prove what you saw.
Pasting data into the AI without the fence
Check prompt_full.txt contains the data tags and your instruction that data is material, never orders.
Comparing runs and treating every diff line as a real change
Check for values that change on their own, such as Date headers, and label them as noise.
Recap
- A pipeline is scope, collection, cleaning, AI summary and verification, each leaving a file behind
- One script with a timestamped folder per run makes your work repeatable and provable
- The human sits between the AI output and any action, always
- Verify every claim with grep against raw evidence before it enters a report
- Re-running and using diff shows what changed and what is noise
- Next steps are scanning, web testing and AI agent security, all on systems you own or have permission to test
Cheat sheet
chmod +x run.sh- Makes the script executable so ./run.sh works
set -e- Stops a bash script at the first failing command
curl -s -D headers.txt -o page.html URL- Quietly saves response headers and body to separate files
grep -n -F 'text' file- Finds an exact string in a file and shows the line number
diff runA runB- Shows lines that differ between two files
<data> ... </data>- Fence marking collected text as material, not instructions
REPORT.md- Scope, method, findings with evidence, AI use, changes, limits
Before the next day
Mission: Run it, check it, report it
Run your complete pipeline twice against your local target or work through the lab, then produce a one-page report with evidence. This proves the whole chain works and that you can defend every line you wrote.
About 40 min
You are done when: A capstone folder containing SCOPE.txt, run.sh, two run folders, summary.md, verify.txt, changes.txt and a one-page REPORT.md.
Want more? Rewrite run.sh as run.py with the same stages, then add a step that automatically greps each quoted claim and prints CONFIRMED or NOT FOUND.
Quiz
4 questions. Your score is saved with your progress.
1. Why does run.sh create a new timestamped folder for every run?
Separate folders preserve each run as evidence, which makes comparison with diff and later checking possible.
2. The AI summary says the server is running an old version, but grep finds that text nowhere in headers.txt or page.html. What do you do?
A claim without evidence in the raw data is unverified, and repeating it does not change that.
3. What does the lab show you that connects to your pipeline?
It demonstrates indirect injection through data, the risk your fenced prompt and human review reduce.
4. Two runs on an unchanged target show differences in diff. What is the most sensible first step?
Some values change on every request. Identify noise before reporting a real change.
Finish the day
Mark the day complete to save your progress.
What next: There is no Day 8 lesson, so your next step is your own practice. Pick one area from today's list, scanning with nmap on your own machine, web testing in a SecurityElites lab, or AI agent security, and feed what you learn into the same pipeline.
Your notes
Private to this device. Write what you want to remember from today.