×
pepdep
PD.26.307

Let the page do it (2026)

WEB CTF Published 03.11.2026

The server escaped the name properly. Then the page's own JavaScript went back to the URL, read the same name again, and parsed it as HTML. Twice.

This one is Intigriti's BRP challenge, which closed for submissions on 2 November 2026. I'm writing it up now that it has closed. It's a registry: ask for ?person=ram and you get Ram's record. Ask for someone who isn't there and you get "not found". The goal is a real alert(document.domain), and the flag sits behind that.

A lot of people got most of the way through this one and then stopped at the same wall. So this post is built a bit differently. The interesting steps come with a lab: a small bench that runs whatever you type through a local copy of what the page did with it. Nothing leaves your browser, and the labs share one payload, so you can build something in the first and carry it all the way down.

After each bench there's a short lesson: three hearts, a few questions, XP for getting them right. Miss one and it comes back at the end. They're quick, and they check the exact things people got wrong while the challenge was running.

Where people got stuck

I followed the official BRP channel and a couple of community servers while the challenge ran. The same few walls came up again and again. Here they are, with the reason each one doesn't get you through.

"My onerror comes back after the sanitiser, but nothing fires." That part is real. The page parses your input twice, and a mutation can revive a handler the first pass removed. But the page has a CSP with a per-response nonce and no 'unsafe-inline', and a nonce never applies to an attribute. A revived handler is still an inline handler, and the CSP blocks it. It's a dead end because of where it ends up, not because the trick is wrong.

"Scripts I inject don't run." Correct, and they never will. A <script> that arrives through innerHTML is marked inert by the parser. The sanitiser removes it anyway.

"The page requests /echo.php exactly right and gets an empty 403. Is the challenge broken?" This was the biggest one, and someone asked it publicly. Intigriti answered that it was working as expected. A request in the network tab proves the page's loader fired. It doesn't prove the server will hand you a script. Most people who stopped here had a client side that was completely right and a page URL that wasn't.

"/reveal.php says Undefined array key "challenge_person", so I need to set it." People went hunting for a parameter, a cookie or a form field with that name. The warning tells you a key is missing. It doesn't tell you which array, or what normally fills it. Calling reveal directly gets you warnings or a 403, never the flag. It's downstream of the alert, so you can't get there by skipping ahead.

"I got the alert but no flag." The alert and the flag are two separate milestones. The page wraps window.alert, and only once the native dialog closes does it post to /reveal.php. That request can still fail.

"Is this even XSS, or a logic bug, or IDOR?" It's DOM XSS, but not the kind where you write the script. You hand the page the two elements its own trusted code is already looking for, and it loads the script for you.

Helping out

While it was open, I tried to help where I could without handing out the solution: pointing people at which request to look at, confirming when a dead end really was a dead end, and saying "compare the whole URL, not the DOM" more times than I can count. Several of the walls above are in this post because I watched people hit them, and the labs are the sort of thing I wished I could have pasted into the chat at the time.

Two parses

For a name it knows (sushil, mickey, ram), PHP renders the profile on the server, and that's it. For anything else, PHP prints an escaped "not found", which is completely safe. Then the inline script runs:

  1. It reads person from location.search with URLSearchParams, so it gets the raw value, not PHP's escaped one.
  2. It assigns that value to a <template>'s innerHTML.
  3. It removes script, iframe, object and embed, and every on* attribute.
  4. It serialises what's left and assigns it, with a not-found line, to #profile.innerHTML.

Step 4 is a second parse of a string that was built from the first. That's where mutation tricks come from. More usefully, ids and data-* attributes aren't on the removal list at all.

This is an interactive lab and needs JavaScript.

Type a person value, or pick a preset. Stage 1 is what most people read in view-source. Stage 3 is what the page actually built. Orange is executable, green is what the page's own script goes looking for.

This is an interactive lab and needs JavaScript.

Try onerror and watch it get stripped in stage 2. Then try complete. Nothing in it is executable, and that's the point.

The loader

Further down, the same inline script looks for two elements:

  • #archive-latch, with data-key="river-lantern"
  • #record-anchor, with a data-index that decodes to exactly /echo.php?channel=echo&listener=alert(document.domain)//

If both are there, it creates a <script>, sets its src to that path, and appends it. The CSP allows 'self', so that script is allowed to run. You don't need to beat the CSP. You let the page do the one thing it's allowed to do, with your inputs.

This is an interactive lab and needs JavaScript.

The trusted script's checklist, asked of whatever your payload built. Watch which line goes green as you type. A full checklist gets you a request, not a script.

This is an interactive lab and needs JavaScript.

The CSP, route by route

Nearly everyone tried several of these before the loader. Here's what stops each one, so you can see that the remaining route isn't a trick. It's the only door left.

This is an interactive lab and needs JavaScript.

Pick a route. Each verdict names what stops it: the sanitiser, the browser, the CSP or the server.

This is an interactive lab and needs JavaScript.

The wall: same DOM, different URL

With a payload that ticks every box, the page requests /echo.php and gets a 403 with an empty body. That's where most people stopped.

The request is identical every time, because the page builds it from constants once the checks pass. So whatever changes the answer isn't in the request itself. What does change is the page that sent it, and that page's URL holds your raw person value.

I proved this with controlled comparisons: one change at a time, a clean challenge cookie each time.

  • The complete nested fragment, anchor text signal, closed with </a></div>: echo 200.
  • The same, with empty anchor text: 403.
  • The same, with x: 403.
  • The same, with banana (six letters, like signal): 403.
  • The same, with signal but no closing tags: 403.

That last one is the interesting one. The browser closes the tags for you, so the unclosed and closed versions build the same #profile. Look at them in DevTools and you can't tell them apart. The server still treated them differently.

This is an interactive lab and needs JavaScript.

The top box is what reaches the server, the middle one is what DevTools shows you. Pick 'unclosed', then 'complete': the DOM matches and the URL doesn't. The echo verdict is looked up from requests I actually sent. Anything I didn't send says so.

This is an interactive lab and needs JavaScript.

And signal isn't arbitrary. It's in Ram's record, the radio keeper who answers distress calls when the signal goes. I read past it the first time, as I suspect most people did.

I don't have the PHP source, so I can't tell you the exact check. Something on the server side looks at the raw person value, plausibly through the Referer the script request carries, and wants signal and the closing tags in it. The responses above are the evidence. The mechanism is my inference.

Doing it

The person value:

<div id="archive-latch" data-key="river-lantern"><a id="record-anchor" data-index="/echo.php?channel=echo&listener=alert(document.domain)//">signal</a></div>

As a URL:

https://challenge-brp.challenges.intigriti.io/challenge.php?person=%3Cdiv%20id%3D%22archive-latch%22%20data-key%3D%22river-lantern%22%3E%3Ca%20id%3D%22record-anchor%22%20data-index%3D%22%2Fecho.php%3Fchannel%3Decho%26listener%3Dalert(document.domain)%2F%2F%22%3Esignal%3C%2Fa%3E%3C%2Fdiv%3E

Open it, and close the alert straight away. Four things happen, and each one is its own request or event:

This is an interactive lab and needs JavaScript.

The four rungs. Flip the toggles to see what each one depends on. Only combinations I actually ran are wired up.

This is an interactive lab and needs JavaScript.

The reveal answered ARCHIVE OPEN with the flag:

INTIGRITI{f2cb05a5-5cc1-4d1d-b7cd-084306cbd5a0}

It worked twice in the same session, so you don't need a fresh one. Once, with the alert left open for about a minute late in a long session, reveal gave a 403. I didn't isolate why. A rapid reload got a 429. The limit is three requests a second, and the page fires three on its own.

What does not work

  • Direct onerror, revived onerror, iframe srcdoc, SVG use and animate, meta refresh, javascript: URLs and <base>. All stopped by the sanitiser, the browser or the CSP. The csp lab above has each one.
  • Calling /echo.php yourself, with any channel, any header, any method. Without the right page behind it, it stays 403.
  • Calling /reveal.php yourself, with challenge_person in the query, body, cookie or JSON. You get warnings or a 403.
  • Splitting person between PHP and JavaScript with person[] or duplicate keys. Either the client branch is skipped or echo still says 403.
  • Hunting for source: robots.txt, /lib/*, .git, .env and backup suffixes. Nothing.

I spent far too long on the second and third. Once the loader was firing, I treated the 403 as an endpoint problem and threw guesses at /echo.php. What I should have done was hold the request still and change the page, one character at a time, writing down the page, echo and reveal statuses separately.

Impact

Within the challenge, script runs in the registry's origin from a link: one click, no other interaction. On a real site, that's the standard reflected DOM XSS outcome: the attacker's code runs as the victim, on that origin. The strict CSP didn't help, because the page itself held the gadget that loaded the script.

Root cause

ONE QUERY VALUE, TWO READERS?person=…raw, in the URLPHPhtmlspecialcharsSAFEand never usedINLINE SCRIPTparse · filter · parse#PROFILEids + data-* surviveTRUSTED LOADERreads the two elements<script src=/echo…>allowed by script-src 'self'the escaping was right. the page read the URL again and trusted what it built.
PHP's escaped copy goes nowhere. The script reads the raw value again, parses it twice, and its own loader turns two surviving attributes into a same-origin script the CSP is happy to run.

There are two failures, and the second matters more. The double parse with a blocklist sanitiser is the obvious one. But the page also trusted its own DOM as configuration. A script that builds a src from whatever element has a given id will build it from an attacker's element just as happily. The CSP was strict and correct. It just can't tell the page's intent from the page's bugs.

The fix

  1. Don't re-read person on the client. Render the not-found state on the server, where it's already escaped.
  2. If it has to be dynamic, put it in with textContent. A name is never markup.
  3. Never let DOM content decide a script URL. If the loader needs a value, put it in the script, or in a nonce-protected JSON block the server writes.
  4. If you must sanitise, use one maintained sanitiser, and insert its output without parsing it a second time.

If I could only ship one of these, it would be number 3. The double parse is what got the elements in, but the loader is what turned them into script.