DEV Community

WormHole
WormHole

Posted on

Exploit Generation: Why AI-Written PoCs Fail on Real Targets

An AI can write a plausible exploit in seconds. A working one is rare. Syntax and model quality tend to get blamed for that gap, and both are usually the wrong explanation. What separates the two is state. A generated PoC describes a request that would succeed against the system the model imagined. Your target answers with different object IDs, different parameter names, a stricter parser, and a business state that nobody has created yet. Exploit generation only becomes useful once its output is read as a hypothesis.

What a generated PoC actually encodes

Ask a model for an exploit and you get the shape of one: a method, a path, a payload, a header, sometimes a curl command. That shape is assembled from things it has read — disclosed write-ups, framework conventions, payload collections. It is a competent summary of how exploitation looks in public.

What it does not encode is everything that makes an exploit fire on a specific deployment:

  • The session that holds the rights. The payload usually assumes an authenticated caller, a role, a tenant. None of these are in the text.
  • The current object graph. Real IDs are not 123. They are UUIDs or opaque tokens that exist only in the response the model never saw.
  • The sequence that produced the vulnerable state. An approval pending, a quota half-consumed, an invite unaccepted. The flaw lives in that state, and the state does not exist until something creates it.
  • The parser downstream. What arrives is not what the application reads. Proxies decode, frameworks coerce types, ORMs re-serialize, WAFs normalize.

A model that has never observed your system can still write a request that would exploit it — if the system happened to match its assumptions. Output looks equally confident either way, and nothing in the text marks which case you are in.

Five ways a correct-looking PoC returns 200 and changes nothing

The failure modes are consistent enough to check in order.

1. Parameter drift. The model writes user_id; the API reads uid. Or it sends JSON where the endpoint expects form encoding, camelCase where the schema is snake_case. Most frameworks ignore unknown fields without complaint. You get 200, a cheerful body, and a record that never changed. Nothing in that response says whether the write landed.

2. Normalization. A payload built for a lenient parser meets a stack that decodes once more, casts to integer, or re-serializes through a typed model. The injection never reaches an interpreter as a string. The request is well-formed, the response is 200, the flaw is untouched.

3. Session and object drift. The token, the ID, the tenant header came from a different session or a different object. Two outcomes, and neither one is informative: the call is rejected as unauthorized and looks like a hardening success, or it succeeds against a harmless object and looks like a confirmation.

4. Missing precondition. The exploit needs an approval in a particular state, a role granted by a second person, a subscription at a specific tier. Without that state the endpoint behaves correctly. This is the failure mode that most often gets misread as "the vulnerability was patched."

5. Status versus state. A replayed step returns 200 because the endpoint is idempotent in appearance only — the response is cached, the transition already happened, or the write was swallowed by a conditional update. The status code reports the protocol succeeded. It says nothing about whether the system moved.

All five produce the same external signal, a successful HTTP response. Which is why "it returned 200" proves nothing, and a PoC that reports only status codes cannot tell a working exploit from a polite refusal.

Why asking the model to try again doesn't close the gap

The obvious correction is to paste the error back and ask for a fix. That does resolve syntax. It does nothing for state.

A model can adjust a header name after being told the expected one. It cannot learn an object graph it has never seen, cannot infer that an approval is pending, and cannot discover that a role is missing unless something tells it. Each retry improves the text's fit to the error message and leaves its fit to the system unchanged.

Worse, the loop needs an oracle to converge. If the only signal returned to the model is "200", the loop learns that 200 means success — which is exactly the assumption that produced the false positive. Teams that ship reproducible findings treat the PoC as a test rather than a text: it runs inside the session that holds the state, asserts on the object it touched, and stays runnable after the fix. That difference, demo versus regression test, is the part that has to be engineered, and it does not come out of a prompt. WormHole exists to run that loop against a live system instead of against a description of one.

Each finding comes back with the route it took and what actually changed in the system

Each finding comes back with the route it took and what actually changed in the system — not a severity number.

What a claim needs before it counts as a finding

Claim What it rests on Survives review
"This endpoint is vulnerable" A pattern match against a published CVE or a known payload family No. A CVE describes a version, not your deployment. It cannot tell you whether the check is present here
"The payload was accepted" HTTP 200 and a response body No. A 200 with unchanged state is the normal case for a rejected-but-valid request
"Privilege escalation is possible" An object read performed with the low-privilege session after the request, showing data that session should not reach Yes. It is a state diff with an actor and an object attached, and it can be re-run

The first two are claims about models and protocols. Only the third is a claim about this system, and only that one survives a reviewer who asks to see it again.

Impact is a separate question from existence, for the same reason. A weak endpoint, an over-permissioned service account and a missing check are each unremarkable. Connected, they form the route an attacker would actually take, and the thing worth reporting is what that route reaches — a dataset, an admin surface, a service boundary — not the severity score of any single hop.

The scope before a run: what the tool is allowed to touch

The scope before a run: what the tool is allowed to touch, and the services behind each entry.

Where exploit generation fits: workflow, services, code

If the failure is state, the fix has to hold state across three views, because a complex system hides different problems at different layers.

Workflow. Multi-step processes with approvals and retries are where generated PoCs die most often, and where the real flaws live: a revoked step that can still be replayed, a retry that advances the state twice, an approval that can be granted to its own requester.

Services. A finding becomes an attack path when the pieces connect across a boundary — the weak API that trusts a service account that is over-permissioned. Single-hop testing never sees this, because each hop is individually correct.

Code. Runtime proof answers "can it be exploited." The repository answers "why does it exist, and where" — the missing authorization check, the unsafe data flow, the secret committed three releases ago. Linked together, a runtime finding lands on a file, a line and a route.

The output that matters has four parts, and each is a question a reviewer will ask: what did we not think to test, how far does the path reach, where is it in the code, and can we reproduce it. WormHole runs the same AI across the workflow, the service boundary and the code, so each view ends with a finding, its impact and the proof.

FAQ

Why does an AI-written PoC fail when the vulnerability is real?

Because the PoC was written against an assumed system and executed against an actual one. Permission checks, object identifiers, required prior state and input normalization all differ, and each difference turns a correct-looking request into a 200 with no effect. The vulnerability can be present and the demonstration still fail.

Can I fix a broken PoC by pasting the error back into the model?

Partly. That loop resolves naming, encoding and header mismatches quickly. It cannot supply state the model has never observed — an approval in progress, a role granted elsewhere, an object that only exists after a prior call. Those require the test to run inside the live session, not a better prompt.

What has to be in a PoC for it to count as reproducible?

Three things: the exact request as sent, the state-dependent objects it touched (with identifiers resolved from the live response, not from the write-up), and an assertion on the resulting state change rather than on the status code. If a reviewer cannot re-run it after the fix and see the assertion flip, it is a description, not a proof.


WormHole is an AI vulnerability discovery and penetration testing tool from HACKBOX.AI, built for complex business systems. Test only systems you own or have written authorization to assess. This article describes a testing methodology, not a guarantee of coverage.

Top comments (0)