Latest Post Shortcode <= 14.2.1 - Missing Authorization
Description
The Latest Post Shortcode plugin for WordPress is vulnerable to unauthorized access due to a missing capability check on a function in versions up to, and including, 14.2.1. This makes it possible for unauthenticated attackers to perform an unauthorized action.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:NTechnical Details
<=14.2.1What Changed in the Fix
Changes introduced in v14.2.2
Source Code
WordPress.org SVNThis research plan targets a missing authorization vulnerability in the **Latest Post Shortcode** plugin (CVE-2026-31916). Based on the provided source code and patch analysis, the vulnerability exists in an AJAX handler responsible for saving settings from the plugin's "Settings Modal," which is re…
Show full research plan
This research plan targets a missing authorization vulnerability in the Latest Post Shortcode plugin (CVE-2026-31916). Based on the provided source code and patch analysis, the vulnerability exists in an AJAX handler responsible for saving settings from the plugin's "Settings Modal," which is registered for unauthenticated users without capability checks.
1. Vulnerability Summary
- Vulnerability: Missing Authorization (Unauthenticated Settings Modification)
- Location: Likely a function named
lps_save_settings(inferred) within theLatest_Post_Shortcodeor anAdminclass. - Affected Version: <= 14.2.1
- Why it exists: The plugin registers an AJAX action for both authenticated and unauthenticated (
nopriv) users to save modal settings but fails to perform acurrent_user_can('manage_options')check inside the handler. This allows any user to modify plugin-wide configurations.
2. Attack Vector Analysis
- Endpoint:
/wp-admin/admin-ajax.php - Action:
lps_save_settings(inferred) - Payload Parameter:
settings(carrying the configuration data) - Nonce Parameter:
verify(verified against the actionlps-modal-actions) - Authentication: None Required (
noprivhook) - Preconditions: An attacker must obtain a valid nonce for the
lps-modal-actionsaction, which is often leaked on pages where the plugin's assets are enqueued.
3. Code Flow
- Entry Point: An unauthenticated user sends a POST request to
admin-ajax.phpwith the actionlps_save_settings. - Hook Registration: The plugin (in the main file, not provided) likely contains:
add_action( 'wp_ajax_nopriv_lps_save_settings', [ $this, 'lps_save_settings' ] ); - Nonce Verification: The handler calls
check_ajax_referer( 'lps-modal-actions', 'verify' );. - Vulnerable Sink: The handler proceeds to update options using
update_option()based on thesettingsparameter without checking if the user has themanage_optionscapability.
4. Nonce Acquisition Strategy
The nonce lps-modal-actions is generated in incs/assets.php inside the use_script_modal() function and localized into the lpsGenVars JavaScript object.
- Localization Key:
lpsGenVars - Nonce Key:
verify - Strategy:
- Create a page with the plugin's primary shortcode to trigger asset
Summary
The Latest Post Shortcode plugin for WordPress is vulnerable to unauthorized settings modification due to a missing capability check in an AJAX handler registered for unauthenticated users. This allows an attacker to obtain a valid nonce from the front-end and send a crafted request to modify the plugin's configuration settings.
Vulnerable Code
// incs/assets.php line 132 function use_script_modal() { if ( ! \wp_script_is( 'lps-admin-shortcode-button' ) ) { $lps = \Latest_Post_Shortcode::get_instance(); \wp_register_script( 'lps-admin-shortcode-button', LPS_PLUGIN_URL . 'assets/modal.js', [ 'jquery' ], ver(), false ); \wp_localize_script( 'lps-admin-shortcode-button', 'lpsGenVars', [ 'ajaxUrl' => \admin_url( 'admin-ajax.php' ), 'verify' => \wp_create_nonce( 'lps-modal-actions' ), 'icon' => LPS_PLUGIN_URL . 'assets/images/icon-purple.svg', 'title' => \esc_html__( 'Latest Post Shortcode', 'lps' ), 'outputTypes' => implode( ' ', array_filter( array_keys( $lps::get_card_output_types() ) ) ), 'allowIcon' => $lps::allow_icon_for_roles(), ] ); \wp_enqueue_script( 'lps-admin-shortcode-button' ); } }
Security Fix
@@ -1,5 +1,12 @@ == Changelog == += 14.2.1 = +* Tested up to 6.9 +* Styles changes to allow for gradient as card background +* Fixed the mood toggle when the card background color changes +* Bundler output files with functions assigned to window (global variable) +* Fixed the cache reset vunerability + = 14.2.0 = * Tested up to 6.8.3 * PHP 8.4 compatibility @@ -1,4 +1,4 @@ -<?php //phpcs:ignore Generic.Files.LineEndings.InvalidEOLChar +<?php // phpcs:disable Generic.Files.LineEndings.InvalidEOLChar /** * Latest Post Shortcode slider output. * Text Domain: lps @@ -6,12 +6,13 @@ * @package lps */ +// phpcs:disable WordPress.WP.I18n.TextDomainMismatch +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound + declare( strict_types = 1 ); namespace LPS; -if ( ! defined( 'ABSPATH' ) ) { - exit; // Exit if accessed directly. -} +defined( 'ABSPATH' ) || exit; \add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\\use_script_inline', 0 ); \add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\use_script_inline', 0 ); ... (truncated at 18000 of 112549 chars — patch_diff)
Exploit Outline
The exploit targets an unauthenticated AJAX action that saves plugin settings. First, an attacker accesses any page where the plugin's modal assets are loaded to retrieve a valid nonce for the 'lps-modal-actions' action from the localized 'lpsGenVars' JavaScript object. Using this nonce, the attacker sends a POST request to '/wp-admin/admin-ajax.php' with the 'action' parameter set to the settings-saving handler (likely 'lps_save_settings') and the 'verify' parameter containing the nonce. The payload includes a 'settings' parameter with malicious configuration data. Because the handler is registered with 'wp_ajax_nopriv_' and fails to verify the 'manage_options' capability, it processes the request and updates the plugin's global options.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.