好文集ChatGPT Plus¥119

How to Build an AI Hacking Agent That Finds Bugs While You Sleep

文章目录

I built an AI agent that hunts bugs while I sleep. Not a chatbot that gives me advice about hacking, an agent on my own server with hands. It maps a target, tests the bug classes I actually care about, throws out its own false positives, writes a proof of concept, and messages me on Telegram when something is real.

This is the whole build, in the order I did it. It took a weekend, and most of that weekend was me being stubborn about things that turned out not to matter.

WHAT YOU NEED

Before anything else, here is the list. It is short and none of it is expensive.

  1. A VPS. Mine is 2 vCPU, 8 GB of RAM and 100 GB of disk. You do not need a GPU, because the models run on someone else's hardware

  2. A model key. The Nous Portal covers 300 or more models with one subscription, or bring your own provider. I run DeepSeek V4 Flash as my main working model

  3. Telegram, because that is how you will talk to your agent from your phone

  4. One target you are allowed to test. Your own lab, a program that has it in scope, anything legal

  5. A hunting method. This is the part nobody sells you, and it decides whether your agent finds anything at all. I teach mine on hackerz.space, but you can start with a bug class you already understand by hand

STEP 1: GET THE SERVER

Pick Ubuntu when you order it, copy the IP out of the dashboard, and SSH in. Then install Hermes on the machine with one command and let it run.

ssh root@YOUR_SERVER_IP

curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash

source ~/.bashrc

Do not skip that last line, and do not try to run this on your laptop and call it done. An agent that dies when you close the lid cannot hunt at midnight.

STEP 2: CONNECT A MODEL

An agent is only as good as the model behind it. There are two ways to pay for that, and I have used both.

The first is the Nous Portal, from the people who make Hermes. One subscription, 300 or more models, one key, and you can swap models later without touching anything else.

hermes setup --portal

hermes model

The second is any other provider. GLM and Z.AI are solid, and there are free models if you are only experimenting. I would not hunt on a free model, because cheap models are exactly where the false positives come from, and a false positive costs you reputation with a triager.

One warning that should not need saying. Do not paste model keys into random chats, and do not screenshot them. A model key is a password.

STEP 3: CONNECT TELEGRAM

This is my favourite part of the whole build, because it is the moment the thing stops being a tool on a server and starts being something you can reach in your pocket.

  1. Go to BotFather, create a new bot, give it a name

  2. BotFather gives you a token, and that token is the key to your agent, so treat it like your server password

  3. Get your own numeric Telegram user ID and paste it in, so your agent knows who is allowed to control it

  4. Restart the gateway, then message it something like "what is your name"

hermes gateway setup

The allowlist step is the one people skip, and it is the one that matters. A bot token with no allowlist is an agent that anybody can drive.

STEP 4: WRITE YOUR FIRST SKILL

This is where most people go wrong, so read it twice.

A skill is a written set of instructions you give your agent so it follows your method instead of guessing. Ask a general agent to find you an XSS and it finds you a basic one. Ask it for the ones that pay and it cannot, because it has no method to follow. The skill is the method.

There are three ways to build one.

  1. From your own reports. Give the agent your HackerOne API key and tell it to pull your XSS and broken access control reports and summarise them into a skill. Now it hunts the way you hunt

  2. Paste an existing skill. If you already have instructions from another tool, paste them into the new skill field

  3. Use the learn feature. Give it good source material and let it write the skill. Disclosed reports are gold, good technical blogs are gold, and generic content farm articles are usually wrong

Technically a skill is just a folder with a SKILL.md inside it, and the file opens with a short header that tells the agent when to load it.


name: xss-hunter

description: "Use when hunting XSS on an authorized target: phased scan."

metadata:

hermes:

tags: \[xss, bug-bounty, pentest, web, scanning, reporting\]

I built mine out of my own XSS reports and called it XSS Hunter. It reads like my methodology, because that is exactly what it is.

STEP 5: RUN THE HUNT IN THE RIGHT ORDER

Most beginners run one magic command that swaps every parameter for a payload and greps for reflections. It works sometimes, and the rest of the time it burns your IP. If the endpoint is JSON, firing HTML payloads at it does nothing except get you noticed, and then when it really is vulnerable you are already blocked.

The order I use, and the order I put in the skill.

  • Check the content type first. If it is not text/html, do not fire HTML payloads at it

  • Test whether the parameter reflects at all, with something harmless like xyz

  • If it reflects, send plain HTML rather than an XSS payload, and see whether you get HTML injection

  • Escalate from HTML injection to XSS with an event handler: onerror, onhover, onload, whichever fits

  • Check forms properly. Read the HTTP method, take the input name attributes, and test those parameters, not just the ones in the URL

That sequence is the difference between a skill and a spray and pray script. If your skill file is vague about which check comes first, your agent will be vague in exactly the same places.

STEP 6: ADD A SECOND MODEL TO VALIDATE

AI will hand you findings that are not real. Report those and you burn your relationship with the triagers who matter, so build a second skill whose only job is validation, and point it at a different model than the one that hunts.

  1. I hunt with DeepSeek V4 Flash and validate with a stronger model

  2. Two models disagreeing is a signal, not a bug

  3. Never trust a finding just because your agent tells you it is 100 percent certain

STEP 7: BUILD THE POC YOUR TRIAGER CAN RUN

When you do find something, do not send a paragraph and hope. Ask your agent for a working proof of concept, HTML or Python, that a triager can run and see with their own eyes.

Mine writes a finding.html with a form that carries the payload and submits itself. The triager opens it, it fires, the popup appears, done. That is the difference between a report that sits for three weeks and a report that gets triaged the same day.

STEP 8: PUT IT ON A SCHEDULE

New assets get added to programs all the time, and the money is in being first. If a new subdomain appears and you show up six hours later, someone else already tested it.

So create a cron job, pick the schedule, write the instruction, and pick the tools. Mine runs daily at midnight.

0 0 * * *

Every night it pulls the current subdomain list for the target, compares it against the list from previous runs, and if anything is new it scans it and tells me. The notification arrives through the same Telegram connection from step three, or Discord, or email if you prefer.

You do not need to be at a laptop. You need to be the first person who touches the asset.

STEP 9: KEEP THE FINDINGS IN ONE PLACE

Hunting makes a mess fast. Mine all lands in one dashboard: reflected XSS, IDOR, CSRF, each one carrying the description, the JSON, the markdown and the POC file, ready to validate and send.

Validate manually as well. Every time. The automation tells you where to look, and you decide what is real.

WHAT I WOULD DO FIRST

If you take one thing from this, build one skill properly before you build ten. Take a bug class you already know, write down the exact steps you follow by hand, feed the agent your own reports, and run it against a target you are allowed to test. Then add the validator. Then add the schedule.

That is a real agent. It is not a chat box that forgets you, and it is not a tool you have to sit and babysit.

WATCH THE FULL VIDEO

Watch the full video here on YouTube and make sure to subscribe. It is the whole build on screen, every step, every command.

https://www.youtube.com/watch?v=zNG8Mnkvtxk

And if you want to learn web hacking and bug bounty properly, or learn how to build AI hacking agents like this one, I teach all of it on my platform, with real labs and real targets, no basics you already know.

https://hackerz.space

See you in the next one.

全文完
查看原文