Blog / 1 November 2026

Field notes · 1 November 2026 · 4 min read

ChatGPT HTML Sandbox Bypass and API Key Theft: Hardening Your AI Agents

A single malformed HTML preview in ChatGPT opened a path for attackers to hijack accounts and steal API keys from a cloud host—showing how fragile current AI sandboxes really are.

AI agent securityAI sandboxsecure AI agentsMCP securityzero trust for AI agents

01When an HTML preview became a backdoor

Parameter Labs discovered an exploit in ChatGPT’s HTML preview feature, formerly called Canvas. The feature renders interactive custom HTML inside a sandboxed iframe, but the sandbox allowed the page to reach out to OpenAI’s own APIs. By crafting a clever chain of script calls, the researchers were able to make the preview retrieve a user’s private data and even issue API calls on their behalf.

The attack hinges on a classic prompt‑injection style trick: the HTML payload injects code that runs inside the agent’s execution environment, crossing the boundary that was supposed to protect the host. Once the payload escaped the iframe, it could read authentication cookies and invoke the ChatGPT backend, effectively taking over the account.

  • The iframe was sandboxed, but the sandbox rules allowed network requests to the same origin.
  • By chaining JavaScript events, the payload triggered OpenAI API calls without user interaction.
  • The result was full control of the victim’s ChatGPT session and any linked API credentials.

02The Northflank breach shows credential leakage in the wild

A separate incident at the cloud hosting platform Northflank demonstrated how quickly stolen API keys can be abused. Attackers who gained access to the platform’s internals harvested customers’ AI API keys and used them to run costly inference jobs. Northflank warned all users to rotate secrets immediately.

The breach did not involve a vulnerability in the AI models themselves; it was a classic supply‑chain exposure where the hosting environment stored secrets alongside user code. Once the attackers entered the host, the keys were plain‑text and could be used without any additional authentication.

  • Keys were stored on the host, not inside isolated containers.
  • Attackers could issue requests to OpenAI, Anthropic, and other services as if they were the legitimate customer.
  • The incident generated unexpected usage spikes and bill shocks for many teams.
Threat radar · 7 days to 2026-11-0185 stories across 4 security feeds, by topic
AI & agents38Vulnerabilities32Breaches & leaks14Phishing & identity11Malware & ransomware8Supply chain2Prompt injection0

A story can count under more than one topic. Counted from the feeds, not estimated: BleepingComputer, Schneier on Security, Simon Willison, The Hacker News.

03Why the combination is a wake‑up call for any agent that runs code or calls tools

Both stories highlight a single failure mode: an AI‑driven workflow that trusts its execution environment implicitly. When an agent can render untrusted HTML or access raw credentials, the attacker’s path from “just a prompt” to “full account takeover” becomes only a few lines of code.

For teams that let agents fetch data, invoke CLI tools, or call external APIs, the risk is not just a theoretical prompt‑injection. It is a concrete chain that can exfiltrate secrets, generate wasteful API traffic, and even leave persistent backdoors in downstream services.

  • Untrusted content (HTML, markdown, shell output) must never be executed with the same privileges as trusted code.
  • Credentials should never be visible inside the same runtime that processes user prompts.
  • Network access should be limited to a whitelist of known endpoints.

04Practical steps to isolate agents today

Start by moving every AI‑driven task into a sealed micro‑VM that offers a true kernel boundary. The sandbox should expose only a single workspace folder and nothing else on the host.

Configure an egress broker that injects real API keys only when traffic leaves the sandbox. Inside the sandbox the agent sees a placeholder value, making credential leakage impossible even if the agent’s code is compromised.

Before any operation that could affect external resources—such as uploading files, sending emails, or invoking a cloud API—take a checkpoint. If the result looks suspicious, you can rewind to the saved state in under a second.

  • Use a two‑person approval rule for any action that writes outside the workspace.
  • Limit network egress to an allow‑list (e.g., only api.anthropic.com or api.openai.com).
  • Keep an immutable, hash‑chained audit log of every agent and human action.

05How kosa8 fits into this defence stack

kosa8 delivers sealed microVMs that give each agent its own kernel, a single workspace folder, and an allow‑list‑driven network. API keys never enter the sandbox; an egress broker injects them only on outbound requests. Checkpoints and rewinds are fast enough to experiment safely, and the built‑in audit log provides tamper‑evident provenance for every step.

The paceSecurity stories per day, last 7 days
4Mon9Tue20Wed18Thu22Fri11Sat0Sun

Takeaways

  1. Run every AI agent in a sealed microVM, not a shared container.
  2. Store API keys on the host and inject them only at egress.
  3. Whitelist network destinations and block everything else.
  4. Checkpoint before risky operations and use a two‑person rule for external side effects.
  5. Maintain a hash‑chained audit log to detect unauthorized changes.

Where kosa8 fits

kosa8 provides secure infrastructure for AI agents by giving each agent a sealed microVM with its own kernel, exposing only a single workspace folder. Network access is restricted to an allow‑list you define, and API keys stay on the host, injected only via an egress broker so the sandbox contains placeholders. Fast checkpoints and rewinds let you experiment safely, while a tamper‑evident audit log records every action.

Check yourself · +100 XP

What is the primary purpose of keeping API keys on the host and using an egress broker?

Questions people ask

Can I still use my existing CI pipelines with a sealed microVM?

Yes. kosa8’s Docker‑compatible API lets you point DOCKER_HOST at a sealed microVM, so standard CI tools can run inside the isolated environment without changes to your pipelines.

What happens if an agent tries to reach an endpoint that is not on the allow‑list?

The network layer refuses the connection, and the egress broker logs the attempt. This prevents accidental or malicious calls to unknown services.

Sources

  1. How We Took Over ChatGPT Accounts — Simon Willison
  2. Northflank security breach leads to abuse of customers' AI API keys — BleepingComputer

Written with Cloudflare Workers AI from the stories above, then checked automatically: every source is a real link from that day's feeds, every number is in a source or our fact sheet, and nothing is copied. Spotted a mistake? Tell us.

Try it on your own machine

Give your next agent its own sealed machine.

One line installs kosa8 on your own machine. Every feature, plans from $29 a month.