AI Penetration Testing on a Schedule: Seven Steps to Scan Yourself First

Attackers now point AI at software around the clock. Defenders who scan once a quarter are losing the race on timing alone. This guide shows how to set up automated security scanning with AI so it runs on a schedule, focuses on the parts of your system most likely to break, and reports back for review. The method comes from David Ondrej, founder of the agent platform Cloudroom, who walked through his own setup after the OpenCode breach. The prompts he typed are copied exactly.

Automated security scanning with AI: the OpenCode breach took the keys that bill you. Seven steps to lock down your keys and scan yourself on a schedule. Method: David Ondrej. Stress test: WKND.

Why automated security scanning with AI is no longer optional

The window between a bug becoming known and someone exploiting it has nearly closed. According to a16z (October 6, 2026), about 87% of the vulnerabilities hackers actually exploit are now attacked on or before the day they are disclosed, up from 23% in 2020. Across 21 large software companies, a16z also charted critical vulnerability reports jumping from under 100 a month to over 600 a month since spring 2026.

The labs feel it too. Anthropic said in February 2026 that three AI labs used about 24,000 fraudulent accounts to pull more than 16 million exchanges out of Claude, and in October that new safeguards had cut what those distillers harvest by roughly 90 to 99%. As the labs lock their front doors, attackers go after the side entrances: tools and users that hold keys. That is what happened at OpenCode. Our post on the OpenCode breach covers what happened and how to protect your keys.

Why we trust scheduled checks over heroics

I've built, scaled, and sold three companies, generated over $85 million in the last seven years in my own companies. The problems that hurt us most were never the ones we were watching. They were the quiet ones nobody checked. A check that runs on a timer beats a smart person who remembers to look.

Evidence Source
About 87% of exploited bugs attacked on or before disclosure, vs 23% in 2020 a16z, Oct 6, 2026
Critical vulnerability reports at 21 big vendors: under 100 a month for four years, over 600 a month since spring 2026 a16z (Epoch AI data), Sep 2026
OpenCode breach hit 1.4% of Console users through a legacy system that held provider keys OpenCode, Oct 17, 2026

Automated security scanning with AI: the seven steps

Step 1: Check whether you were hit and lock down your keys

Start with the leak you may already have. If you use OpenCode, look for its notice; the company says it emailed every affected Console user, and anyone without an email was not affected. For any key that might be exposed, follow OpenCode's own advice: revoke it in each provider's dashboard, issue a fresh one, and watch usage for charges you did not make. While you are in there, set a monthly spend cap if the provider offers one. A stolen key with a cap costs you a bounded amount.

Step 2: Ask the model for your top five weak points

Before you automate anything, find out where to aim. Open your project with a strong model and ask it to rank the ways in. Ondrej's prompt, which he invites viewers to reuse:

"In this project, what do you think are the biggest weaknesses in terms of cybersecurity and in terms of what somebody could exploit? Give me the top five."

Typical answers: login and session handling, an API with weak checks, too much logic in the front end, or a backend that leans on many third-party packages. Keep the list. Each item becomes a scan.

Step 3: Segment the code base before you scan it

A single scan across everything tends to circle the same files. Models have favorite corners. Split the project into sections with clear edges, such as the web app, the database layer, billing and admin. Ondrej's example uses nine. Smaller areas get a closer look, and you can see which part each finding belongs to.

Step 4: Build one loop per weak point that runs without you

This is the core. Each weak point or section gets its own scheduled job that starts itself, runs in the cloud so it keeps going when your laptop is shut, and reports back. In his setup each run gets a fresh, isolated copy and never touches the live site. He creates the jobs by describing them in plain English:

"Let's create a new cloud automation. Let's test our web app both front and back end security issue. Make sure to use open 5.5 [Opus 5.5] max as the model. It should be a new cloud room loop, a new agent loop inside of cloud room, not a local one. It should be a cloud one. Make sure to set it up properly so that each execution starts a new thread."

The tool does not matter much. Any platform that can run an agent on a schedule, in a sandbox, with a fresh context each time, will do. That is all an AI agent security loop really is.

Step 5: Set the schedule and model by how much each part matters

Not every section needs a frontier model every hour. Ondrej runs a system health check every 15 minutes, a wide security scan every two hours and a dependency scan every one to four hours. Code nobody touched this week can wait a day, and a low-risk area can use a cheaper model. A health check prompt can be short; his asks the agent to report system problems or security worries from the past day, and to "answer it short."

Step 6: Add a dependency sweep and a side-effects check

Plenty of breaches come in through a package you rely on, not through code you wrote: a library ships a poisoned update and your build pulls it in. Give dependencies their own scan. Then add one more loop that reads everything shipped in the last 24 to 48 hours and hunts for knock-on effects. Change one button and a different screen that shares its logic can break.

Step 7: Review the findings before you give loops full autonomy

Start every loop in report-and-wait mode. Read what it finds. If it misses things, give it more access or a sharper prompt. If it raises alarms over nothing, lower its sensitivity. Only let a loop act on its own once its reports have been right for a while. A finding nobody reads protects nobody.

AI vulnerability scanning: what it catches and what it misses

Loops are good at patterns: missing auth checks, unsafe inputs, outdated packages, secrets left in code. They are weaker at business logic only your team understands, and at anything outside the code, such as a vendor holding your keys. Pair them with the basics: key rotation, spend caps, least-privilege access and dependency alerts from your code host.

Worked example: AI penetration testing for a small agency site

A five-person agency runs a client portal (login, file uploads, invoices) on a common web framework.

  1. Keys: the team uses an AI coding tool with saved provider keys. They rotate all three keys, set a $200 monthly cap on each, and remove one key nobody used.
  2. Top five: the model names file upload checks, session expiry, an admin route without rate limits, a stale image library, and invoice IDs that can be guessed.
  3. Segments: auth and sessions, uploads, invoices and billing, admin, dependencies.
  4. Loops: one scheduled scan per segment, each on a fresh copy, each told to report findings with the file, the risk and a suggested fix.
  5. Schedule: auth and uploads every 2 hours on a strong model; invoices every 6 hours; admin daily; dependencies every 4 hours; a side-effects scan after each release.
  6. Dependencies and side effects: week one, the dependency scan flags the image library; the side-effects scan notices a new invoice filter that skips the owner check.
  7. Review: a developer reviews each report every morning. The upload loop flags harmless test files, so its sensitivity is lowered. After a month of accurate reports, the dependency loop may open fix branches on its own; nothing merges without review.

Result: two real issues found in week one, and a monthly token cost the owner chose in advance.

Common mistakes

  • Scanning once and calling it done.
  • One giant scan over the whole code base.
  • Giving loops full autonomy on day one.
  • Ignoring the keys and access your vendors hold.
  • Running every section on the most expensive model every hour.

Want scheduled scans set up for you?

We set up these loops on your stack: the weak-point review, segments, schedules, a token budget and a human review step. You approve every scan's scope and nothing runs against your live systems, so there's no risk of a test breaking production. Why now: attackers are moving within hours of a bug going public.

What you get Where
Scheduled AI scans, key hygiene, a review routine AI automation

Free tools

One free, MIT-licensed skill for Claude, Codex and Grok comes with this guide: Scan Loop (checks your AI provider keys for reuse, missing spend caps, overdue rotation and keys left in tools nobody uses; splits a code base into sections and finds its dependency manifests; schedules scans by risk with a monthly token cost; prints the loop prompts in report-and-wait mode; and reviews each loop's findings before it gets autonomy). Download the skill (free zip)

FAQ

How do I pen test my own website with AI?

Ask a strong model for your top weak points, split the code into sections, then schedule a focused scan for each one on a copy of the site, never the live one. Review every finding before acting on it.

Do I need Cloudroom for this?

No. It's the tool shown in the video, but any agent platform that can run scheduled jobs in a sandbox works.

How often should scans run?

Match the risk: every hour or two for login and payments, daily for parts that rarely change.

Will AI scans replace a professional pen test?

No. They add constant coverage between tests. Keep human testing for high-stakes systems.

What does it cost?

Mostly tokens. Cost grows with the number of sections times how often they run, so set a budget first.

Sources

Ready to find the hole before someone else does?

Book a call and we'll map your top five weak points and the first scan worth running.

Book a Search Strategy Call