Autoshare for Twitter <= 2.3.1 - Missing Authorization
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:NTechnical Details
<=2.3.1What Changed in the Fix
Changes introduced in v2.3.2
Source Code
WordPress.org SVN# 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_idmust 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
- Entry Point: A Subscriber user sends a POST request to
admin-ajax.phpwithaction=tenup_autoshare_retweet. - Hook Registration:
includes/admin/post-transition.phpdefines:add_action( 'wp_ajax_tenup_autoshare_retweet', __NAMESPACE__ . '\retweet', 10, 3 ); - Nonce Verification: The
retweet()function verifies the nonce:
Note: Any logged-in user can obtain aif ( ! 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' ) ); }wp_restnonce as it is used by the core WordPress REST API. - Missing Authorization: There is no call to
current_user_can(). - Execution Sink: The code calls
publish_tweet($post_id, true):
The$is_retweeted = publish_tweet( $post_id, true );trueargument forces the tweet to be sent even if autoshare was disabled for that specific post. - Side Effects:
publish_tweetattempts to compose a tweet and send it via thePublish_Tweetclass, eventually callingupdate_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.
- Access Level: Login as a Subscriber user.
- Navigate: Go to any page in the WordPress admin dashboard (e.g.,
/wp-admin/profile.php). - Extract: Use the
browser_evaltool to extract the nonce from the global WordPress JavaScript objects.- Target Variable:
window.wpApiSettings.nonce - Alternative: If
wpApiSettingsis not available, look for anywp_localize_scriptoutput in the page source containing anoncekey.
- Target Variable:
- Command:
browser_eval("window.wpApiSettings?.nonce")
5. Exploitation Strategy
Step-by-Step Plan
- Create Target Content: Create a post with ID
Xas an Administrator. - Setup Attacker: Create a Subscriber-level user.
- Obtain Nonce: Log in as the Subscriber and use
browser_evalto grab thewp_restnonce. - Trigger Unauthorized Action: Use the
http_requesttool 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');inwp-config.phpor 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
- 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 - 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 - 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.
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
@@ -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.