Skip to content

Missing Sink: Element.setAttribute() #47

@leeN

Description

@leeN

Upon reading the Probe the Proto paper I noticed how they claim that Element.setAttribute is the most common XSS sink they encountered. We currently do support said sink however.

Consider the following document:

<!DOCTYPE html>
<html>

  <head>
    <title>SetAttribute Test</title>
    <script>
      function load() {
        let handler =location.hash.substr(1);
        handler = decodeURIComponent(handler);
        let i = document.querySelector("#target");
        i.setAttribute("onload", handler);
        i.setAttribute("src", "https://raw.githubusercontent.com/SAP/project-foxhound/main/browser/branding/foxhound/default128.png");

      }
    </script>
  </head>

  <body onload="load()">

    <img id="target" src="x" />
  </body>
</html>

When opened in Foxhound as follows: setAttribute.html#alert(1) I would expect a taintflow from location.hash to Element.setAttribute but nothing is reported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions