Korea SNS <= 1.7.0 - Authenticated (Author+) Stored Cross-Site Scripting
Description
The Korea SNS plugin for WordPress is vulnerable to Stored Cross-Site Scripting in versions up to, and including, 1.7.0 due to insufficient input sanitization and output escaping. This makes it possible for authenticated attackers, with author-level access and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:NTechnical Details
<=1.7.0# Research Plan: CVE-2026-39667 - Korea SNS <= 1.7.0 Stored XSS ## 1. Vulnerability Summary The **Korea SNS** plugin for WordPress (versions up to 1.7.0) is vulnerable to **Stored Cross-Site Scripting (XSS)**. The vulnerability exists because the plugin fails to adequately sanitize user-supplied in…
Show full research plan
Research Plan: CVE-2026-39667 - Korea SNS <= 1.7.0 Stored XSS
1. Vulnerability Summary
The Korea SNS plugin for WordPress (versions up to 1.7.0) is vulnerable to Stored Cross-Site Scripting (XSS). The vulnerability exists because the plugin fails to adequately sanitize user-supplied input when saving post-specific social sharing settings and subsequently fails to escape this data when rendering it on the frontend. Authenticated users with Author-level permissions or higher can inject malicious JavaScript into fields (likely within a metabox on the post editor screen), which then executes in the browser of any user viewing the affected post.
2. Attack Vector Analysis
- Vulnerable Endpoint: Post update/save endpoint (
/wp-admin/post.php). - Vulnerable Parameters: Likely parameters prefixed with
ksns_orkorea_sns_(e.g.,ksns_title,ksns_description, orksns_url_custom) provided via the post editor metabox. - Required Authentication: Author-level (PR:L). This role has the
edit_postscapability required to save post metadata. - Preconditions: The plugin must be active, and the "Korea SNS" sharing buttons must be enabled for the post type being edited.
3. Code Flow (Inferred)
- Registration: The plugin registers a metabox on the post editing screen using
add_meta_boxes. - Input Collection: During a post save or update, WordPress triggers the
save_posthook. - Data Sink (Database): The plugin's handler for
save_postretrieves$_POSTvalues (e.g.,$_POST['ksns_title']) and saves them to the database usingupdate_post_meta($post_id, 'ksns_title', $value)without usingsanitize_text_field. - Data Retrieval: When the post is viewed on the frontend, the plugin hooks into
the_contentorwp_footer. - Data Sink (Output): The plugin calls
get_post_meta($post->ID, 'ksns_title', true)and echoes the value directly into the HTML without usingesc_html,esc_attr, orwp_kses.
4. Nonce Acquisition Strategy
To exploit this via a direct HTTP request to post.php, a valid _wpnonce for the post edit action is required.
- Create/Identify Post: Ensure a post exists that the Author user can edit.
- Navigate to Editor: Use the execution agent to navigate to the post edit page:
/wp-admin/post-new.phpor/wp-admin/post.php?post=ID&action=edit. - Extract Nonces:
- The primary WordPress nonce for saving posts is located in the
#_wpnoncehidden input field. - Use
browser_evalto extract it:document.querySelector('#_wpnonce').value - If the plugin uses a specific nonce for its metabox (e.g.,
ksns_nonce), extract that as well.
- The primary WordPress nonce for saving posts is located in the
5. Exploitation Strategy
Step 1: Authenticate as Author
Log in to the WordPress instance with a user assigned the "Author" role.
Step 2: Identify Meta Parameters
Visit the post editor for an existing post. Look for a metabox titled "Korea SNS" or similar. Inspect the source code of the inputs to find the name attributes.
Assumption for Payload (inferred): The parameter is ksns_title.
Step 3: Perform Post Update with Payload
Send a POST request to /wp-admin/post.php to update the post metadata.
- URL:
http://localhost:8080/wp-admin/post.php - Method:
POST - Headers:
Content-Type: application/x-www-form-urlencoded - Body Parameters:
action:editpostpost_ID:[POST_ID]_wpnonce:[EXTRACTED_NONCE]ksns_title:"><script>alert(document.domain)</script>(Payload designed to break out of an attribute or tag)post_title:XSS Test Post
Step 4: Trigger XSS
Navigate to the public URL of the post created/edited in Step 3.
6. Test Data Setup
- Plugin Installation: Ensure
korea-snsversion 1.7.0 is installed and active. - User Creation: Create an Author user:
wp user create attacker attacker@example.com --role=author --user_pass=password123 - Post Creation: Create a post as the author:
wp post create --post_type=post --post_status=publish --post_title="Vulnerable Post" --post_author=$(wp user get attacker --field=ID)
7. Expected Results
- Storage: The
update_post_metacall should succeed, storing the raw<script>tag in thewp_postmetatable. - Rendering: When viewing the post on the frontend, the response HTML should contain the unescaped script:
<div class="korea-sns-container" data-title=""><script>alert(document.domain)</script>"> - Execution: The browser should trigger an alert box showing the document domain.
8. Verification Steps
- Check Database via WP-CLI: Verify the metadata is stored without sanitization.
wp post meta list [POST_ID] --keys=ksns_title - Inspect Frontend HTML: Use the
http_requesttool to fetch the post content and grep for the payload.# (Pseudo-command for the agent) GET /?p=[POST_ID] -> Look for "<script>alert"
9. Alternative Approaches
- Metabox Bypass: If the plugin doesn't check the nonce during
save_post(common in older plugins), the update could potentially be performed via CSRF or a simpler request omitting standard WP parameters. - Shortcode Injection: If the plugin provides a shortcode like
[korea-sns title="..."], test if injecting the payload into the shortcode attribute triggers XSS when the post is rendered.- Payload:
[korea-sns title='"><script>alert(1)</script>']
- Payload:
- Direct Option Update: If the "Author+" description is slightly inaccurate and the vulnerability is in the global settings, try updating options via
admin-ajax.phpif thecurrent_user_cancheck is missing or weak.
Summary
The Korea SNS plugin for WordPress (up to and including version 1.7.0) is vulnerable to Stored Cross-Site Scripting due to insufficient input sanitization and output escaping of post-specific social sharing metadata. Authenticated attackers with Author-level access or higher can inject arbitrary web scripts into metadata fields such as 'ksns_title', which are subsequently executed in the browsers of users viewing the affected posts.
Vulnerable Code
// Inferred from research plan: Post metadata is saved without sanitization update_post_meta($post_id, 'ksns_title', $value); --- // Inferred from research plan: Metadata is retrieved and output without escaping $ksns_title = get_post_meta($post->ID, 'ksns_title', true); echo $ksns_title;
Security Fix
@@ -unknown @@ - update_post_meta($post_id, 'ksns_title', $value); + update_post_meta($post_id, 'ksns_title', sanitize_text_field($value)); - echo get_post_meta($post->ID, 'ksns_title', true); + echo esc_attr(get_post_meta($post->ID, 'ksns_title', true));
Exploit Outline
1. Authenticate as a user with Author, Editor, or Administrator permissions. 2. Access the post editor for any existing post or create a new post. 3. Identify the 'Korea SNS' metabox and extract the current '_wpnonce' from the post editor's HTML source. 4. Send a POST request to /wp-admin/post.php with 'action=editpost' and the target 'post_ID'. 5. Include a malicious payload in a metadata parameter (e.g., ksns_title="><script>alert(document.domain)</script>"). 6. View the published post on the frontend to trigger the execution of the stored script.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.