Authored Articles

Field notes / AI pentesting / Entry 02

Dream-RSI: How I Wished My AI Security Agent Sweet Dreams

A week of being wrong on purpose, and the method that noticed before I did.

By Vincent Suen9 min read
Vincent Suen wearing a green hat in front of a bookshelf

Vincent Suen

A journey into AI pentesting.
Building the thing that tells me no.

From the research notebookReplay Score Refuse
GreenHat Field Notes: Dream-RSI, Trust the zero. An emerald glass replay tree meets an ivory refusal gate.

01The holy grail

An AI that gets better at getting better.

Recursive self-improvement is the holy grail of AI: a system that improves the process that improves it, so capability stops being something you ship and starts compounding. It also tends to get mentioned at least twice in any AI keynote before the coffee break.

But “improves itself” hides a boring question: improves from what? Right now the answer is mostly us. Humans read the transcripts, label the outputs, and write the evals. We are the bottleneck, and not in a philosophical sense. In a physical one. We need sleep and snacks, and we read slower than a scanner writes.

Security agents add a second problem: amnesia. When an agent fixes something mid-hunt (a broken session, a missing header, a route it could not see), that lesson usually dies with the context window, and the next run walks into the same wall with the same confidence. A goldfish with a terminal. ARGUS, our dynamic scanner, is built not to forget. Every run writes an append-only log, and every fix, dead end, and confirmed finding becomes a lesson learned the next run can use.

Dream-RSI is what happens when the system goes back through those logs on its own time. It replays them offline, looks for the lessons that would have changed the outcome, and proposes a better way to explore next time. To be clear about scope, this is a very small version of the idea: the system proposes, and a separate gate and a human decide what ships. We stop grading every step and start grading the lesson: is it real, is it valuable, should it ship? The machine does the reading. We do the judging.

Call it a flight simulator for scanners: every crash, none of the wreckage, and no permission slip needed to fly it again. ARGUS works during the day, dreams over its logs at night, and wakes up slightly less wrong. Sweet dreams, ARGUS. Please do not dream about production.

ARGUS is a team effort. Dream-RSI’s scoring rule, the recall veto, the void gate, and the Overseer are the parts I built, which is why every mistake below is mine.

02The hard part

The loop is easy. The grader is not.

A system that proposes changes to itself is a weekend project. The hard part is the grader, the thing that decides whether a change actually made the system better. It is usually written by a human, in a hurry, with an incomplete definition of “better.” Get it wrong and you do not get a system that fails. You get one that succeeds enthusiastically at the wrong thing and reports that it is doing great.

So Dream-RSI has three steps: replay, score, refuse. Most of the engineering goes into the third, because a dream you cannot wake up from is just a coma with a dashboard. A candidate is one proposed exploration policy built from those lessons, and every candidate goes through all three steps.

Dream-RSI in 40 seconds. A conceptual motion graphic based on this field note; original music, no voiceover. All key information appears on screen.
Read the video text

Can you trust the zero? Zero findings can mean “we found nothing” or “we could not look.”

Replay. Recorded ARGUS runs become offline search trees. No new production requests for replay.

Score. Match the budget. Protect confirmed findings. Recall is a veto.

Refuse. A faster policy that loses confirmed ground truth is rejected.

The blind spot. A known-vulnerable run with zero findings leaves nothing for recall to measure.

Void the world. The loader excludes the run and stops the pipeline with exit 2. Treat it as a detector regression.

One run. One route. After repairs, the CVE reproduced through the scanner’s transport in a local Docker lab. This is not a general coverage claim.

Build the thing that tells you no. Dream-RSI. Vincent Suen. GreenHat Field Notes, Entry 02.

Replay. Each recorded run becomes a world: every node is an action ARGUS could have taken, every branch an endpoint family. Worlds that cannot tell candidates apart get dropped rather than quietly averaged in, and every candidate gets the same step budget as the baseline. Otherwise the winner is just whoever left the meeting first.

Score. In plain English: never lose a bug the old version found. Only then do we reward efficiency. Recall is a veto, not a weighted term. Here is a real cycle:

policy             score   recall  steps  prune
recorded_order     0.7387  100.0%   2241  47.8%
attribution_aware  0.7262  100.0%   2192  46.9%

REFUSED on recall (1):
  stall_aware lost ground truth in world-02, world-03, world-04

That REFUSED line is the whole product. stall_aware pruned aggressively and scored beautifully, right up until the veto noticed which three worlds it had quietly stopped looking in. Across the weight sweep, the same check rejected 13 more candidates that all looked like wins. Thirteen confident, efficient, wrong answers.

Two design choices did most of the work:

  • No ground truth means recall reports None, never 1.0. A perfect score on an empty set is the most dangerous number in the file.
  • The one free parameter, the cost of a wasted step, is swept on every run. If a conclusion moves when that knob moves, it was never a conclusion.

Refuse. A winner is not a change. Admission control is a separate project I built, called the Overseer, with its own lockfile, its own test suite, and no shared code with the scanner. It runs ten named checks before anything ships. My favourite is no_abstention_arbitrage: a candidate may not win by simply answering fewer questions. (Every student has considered this strategy on an exam. The Overseer has too, and said no.) ARGUS emits the evidence, the Overseer adjudicates it, and neither imports the other. A search that grades its own homework is precisely what the gate exists to distrust.

03The loophole

The trap I built into my own veto.

In most reinforcement-learning horror stories the gaming is visible. A boat spins in circles farming power-ups instead of finishing the race, and you can watch it happen. In vulnerability research it is invisible: a scanner that games its score finds nothing, and finding nothing produces a clean report, which looks exactly like good news.

So I hunted for the loophole in my own veto, and found it. Miss the bug on a known-vulnerable build and you record zero confirmed findings. That means zero ground-truth nodes, so recall has nothing to measure and the veto cannot fire. Meanwhile the branch where the bug lives answered with a denial, so every step there bills as wasted effort. The optimizer notices it could skip those “inert” branches entirely, and congratulates itself on the savings.

The void-gate trap

A blind run teaches the optimizer to stop looking.

Why a failed positive control has to leave the corpus.

  1. 01
    Blind run

    Declared vulnerable. Recorded 0 findings.

  2. Void gate: drop the world here.

    The loader stops the pipeline with exit 2.

  3. 02
    No ground truth

    Recall has nothing left to measure.

  4. 03
    Veto cannot fire

    No confirmed finding is left to lose.

  5. 04
    The missed branch

    Answered a denial, so its steps bill as wasted effort.

  6. 05
    Pruning it scores better

    The optimizer learns to avoid exactly where the bug was.

Five steps, one guard that cannot fire. Steps 2–5 show what happens without the loader gate.

We had accidentally built an engine that was going blind on purpose, to save money.

Vincent Suen

(Frugal, I’ll give it that.)

The dream had quietly turned into a nap. Worse, the guard never failed. It was bypassed, and a bypassed guard does not show up in your output. An optimizer handed this data is not malfunctioning when it learns to look away. It is doing exactly what I asked.

The fix was not a tweak to the objective, because there is no exchange rate at which “the engine could not see here” becomes partial evidence about routing quality. It was a gate at the loader that crashes the pipeline. Every run now declares what it was fired at: known_vulnerable, known_fixed (patched, so a zero is the expected answer), or unset, which is not the same thing as “probably fine.” A known-vulnerable run that records nothing is voided, with a banner above every ranking and exit code 2. A warning scrolls past. A crash demands attention.

04The control

The alarm fires. On my own machine.

I broke an open-source plugin by hand in a local Docker lab, escalating a low-privilege account to administrator and confirming it in the database rather than trusting the HTTP response. Then I reset the account and pointed ARGUS at it. If ARGUS missed it, ARGUS was wrong. Nothing to interpret, nowhere to hide.

It missed it. (Argus, in Greek myth, had a hundred eyes. Ours was looking at none of the right ones.) Worse, the archive told the same story:

Runs that ever sent the required anti-forgery header
0 of 225
Authorization cases with no live source principal
301 of 306
Denials that were ever attributed
0 of 32

Every “the boundary held” had really meant “nobody asked.” So the alarm fired, on a real run, against a real CVE:

DETECTOR ALARM: 1 world(s) voided
  -- a declared baseline was not met

control-01 [known_vulnerable] produced_no_finding
  expected: self role-write privilege escalation, primary route

EXCLUDED from the corpus.
Treat this as a detector regression,
not as a world with bad numbers.

I had built the thing that tells me no, and the first word out of its mouth was about me.

05The repairs

Four blind spots, one honest test.

Each alarm pointed at the next gap. I would bet most teams have at least two of these right now. Each one is now a lesson ARGUS keeps instead of forgetting, and each one was graded by a human before it counted.

  1. The session logged in but never proved who it was. All three test users authenticated perfectly, but nothing handed the engine a “who am I” endpoint, so every authorization test sat politely waiting for a sentence that said “I am user 7.” Logging in and having an identity are two separate events.
  2. The source stage could not see the route. It matches registrations by literal string, and this plugin builds its routes from an inherited property. Zero routes out of 925 files. The bug was living in a word the tool did not know.
  3. My own safety rail hid the bug class. A privilege escalation by writing is a write, and a guard I added months earlier to stop the scanner from doing damage rejected every write. Safety rails and blind spots are the same object seen from opposite ends.
  4. The token never reached the probe. Four transports can issue a request. Three attached the anti-forgery header. I fixed the wrong one first, re-ran, and got identical 401s, which is how I learned there were four. Coverage is a minimum, not an average.

Then came the liar. I wrote a unit test asserting the token was attached. Green. Out of habit, I deleted the fix to watch the test fail. It passed again. The function built its headers twice, once in JavaScript to send and once in Python to report, and my test was reading the Python copy while the JavaScript sent nothing. My test was not testing the code. It was testing the code’s diary.

Once the plumbing was real, the 401s turned into 200s:

PUT /<redacted>/<user>/7  {"roles":["administrator"]}
  -> 200, body echoes "roles":["administrator"]

The CVE reproduced through the scanner’s own transport. One run, one route, which is the entire claim. I reset the lab account about nine seconds later, because I have seen how these stories end.

06What stays with me

Can you trust your zeros?

No bounty, no triager applause. The win was our own tooling proving our own blind spot, loudly, in a way I could not negotiate with.

A zero is not a result until the run says what kind of run it was. “We looked and found nothing” and “we could not look” produce the identical report. I had 225 runs where I could no longer tell, and I had read every one the flattering way.

Protect by veto, not by weight. The moment something has a weight, it has a price, and an optimizer’s whole job is finding prices.

Delete the fix and watch the test fail. Every time. A test I have not seen fail is a rumour.

Let the machine read, and let humans judge. The bottleneck in self-improvement is not how fast the AI can learn. It is how fast we can tell whether what it learned is true.

I still cannot tell you whether the labs will achieve recursive self-improvement. I can tell you that my very small one, handed a scoring function I was proud of, quietly learned to look away from the bug, and that I only know because I built something whose entire job was to tell me so. It crashed the pipeline to do it.

As security tooling gets more autonomous, the question shifts from “can it find bugs?” to “can you trust its zeros?” Dream-RSI is how we make sure our AI is actually dreaming of vulnerabilities, rather than sleeping on the job.

Vincent Suen

Written by Vincent Suen

Field notes on AI-assisted pentesting · Entry 02

About the author. Vincent Suen is a security research intern at GreenHat Security, working on AI-assisted pentesting. On Dream-RSI, he built the scoring rule, the recall veto, the void gate, and the Overseer, the admission gate that decides what the system is allowed to learn.