As we're entering an era where new vulnerabilities and compromises are becoming more common, security hardening is increasingly important, and so is making it more accessible. Here are 10 copy-paste prompts for your AI agent to harden yourself, written to stay useful for as long as possible.

Some might not apply to you, so feel free to adapt them to your setup and threat model, or ask your agent which ones are relevant. Some prompts overlap on purpose, so important things aren't missed. Watch the session, approve changes yourself and double-check its findings where possible.

1. Inventory

Everything else depends on knowing what you actually run.

Build an inventory of everything I run and manage with exact versions, including the OS, packages, dependencies, apps and tools with their plugins, secrets (where each one is stored and what it can access, never the values) and all devices, resources and accounts I control and third-party services I rely on. Check what you can reach and ask me about the rest. Save it all to one file.

2. Check it against recent threats

Using the inventory, look for known vulns, recent attacks and breaches that affect anything in it. Use parallel subagents (e.g. one per area) and primary sources. Then check whether each finding really applies to my system and whether I was already affected (e.g. a malicious version I installed in the past), rank them by real risk, mark each as confirmed, likely or couldn't check, and tell me how to fix each.

You can also ask your agent to automate this with simple tools (e.g. Dependabot, a scheduled vuln scanner or data-breach alerts) or by running this prompt on a schedule with access only to the inventory.1

3. Check for compromise

Check everything I run or control in the inventory for signs of compromise, starting with this machine. Look at running processes, the usual persistence locations, logs and recently changed files. Don't upload my files anywhere (e.g. online scanners like VirusTotal).

If you have time, you can also watch outbound traffic:

Watch what connects to the internet from this machine for a day (with something that logs every connection, e.g. Little Snitch). Group connections by process and destination, flag anything unknown or unexpected, and tell me what each one is.

4. Reduce the attack surface

From the inventory, find what I don't need anymore or what is risky to keep (e.g. unused apps and extensions, forgotten accounts and secrets, dependencies that few people use or maintain, anything open to the internet that doesn't need to be). For each, tell me what it can reach and how sure you are I don't need it. Give me a list to approve, don't remove anything yourself.

5. Assume the breach

Assume this machine or anything else in the inventory (e.g. a dependency, an account, a third-party service) gets compromised tomorrow. Find everything an attacker could steal, reach or destroy from it (credentials, browser sessions, valuable files, access to other systems) and suggest the cheapest way to limit the damage (e.g. moving secrets into a password manager, narrower scope and limits for keys, encrypted files or folders that stay locked when not in use, better isolation, encrypted backups this machine can't delete). Show me the plan and wait for my OK before changing anything.

If you use a password manager, consider setting up secrets injection from a separate vault, so your keys aren't stored in plaintext files like .env.

If you use AI agents a lot or run them at large scale (e.g. evals), consider applying the same to your agents specifically:

Help me apply least privilege to how I use AI agents. For each project or repo where I run agents, suggest a setup that gives the agent only what that project needs (e.g. its keys and network access) and a simple command to start it that way (e.g. a shell alias). For untrusted repos and unattended runs, suggest a gVisor sandbox or a disposable VM using existing tools where possible (e.g. coop). Also suggest safer defaults for how I normally run agents. Show me the plan and wait for my OK before changing anything.

6. Accounts and 2FA

Help me audit my important accounts (e.g. email, GitHub, cloud). For each, find out what 2FA it supports and ask me what I use now. Flag anything on SMS, with no 2FA or with weak recovery options, and walk me through moving them to passkeys or hardware keys and keeping recovery codes in my password manager. Don't log in anywhere yourself.

Get two hardware keys (e.g. YubiKey) and keep the second one somewhere safe, so losing one doesn't lock you out.

7. Lockdown plan

Write me a lockdown runbook for when this machine gets compromised, starting with isolating it. For every secret and third-party service in the inventory, add the exact page or command to revoke it and make sure I can do it from a known-clean device. Then add a check for access the attacker could have added (e.g. active sessions, connected apps, new keys and tokens, recovery settings, email-forwarding rules) and end with reinstalling the machine. Keep it on one page.

8. Harden

Check this machine's security against a standard hardening guide for this system (e.g. CIS Benchmarks), including disk encryption, screen lock and open ports. Also consider safer alternatives, configurations or ways to run the apps and tools I use, and any best security practices I'm missing across everything in the inventory (e.g. automatic security updates or skipping package versions less than a few days old, except for urgent fixes). Show me the plan and wait for my OK before changing anything.

9. Audit for backdoors

From the inventory, pick the software and firmware I rely on that the fewest people have audited (e.g. router and camera firmware, smart devices, little-known apps and dependencies). Get the source code or binaries where possible, review or reverse engineer them in a sandbox and look for backdoors and vulns (e.g. hardcoded credentials, hidden remote access, unexpected connections). For each finding, tell me what you verified and the cheapest fix (e.g. updating, blocking it from the internet, moving it to a separate network or replacing it).

10. Attack yourself

Act as an attacker targeting me. Do recon and OSINT on me and everything I run or control (e.g. my name, handles, emails, repos, domains, servers, leaked data), analyze it together with the inventory and find the cheapest ways to compromise me (e.g. the most effective phishing against me, my weakest links, the worst assumptions I rely on). For each, tell me why it works, what you verified and the cheapest fix.

Footnotes

  1. If you run this prompt unmonitored, consider putting the agent in a sandbox, as described in the agents prompt in step 5. โ†ฉ