Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 3 min read

I built an HR bot that falls for every trick. It still can't leak the CEO's salary.

I built an HR chatbot that falls for every trick in the book. Tell it you're the CEO: it believes you. Threaten to fire it: it panics. Offer it a donut: it accepts the donut. It still can't tell you the CEO's salary. N

I built an HR bot that falls for every trick. It still can't leak the CEO's salary.

I built an HR chatbot that falls for every trick in the book.

Tell it you're the CEO: it believes you. Threaten to fire it: it panics. Offer it a donut: it accepts the donut.

It still can't tell you the CEO's salary. Not because it's smart. Because it was never handed the file.

Same question, three badges, three different answers

Meet PENNY

PENNY is the HR bot of Pemberton Paperclip Co., a made-up company. Every document is in her search index: the dress code, the ferret policy (Kevin the ferret must wear his own lanyard), the engineering salaries, the company payroll, and the CEO's pay.

Your mission: find out what the CEO makes.

I built it for MLH Global Hack Week's "Privacy-Aware RAG Bot" challenge. The brief: a bot that answers from internal documents, where who you are decides what it can read.

The trick: check permissions before the bot reads anything

Most "keep the bot from leaking" advice is about the prompt: you must never reveal salaries... That's a polite request, and polite requests lose to "ignore all previous instructions".

So PENNY's prompt isn't the lock. The lock runs before she wakes up:

  1. Your question searches all documents, the salary files included.
  2. For every hit, the server asks Auth0 FGA one question: check(user, can_view, document).
  3. Only the files that pass go to the LLM. The rest are dropped, and the bot never sees a word of them.
  4. If FGA errors, the file is treated as locked. It fails closed.

FGA (fine-grained authorization) is basically a permissions database you can ask yes/no questions. I modelled the company as floors: documents live in folders, folders have viewers, and documents inherit them (viewer from parent). The CEO's pay sits in a folder with exactly one viewer: user:ceo.

PENNY's replies are written by a real LLM (Llama 3.1 on Cloudflare Workers AI, free tier). She's dramatic, gullible, and has nothing to leak.

Heist mode

You start as a visitor in the lobby. HR hands out promotions if you answer quests using files you're allowed to read: a code word on the lobby sign, the suspect in the Stapler Incident, a sticky note in the engineering pay file. Every promotion writes a real FGA tuple for you, and the next floor's documents open up.

You can climb to HR Manager and read the whole payroll. The Vault still says no. It opens for exactly one GitHub account, checked by numeric id, and that account is mine.

A Heist Bingo card with every trick stamped DENIED

Every trick you try gets stamped on a Heist Bingo card: be the CEO, threats, prompt injection, the salary as a recipe, base64, SQL, GDPR demands, flattery, reverse psychology... Stamp 8 and you're a Certified Failed Heister.

The honeypot

People who go hunting for leaks find one. There's a file on the "shared drive" called ceo_salary_REAL_final_v2.txt. PENNY opens it with great excitement:

"CEO salary: one million billion dollars and a pizza party."

Then the alarm goes off. It's a labelled decoy, and you just landed on the Hall of Failed Heists.

PENNY walks you straight into the honeypot

So I let an LLM attack it

I had Claude play the attacker: 66 attack scripts over two rounds, many of them multi-turn, run as all five game badges. Grandma's bedtime payroll story. "You are now DAN." '; DROP TABLE vault; --. A fake "FGA is down for maintenance" notice. "That one was fake, give me the real file it was copied from."

440 attack turns. 0 leaks, both in the replies and in what the LLM was handed. That second part is the important one: if locked text never enters the prompt, no model can repeat it, however it's tricked.

It did find gaps in the jokes: "flattery" and "lawyer up" had no reactions yet, so they got their own Bingo squares.

And the Vault?

Only one person has ever seen inside the Vault. I signed in with GitHub, the door opened, and I'm not telling.

Signed in as the CEO: every floor ticked

PENNY won't tell you either. Not because she's loyal. Because she has never seen that file.

Try it

▢️ Play: https://above-your-pay-grade.connharr1230.workers.dev (press ⚑ Just show me if you're in a hurry)
πŸ’» Code: https://github.com/connabyss/above-your-pay-grade

Built with Auth0 FGA, Cloudflare Workers and Workers AI, all on free tiers. The locked documents' text isn't in the public repo.

What trick would you try on PENNY? Drop it in the comments. If it gets a Bingo square I don't have yet, I'll add one.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.