Demo library › Chapter 16
Close the front door on an Internet-facing appliance
An AI-driven attack on a legacy remote-access gateway on the Internet. The WAF closes every variant of the flaw, the attacker finds the next one, and Access gates the whole product behind identity - with the WAF still inspecting behind it.
Transforming Enterprise Security: Defend against AI-enabled threats, Modernize remote access
The problem
Horizon Inc still runs Horizon Connect, an on-premises remote-access gateway in front of their VPN hardware, and its sign-in page is on the Internet for anyone to find. Since June 2026, gateways like it - NetScaler, Ivanti, Check Point - have been taken over without a password, often before a patch existed, and AI agents now find and exploit them with ease. Every Internet-facing employee system is an unbounded attack surface. More information is in the solution brief, The Identity-Gated Edge.
Lands with: CISOs, heads of infrastructure and security architects
Before and after
What this looks like at a typical customer before Cloudflare, and after. Click either to enlarge.
Before
After
Before you start
- Lab only. Horizon Connect runs on the lab VM.
- Open two windows on your VM:
- The attacker console (sign in as
), and Horizon Connect's origin console athttps://connect.corp.internal, with the Cloudflare One client on. - A private window open at
. - Cloudflare dashboard
- Open the Cloudflare dashboard on your local machine.
- Ensure the demo is at its start: the emergency WAF rule off, and no Access application for
. To revert to this state, on the lab VM:cd /opt/cloudflare/horizon-inc && sudo -E node scripts/wire-edge.mjs --reset, then Reset the demo on the origin console. - A private browser window for Alice's sign-in at the end.
Run it
An appliance anyone can reach
| Do | Say |
|---|---|
In a private window, open . | Horizon Connect, the company's remote-access gateway. Its sign-in page is on the Internet, like every VPN portal's, so every scanner on the Internet can find it. |
| In the attacker console, Run the attack. | This is a scripted stand-in for an agentic framework like ARTEX. It finds the gateway, asks its version, matches a pre-authentication flaw and sends the exploit. No password. Red means the request reached Horizon Inc's server. |
| Point at Compromised, then at the origin console. | Remote code execution as root, then the session table. The origin console shows every one of those requests arriving, anonymous, from the Internet. The exploit is simulated - nothing ran - but the path it took is real. |
Whybackground, if you are asked
This is the 2026 pattern: pre-authentication flaws in Internet-facing appliances, exploited before a patch exists. Researchers used AI to find Java4Shell and build a working exploit in three hours. The appliance's own sign-in page is the attack surface, so nothing behind it helps.
The WAF: a virtual patch in seconds
| Do | Say |
|---|---|
| In the Cloudflare dashboard, open the zone → Security → Security rules → Emergency: CVE-2026-114938 (Java4Shell) on Horizon Connect, and open its expression. | This is the emergency rule a security team writes the day the CVE lands. The flaw is in how the gateway decodes its Base64 session token before anyone signs in, and what it decodes it then deserializes. The rule describes exactly that: |
| Read it out, one line at a time. | This application only. Only the gateway's /vpn/ endpoints, where the token is decoded before sign-in. The two places that decoder reads a token from: the hc_session cookie and the token parameter. And rO0AB: the Base64 of AC ED 00 05, the first bytes of a Java serialized object, which no real session token ever starts with. |
| Switch the rule on, and Run the attack again. | Amber: the exploit in the cookie is blocked at Cloudflare's edge, with a Ray ID. The agent moves it to the query string - amber again, because the rule covers every input the decoder reads. Then it hides a newline inside the signature, and the gateway's decoder strips it back out. Live across Cloudflare's network in seconds, with no change to the appliance - and the agent has already found a way around it. |
Whybackground, if you are asked
A virtual patch is the fastest defense there is: written and deployed globally in the time it takes to read the advisory, protecting the appliance before the vendor ships a fix. This one matches the payload, so an agent that rewrites its payload on every attempt finds the variant it does not cover. The WAF has better tools than one signature, and the next step uses them.
The WAF, hardened
| Do | Say |
|---|---|
| In the same list, switch on Hardening: Horizon Connect session tokens are Base64 and nothing else and Hardening: likely code execution against Horizon Connect (WAF attack score). Then, under the zone's managed rules, Hardening: Cloudflare Managed Ruleset on Horizon Connect. | Three more ways the WAF defends. The first matches the flaw itself rather than any one payload: a session token is Base64 and nothing else, so a token with any other character in it - a newline, whatever it hides - is blocked. The second is machine learning: WAF attack score rates every request for code execution, including variants nobody has written a rule for. The third is Cloudflare's own managed rules, maintained by Cloudflare's security team and updated as exploits appear across a fifth of the web. |
| Run the attack again. | Every variant of Java4Shell is amber now - the cookie, the query string and the hidden newline. The WAF won this round. So the agent moves on: the gateway has a second flaw, one nobody has published yet. Its support diagnostics trust a header instead of a session. The request is perfectly ordinary - nothing for a signature, a validation rule or an attack score to find - and it is in. |
Whybackground, if you are asked
This is the cat and mouse. The WAF is very good at it: signatures on the day, positive security for the class of flaw, machine learning for the variants, managed rules kept current by Cloudflare. Every one of those closed a door here. But each new flaw in an Internet-facing appliance is a new race, and the first anyone hears of some of them is the exploit. The answer to that is not a better rule.
Gate the whole product with identity
| Do | Say |
|---|---|
Zero Trust → Access controls → Applications → Add an application → Self-hosted. Name it Horizon Connect, add the public hostname , and select the existing policies All Employees and Nightly export job (service token). Save. | A couple of minutes, no change to the appliance and no new hardware. This is the step one of the world's largest banks took for its NetScaler gateways. |
| Run the attack again. | Everything the WAF had not stopped is green: the probes, and the new flaw too. Every one of them stops at Cloudflare and is asked to sign in. The origin console shows nothing new: anonymous traffic no longer reaches Horizon Inc's network, whatever flaw it is aimed at - including the ones nobody has found yet. |
| Point at the exploit attempts that are still amber. | The WAF is still working. It inspects first, then Access checks identity, so the exploits are stopped before Access is even asked. The two are layers, not alternatives. |
In the private window, reload and sign in as . | Alice signs in through FlareID and lands on the gateway, which greets her by name. Nothing changed for her. |
Whybackground, if you are asked
Access gates the entire exposed product, every flaw in it at once, behind a verified identity. An attacker no longer needs a payload the WAF misses; they need a Horizon Inc identity that passes sign-in, MFA and a device check - far harder to get than an exploit for an appliance's login page. The attack surface shrinks from the whole Internet to Horizon Inc's own workforce.
Defense in depth: a stolen credential
| Do | Say |
|---|---|
| In the attacker console, Attack with a stolen service token. | Suppose the agent finds the nightly job's service token in a leaked config file. Access lets it through - it is a valid credential. Then it sends every Java4Shell variant, and every one is amber: the WAF inspects signed-in traffic exactly as it inspects anonymous traffic. |
Whybackground, if you are asked
Identity narrows who can reach the application; the WAF keeps checking what they send. A compromised account, a stolen token or an insider gets past the gate and still meets the WAF. And everything that token did is in the Access log under its name: revoke it, and it is gone.
Lock the origin, and let machines in too
| Do | Say |
|---|---|
| On the origin console, turn on Accept only requests signed by Access. | Horizon Connect now refuses anything Access did not sign. It has no inbound port either: it is reached only through the tunnel, which dials out. |
| In the attacker console, Run the nightly export job. | The nightly job presents its service token and gets its export. The same call without the token is stopped at Cloudflare. |
Whybackground, if you are asked
This is the brief's third step. Once the apps are behind Access, make them accept only Cloudflare's traffic - through Tunnel or dedicated egress IPs - and check the token themselves. Service tokens put scripts and jobs through the same checks as people.
One audit trail
| Do | Say |
|---|---|
| In the zone, Security → Events: the blocked requests, found by the Ray IDs in the attacker console. Then Zero Trust → Insights → Logs → Access: the sign-ins for Horizon Connect, and the stolen token's requests under its name. | Each WAF block names the layer that made it - the emergency rule, the Base64 rule, attack score or a managed rule - and each Access decision names the person or token. Every request was identified at Cloudflare before it reached the network. In production both logs stream to the SIEM, where the Ray ID ties them together. |
What the audience should see
- The first attack ends Compromised, with each request arriving in the origin console.
- With the emergency rule on: the cookie and query-string exploits amber, the newline variant red.
- With the WAF hardened: every Java4Shell variant amber, then the new flaw red.
- With Access on: every request green or amber, and nothing new in the origin console.
- With the stolen token: through Access, and every exploit still amber.
- Alice signs in and the gateway greets her by name.
- The nightly job gets its export with the token, and is stopped without it.
Where the evidence is
The zone's Security → Events for the WAF blocks, Zero Trust Insights → Logs for Access, and the origin console for what reached the server. The attacker console shows the Ray ID of every request, so each one can be found in either.
Known limitations
- The flaw is simulated. Horizon Connect recognises the exploit's marker and answers with canned output; nothing a request sends is ever run.
- A real appliance has an inbound port. The lab VM cannot offer one, so the tunnel publishes Horizon Connect to the Internet to play the exposed appliance.
- The attacker runs in a Worker on workers.dev, so Security Events shows its requests coming from Cloudflare's own network. It has to: a Worker on the lab's own zone would skip the zone's WAF.
- The hardening layers use Enterprise features: regular expressions in custom rules, WAF attack score and the Cloudflare Managed Ruleset. On a lower plan only the emergency rule deploys, and
wire-edge.mjssays which layers it could not create. - Whether WAF attack score and the managed rules also flag the simulated payloads depends on their models and signatures; the Base64 rule blocks every variant on its own.
- The second flaw is simulated too: the diagnostics endpoint returns the same canned session table.
- Logpush to a SIEM, Load Balancing and dedicated egress IPs are named here, not shown.
Part of: Replace the VPN · The full tour