18 Jun

Our Proactive Monitoring Caught a Local File Inclusion (LFI) Vulnerability Being Added in to Sina Extension for Elementor

One of the ways we help to improve the security of WordPress plugins, not just for our customers of our service, but for everyone using them, is our proactive monitoring of changes made to plugins in the Plugin Directory to try to catch serious vulnerabilities. Through that we caught a local file inclusion (LFI) vulnerability being added in to the plugin Sina Extension for Elementor.

The possibility of this vulnerability is also flagged by our Plugin Security Checker, so you can check plugins you use to see if they might have similar issues with that tool.

The plugin registers the function to be accessible through the AJAX functionality of WordPress to those logged in to WordPress as well those not logged in:

11
12
add_action( 'wp_ajax_sina_load_more_posts', 'sina_ajax_load_more_posts' );
add_action( 'wp_ajax_nopriv_sina_load_more_posts', 'sina_ajax_load_more_posts' );

The relevant portion of that function, which is located in the file /inc/hooks.php, is as follows in the latest version of the plugin:

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
function sina_ajax_load_more_posts() {
	if ( check_ajax_referer( 'sina_load_more_posts', 'nonce') && wp_verify_nonce( $_POST['nonce'], 'sina_load_more_posts' ) ) {
 
		$default = [
			'cat'				=> sanitize_text_field( $_POST['categories'] ),
			'posts_per_page'	=> (int) sanitize_text_field( $_POST['posts_num'] ),
			'offset'			=> (int) sanitize_text_field( $_POST['offset'] ),
			'has_password'		=> false,
			'post_status'		=> 'publish',
			'post__not_in'		=> get_option( 'sticky_posts' ),
		];
		$columns = sanitize_text_field( $_POST['columns'] );
		$excerpt = sanitize_text_field( $_POST['excerpt'] );
		$content_length = (int) sanitize_text_field( $_POST['content_length'] );
		$posts_meta = sanitize_text_field( $_POST['posts_meta'] );
		$layout = sanitize_text_field( $_POST['layout'] );
		$thumb_right = sanitize_text_field( $_POST['thumb_right'] );
 
		// Post Query
		$post_query = new WP_Query( $default );
 
		if ( $post_query->have_posts() ) {
			?>
			<div class="sina-ajax-posts">
				<?php include SINA_EXT_LAYOUT.'/blogpost/'.$layout.'.php'; ?>

That will take the value the POST input “layout”, sanitize it using sanitize_text_field(), and set it to the value of the variable $layout:

94
$layout = sanitize_text_field( $_POST['layout'] );

That variable is then used to specify a file to be included:

103
<?php include SINA_EXT_LAYOUT.'/blogpost/'.$layout.'.php'; ?>

Through the use of directory traversal arbitrary files can be included.

The proper way to sanitize that would be using something like using pathinfo() to get the filename by itself.

There is a nonce check, so for that to exploitable a hacker would have to have access to a frontend page where the Sina Blog Post Widget from this plugin was showing a Load More button.

Due to the moderators of the WordPress Support Forum’s continued inappropriate behavior we are full disclosing vulnerabilities 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. 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).

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.

Modify the AJAX request sent when clicking the Load More button on a Sina Blog Post Widget to change the value of the “layout” input to “../../../../../../test”.


Concerned About The Security of the Plugins You Use?

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

Leave a Reply

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