Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2024-10851 Overview
CVE-2024-10851 is a Reflected Cross-Site Scripting (XSS) vulnerability in the Razorpay Payment Button Plugin for WordPress. The flaw affects all plugin versions up to and including 2.4.6. It stems from improper use of the add_query_arg and remove_query_arg functions without escaping URL output. Unauthenticated attackers can inject arbitrary JavaScript that executes in a victim's browser when the victim clicks a crafted link. Successful exploitation can lead to session hijacking, credential theft, or redirection to attacker-controlled infrastructure. The vulnerability is categorized under [CWE-79] (Improper Neutralization of Input During Web Page Generation).
Critical Impact
Unauthenticated attackers can execute arbitrary JavaScript in a victim's browser session by tricking users into clicking a malicious link, enabling account takeover of WordPress administrators and site visitors.
Affected Products
- Razorpay Payment Button Plugin for WordPress — all versions up to and including 2.4.6
- Affected file: includes/rzp-payment-buttons.php
- Affected file: includes/rzp-subscription-buttons.php
Discovery Timeline
- 2024-11-13 - CVE-2024-10851 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-10851
Vulnerability Analysis
The Razorpay Payment Button Plugin uses the WordPress helper functions add_query_arg and remove_query_arg to construct URLs for the plugin's admin and front-end pages. These functions return the current request URI with query parameters appended or removed. The plugin then outputs the returned URL directly into HTML attributes without passing it through esc_url or an equivalent escaping function.
Because the request URI is attacker-controlled, injected characters such as quotes, angle brackets, and JavaScript event handlers reach the rendered page unmodified. A crafted link containing a payload in the query string causes the plugin to echo attacker-supplied content into the response. The browser then parses and executes the injected script in the context of the vulnerable WordPress site.
The impact is bounded by user interaction: a victim must click the attacker's link. Successful exploitation runs arbitrary JavaScript with the privileges of the authenticated user, which may include site administrators.
Root Cause
The root cause is missing output escaping on URL values returned by add_query_arg and remove_query_arg inside rzp-payment-buttons.php and rzp-subscription-buttons.php at line 78 of each file. WordPress documentation explicitly notes that the output of these functions is not sanitized and must be escaped by the caller.
Attack Vector
The attack vector is network-based and requires user interaction. An attacker crafts a URL pointing to a vulnerable page on the target WordPress site with a malicious payload in a query parameter. The attacker delivers the URL through phishing email, social media, or a malicious third-party site. When the victim loads the URL, the plugin reflects the payload into the HTML response and the browser executes it.
See the WordPress Razorpay Payment Buttons Code and WordPress Razorpay Subscription Buttons Code for the vulnerable code paths.
Detection Methods for CVE-2024-10851
Indicators of Compromise
- HTTP requests to WordPress endpoints containing script tags, onerror=, onload=, or javascript: sequences in query parameters
- Access log entries referencing rzp-payment-buttons or rzp-subscription-buttons with unusual URL-encoded payloads
- Unexpected outbound requests from administrator browsers to unknown domains shortly after visiting WordPress admin pages
- New or modified WordPress administrator accounts without a corresponding audit trail
Detection Strategies
- Inspect web server access logs for GET requests to pages that load the Razorpay plugin with suspicious query string content
- Deploy a web application firewall rule that flags reflected payloads matching common XSS signatures in requests to WordPress endpoints
- Review the installed plugin version against the vulnerable range (≤ 2.4.6) across all managed WordPress sites
Monitoring Recommendations
- Enable Content Security Policy (CSP) reporting to capture inline script violations on WordPress properties
- Monitor browser-based telemetry for anomalous script execution on /wp-admin and plugin-rendered pages
- Alert on administrator session cookies being transmitted to external hosts
How to Mitigate CVE-2024-10851
Immediate Actions Required
- Update the Razorpay Payment Button Plugin to a version later than 2.4.6, which incorporates the fix delivered in WordPress Change Set #3186303
- Audit WordPress administrator accounts and rotate credentials for any account that may have interacted with suspicious links
- Invalidate active WordPress sessions after patching to force reauthentication
Patch Information
The vendor addressed the issue in the plugin trunk via Change Set #3186303 for Payment Buttons and the corresponding Change Set #3186303 for Subscription Buttons. The fix adds esc_url escaping around the URLs returned by add_query_arg and remove_query_arg. Site owners should upgrade through the WordPress plugin updater. Additional context is available in the Wordfence Vulnerability Intel Report.
Workarounds
- Deactivate the Razorpay Payment Button Plugin until the patched version is installed
- Deploy a web application firewall rule that blocks reflected XSS payloads targeting the affected plugin paths
- Enforce a strict Content Security Policy that disallows inline scripts on WordPress pages
# Update the plugin using WP-CLI
wp plugin update razorpay-payment-button
# Verify the installed version is greater than 2.4.6
wp plugin get razorpay-payment-button --field=version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

