id: addeventlistener-detect

info:
  name: Add DOM EventListener - Detection
  author: yavolo,dwisiswant0
  severity: info
  description: |
    Identifies the use of JavaScript addEventListener calls in the DOM.
  reference:
    - https://portswigger.net/web-security/dom-based/controlling-the-web-message-source
  metadata:
    max-request: 1
  tags: miscellaneous,xss,misc,vuln

http:
  - method: GET
    path:
      - "{{BaseURL}}"

    matchers:
      - type: regex
        part: body
        regex:
          - (([\w\_]+)\.)?add[Ee]vent[Ll]istener\(["']?[\w\_]+["']? # Test cases: https://www.regextester.com/?fam=121118
# digest: 4b0a00483046022100f78943ba8e3b3754760bcfe2a6fa12025947290f3d15bfc9d6f42a2a1c9e8561022100fe9d93ec4d448a2fd26d9c25d334a668e0917ddcb22a8c78c6033aa4c35159cf:922c64590222798bb761d5b6d8e72950