Project: Wordpress Plugin Jetpack by WordPress.com 6.6.1

Vulnerability: #9217790 (2018-10-30 09:00:27)

Warning

There are many false positives, or unexploitable vulnerabilities. Please create working "PoC" exploit before reporting anything to vendor!

Details:

Sink Standard::http_build_query
Risk _POST
/jetpack/class.jetpack.php:5459 (show/hide source)
5439  			$user = new WP_User( $user_id );
5440  			if ( ! $user || ! $user->exists() ) {
5441  				return false;
5442  			}
5443  		}
5444  
5445  		$token = Jetpack_Data::get_access_token( $user_id );
5446  		if ( ! $token ) {
5447  			return false;
5448  		}
5449  
5450  		$token_check = "$token_key.";
5451  		if ( ! hash_equals( substr( $token->secret, 0, strlen( $token_check ) ), $token_check ) ) {
5452  			return false;
5453  		}
5454  
5455  		require_once JETPACK__PLUGIN_DIR . 'class.jetpack-signature.php';
5456  
5457  		$jetpack_signature = new Jetpack_Signature( $token->secret, (int) Jetpack_Options::get_option( 'time_diff' ) );
5458  		if ( isset( $_POST['_jetpack_is_multipart'] ) ) {
5459 $post_data = $_POST;
5460 $file_hashes = array(); 5461 foreach ( $post_data as $post_data_key => $post_data_value ) {
Threat level 1

Callstack:

Jetpack::verify_xml_rpc_signature /jetpack/class.jetpack.php:5476 (show/hide source)
5456  
5457  		$jetpack_signature = new Jetpack_Signature( $token->secret, (int) Jetpack_Options::get_option( 'time_diff' ) );
5458  		if ( isset( $_POST['_jetpack_is_multipart'] ) ) {
5459  			$post_data   = $_POST;
5460  			$file_hashes = array();
5461  			foreach ( $post_data as $post_data_key => $post_data_value ) {
5462  				if ( 0 !== strpos( $post_data_key, '_jetpack_file_hmac_' ) ) {
5463  					continue;
5464  				}
5465  				$post_data_key = substr( $post_data_key, strlen( '_jetpack_file_hmac_' ) );
5466  				$file_hashes[$post_data_key] = $post_data_value;
5467  			}
5468  
5469  			foreach ( $file_hashes as $post_data_key => $post_data_value ) {
5470  				unset( $post_data["_jetpack_file_hmac_{$post_data_key}"] );
5471  				$post_data[$post_data_key] = $post_data_value;
5472  			}
5473  
5474  			ksort( $post_data );
5475  
5476 $body = http_build_query( stripslashes_deep( $post_data ) );
5477 } elseif ( is_null( $this->HTTP_RAW_POST_DATA ) ) { 5478 $body = file_get_contents( 'php://input' );
Jetpack::__construct /jetpack/class.jetpack.php:556 (show/hide source)
536  		add_action( 'init', array( $this, 'load_jetpack_gutenberg' ) );
537  
538  		add_action( 'set_user_role', array( $this, 'maybe_clear_other_linked_admins_transient' ), 10, 3 );
539  
540  		// Unlink user before deleting the user from .com
541  		add_action( 'deleted_user', array( $this, 'unlink_user' ), 10, 1 );
542  		add_action( 'remove_user_from_blog', array( $this, 'unlink_user' ), 10, 1 );
543  
544  		if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST && isset( $_GET['for'] ) && 'jetpack' == $_GET['for'] ) {
545  			@ini_set( 'display_errors', false ); // Display errors can cause the XML to be not well formed.
546  
547  			require_once JETPACK__PLUGIN_DIR . 'class.jetpack-xmlrpc-server.php';
548  			$this->xmlrpc_server = new Jetpack_XMLRPC_Server();
549  
550  			$this->require_jetpack_authentication();
551  
552  			if ( Jetpack::is_active() ) {
553  				// Hack to preserve $HTTP_RAW_POST_DATA
554  				add_filter( 'xmlrpc_methods', array( $this, 'xmlrpc_methods' ) );
555  
556 $signed = $this->verify_xml_rpc_signature();
557 if ( $signed && ! is_wp_error( $signed ) ) { 558 // The actual API methods.
Jetpack::init /jetpack/class.jetpack.php:352 (show/hide source)
332  	public $json_api_authorization_request = array();
333  
334  	/**
335  	 * @var string Transient key used to prevent multiple simultaneous plugin upgrades
336  	 */
337  	public static $plugin_upgrade_lock_key = 'jetpack_upgrade_lock';
338  
339  	/**
340  	 * Holds the singleton instance of this class
341  	 * @since 2.3.3
342  	 * @var Jetpack
343  	 */
344  	static $instance = false;
345  
346  	/**
347  	 * Singleton
348  	 * @static
349  	 */
350  	public static function init() {
351  		if ( ! self::$instance ) {
352 self::$instance = new Jetpack;
353 354 self::$instance->plugin_upgrade();
Jetpack::deactivate_module /jetpack/class.jetpack.php:3011 (show/hide source)
2991  		if ( $exit ) {
2992  			exit;
2993  		}
2994  		return true;
2995  	}
2996  
2997  	function activate_module_actions( $module ) {
2998  		_deprecated_function( __METHOD__, 'jetpack-4.2' );
2999  	}
3000  
3001  	public static function deactivate_module( $module ) {
3002  		/**
3003  		 * Fires when a module is deactivated.
3004  		 *
3005  		 * @since 1.9.0
3006  		 *
3007  		 * @param string $module Module slug.
3008  		 */
3009  		do_action( 'jetpack_pre_deactivate_module', $module );
3010  
3011 $jetpack = Jetpack::init();
3012 3013 $active = Jetpack::get_active_modules();
Jetpack_Protect_Module::is_current_ip_whitelisted /jetpack/modules/protect.php:479 (show/hide source)
459  
460  			$status = $response['status'];
461  		}
462  
463  		if ( 'blocked' == $status ) {
464  			$this->block_with_math();
465  		}
466  
467  		if ( 'blocked-hard' == $status ) {
468  			$this->kill_login();
469  		}
470  
471  		return true;
472  	}
473  
474  	function is_current_ip_whitelisted() {
475  		$ip = jetpack_protect_get_ip();
476  
477  		// Server is misconfigured and we can't get an IP
478  		if ( ! $ip && class_exists( 'Jetpack' ) ) {
479 Jetpack::deactivate_module( 'protect' );
480 ob_start(); 481 Jetpack::state( 'message', 'protect_misconfigured_ip' );
Jetpack_Protect_Module::check_login_ability /jetpack/modules/protect.php:442 (show/hide source)
422  
423  		return false;
424  	}
425  
426  	/**
427  	 * Checks the status for a given IP. API results are cached as transients
428  	 *
429  	 * @param bool $preauth Whether or not we are checking prior to authorization
430  	 *
431  	 * @return bool Either returns true, fires $this->kill_login, or includes a math fallback and returns false
432  	 */
433  	function check_login_ability( $preauth = false ) {
434  
435  		/**
436  		 * JETPACK_ALWAYS_PROTECT_LOGIN will always disable the login page, and use a page provided by Jetpack.
437  		 */
438  		if ( Jetpack_Constants::is_true( 'JETPACK_ALWAYS_PROTECT_LOGIN' ) ) {
439  			$this->kill_login();
440  		}
441  
442 if ( $this->is_current_ip_whitelisted() ) {
443 return true; 444 }
@INLINE::/jetpack/modules/protect.php /jetpack/modules/protect.php:916 (show/hide source)
896  		$domain = $uridata['host'];
897  
898  		// If we still don't have the site_url, get it
899  		if ( ! $domain ) {
900  			$uri     = get_site_url( 1 );
901  			$uridata = parse_url( $uri );
902  			$domain  = $uridata['host'];
903  		}
904  
905  		$this->local_host = $domain;
906  
907  		return $this->local_host;
908  	}
909  
910  }
911  
912  $jetpack_protect = Jetpack_Protect_Module::instance();
913  
914  global $pagenow;
915  if ( isset( $pagenow ) && 'wp-login.php' == $pagenow ) {
916 $jetpack_protect->check_login_ability();
917 }