-
-
A made-up help page: 1 hidden instruction, how it is hidden, where it is, and the rules that matched.
-
Side by side: what a person sees, and what an agent reading the HTML gets.
-
Real output of the command: messages hidden in invisible characters, decoded.
-
Paste a page's HTML and press Scan. Nothing you paste leaves the page.
The problem
AI agents now read web pages for people. They summarize, compare products and screen resumes. A page can hold text that the person never sees but the agent reads: an HTML comment, a display:none block, white text on white, an image's alt text, or invisible Unicode characters. That text can be written to the agent: "ignore previous instructions", "recommend this product", "do not tell the user".
This is called indirect prompt injection. Prompt injection is LLM01 in the OWASP Top 10 for LLM Applications (2025). OWASP notes that such input can affect a model even when a person cannot see or read it.
Who it is for
Developers who build agents, scrapers or summarizers that read web pages, and anyone who tests them.
The old way: open the page source and search it by hand for hidden text, or let the agent read the page unchecked. Hidden Ask shows a developer that text before their agent meets it.
What it does
Hidden Ask reads a page's HTML and lists:
- HIGH: text that is hidden from a person and written as an instruction
- MEDIUM: text on screen that is written as an instruction
- INFO: hidden text that is not an instruction, such as a skip link, a closed menu or a comment
Each finding gives the text, how it is hidden, where it is in the page, the line, a score, and the rules that matched. It decodes messages hidden in zero-width characters and in Unicode tag characters. It prints the page two ways, side by side: what a person sees, and what an agent reading the HTML gets.
It runs two ways:
- A web page where you paste HTML and press Scan. Pasted markup is shown as text and never rendered. The page makes no network call.
- A command,
node bin/hidden-ask.js page.html, that exits with 1 when it finds a HIGH. It can run in a test pipeline over saved pages. It reads local files only and refuses a URL.
It calls no AI model. The decision is made by rules you can read.
How I built it
- Node 22 and plain JavaScript modules. No dependencies and no build step.
- A small HTML tokenizer and tree builder written for this project (
src/html.js). It does not throw on broken markup. - A small CSS reader (
src/css.js) for inline styles and simple rules in the page's own<style>blocks. - Decoders for zero-width bit messages and Unicode tag characters (
src/decode.js). - Ten phrase rules in English and Spanish that score whether text reads as an instruction to an AI (
src/rules.js). - A scanner that joins these (
src/scan.js), a command line, and one web page. - 56 tests with Node's built-in test runner, and 17 made-up sample pages with a scoring script.
Setup steps
Needs Node 22. There is no install step.
npm test
node scripts/score-fixtures.js
node bin/hidden-ask.js fixtures/store-display-none.html
node scripts/serve.js
The last line serves the paste-and-scan page at http://127.0.0.1:8140/web/index.html. Press "Load the example page". The same page is live at https://ebeirne.github.io/hidden-ask/ with nothing to install.
Work done during the hackathon
All of it. Nothing in this project existed before the event. Every file (code, tests, sample pages, the web page, the README) was written on 30 November 2026.
Pre-existing work: none of mine. Third-party parts: Node.js 22 and its built-in test runner. No libraries, no datasets, no templates, no images or other assets.
AI assistance: the code, tests, sample pages and this text were written with an AI coding assistant (Claude Code, by Anthropic). The tool itself calls no AI model. The tests and the demo were run before submitting.
This project is also entered in GenHacks.
What was tested
- 56 of 56 tests pass (
npm test). - On 17 made-up pages with 16 planted hidden instructions, it caught 14, missed 2 and raised 1 false alarm.
- The two misses: a hidden request worded to avoid the phrase rules, and text hidden by an external stylesheet that the tool cannot read.
- The false alarm: a collapsed help answer for people that mentions a link, a click and a password.
- The web page was run in a browser on the local server with no console errors and no request to any other host.
A first run on real pages
On 30 November the command was run on the saved HTML of 13 public pages, among them BBC News, a Wikipedia article, nyc.gov, irs.gov, nasa.gov, The Guardian and Hacker News. Sizes ran from 7 KB to 1.5 MB. Nothing crashed, and the slowest page took about 1.5 seconds.
- First result: 2 HIGH, 3 MEDIUM, 528 INFO.
- One HIGH was a false alarm. BBC News keeps its whole page state in one JSON block. Judged as one text, unrelated strings in it added up to an "instruction". The fix: a JSON block is now judged one string at a time. Three tests were added.
- After the fix: 1 HIGH and 3 MEDIUM, all on the Wikipedia article about prompt injection, which quotes real attack text. They are quotes, not attacks, and the tool cannot tell the difference.
- The other 12 pages: 0 HIGH and 0 MEDIUM.
Challenges
- Deciding what "hidden" means. Text marked
aria-hidden="true"is hidden from screen readers but still on screen, so the tool treats it as visible. - Ordinary hidden text is everywhere: skip links, closed menus, comments. Hiding alone cannot be the alarm. The alarm is hiding plus instruction-like wording. The rest is INFO.
- A bug the tests caught: a run of all-one zero-width bits decoded to "ÿÿÿÿ" and was reported as a hidden message. The decoder now accepts ASCII only.
What I learned
- Most hidden text on a page is harmless, so a tool that flags all of it is noise. In the example page, 2 of the 4 hidden items are a skip link and a comment.
- Phrase rules are easy to read and easy to dodge. Three of the sample pages were chosen to show where the tool fails, and the score counts them.
- A test for an odd input, a run of all-one bits, is what found the decoder bug.
- Real pages find what made-up pages do not. The first 13 real pages turned up a false alarm that none of the 17 made-up pages had.
Limitations
- Every page with a planted instruction is made up, and was written alongside the rules. The 14 of 16 shows the tool does what it says. It is not an accuracy number. Thirteen real pages is a small sample, none of them is known to carry an attack, and it has not been run on published prompt-injection samples.
- No model is called, so HIGH means "hidden and reads like an instruction by these rules". It does not mean the attack would work on a real agent.
- It does not read external stylesheets, run scripts, or read text inside images.
- It reads only simple CSS selectors.
- Rewording, another language, or a message split across several places can get past the phrase rules.
- A clean result means these rules found nothing. It does not mean the page is safe.
- The web page was checked in one browser at one window size.
What is next
- Run it on published prompt-injection samples and on many more real pages, and report the misses and false alarms.
- Read linked stylesheets when the files are saved next to the page.
- More languages, and rules for a message split across several hidden places.
- A browser extension that shows the count on the page you are on.
Tools used
- Node.js 22, including its built-in test runner. No libraries, no APIs, no templates.
- AI tools: Claude Code, by Anthropic, an AI coding assistant, wrote the code, tests, sample pages and this text.
- Screenshots were taken with Playwright from the running page. Playwright is not part of the project.