CVE-2023-45652: Path Traversal Vulnerability in Justin Silver Remote Content Shortcode Leads To PHP Local File Inclusion

A troubling Path Traversal vulnerability (CVE-2023-45652) has been discovered in the Justin Silver Remote Content Shortcode WordPress plugin, which allows PHP Local File Inclusion (LFI). This security issue resides in the improper limitation of a pathname to a restricted directory. As a result, attackers can exploit this vulnerability to access sensitive information and even execute malicious code on the underlying web server. This blog post provides a detailed analysis of CVE-2023-45652, including code snippets and links to original references, helping web administrators better understand the nature of this exploit and apply appropriate countermeasures.

Affected Versions

Justin Silver Remote Content Shortcode plugin versions n/a to 1.5 are impacted by this vulnerability.

Exploit Details

The vulnerability stems from the way the plugin handles user-supplied input while fetching remote content. Specifically, it fails to restrict the allowed file types and adequate path sanitization, ultimately leading to path traversal attacks and local file inclusion.

Here is the vulnerable code snippet from the plugin

function remote_content_shortcode($atts) {
    extract(shortcode_atts(array(
        'url' => '',
        'selector' => '',
        'strip' => 'false',
        'timeout' => 500,
        'es'    => false,
        'et'    => '',
    ), $atts, 'remote_content'));

    if (empty($url)) {
        return "<!-- URL is required. -->";
    }

    ob_start()
    include($url); // vulnerable code
    ...
}

As seen above, the $url parameter lacks any filtering or validation, allowing attackers to use path traversal strings and access sensitive files. To exploit this vulnerability, attackers can create a shortcode with the url parameter set to the path of a local file they want to include. For example:

[remote_content url="../../../../../../../../../etc/passwd"]

Using this crafted shortcode, an attacker can include the /etc/passwd file on a Linux server or other sensitive files.

Mitigation

Currently, there is no official patch available for this vulnerability. However, users can take the following steps to work around this issue until a proper fix is provided:

1. Disable or remove the Justin Silver Remote Content Shortcode plugin from your WordPress installation.

Contact the plugin author to request an update that addresses this issue.

3. Implement a web application firewall (WAF) to block requests containing malicious payloads targeting this vulnerability.

1. CVE-2023-45652 Record: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-45652

2. Justin Silver Remote Content Shortcode Plugin: https://wordpress.org/plugins/remote-content-shortcode/

3. Path Traversal Exploit Explained: https://owasp.org/www-community/attacks/Path_Traversal

4. PHP Local File Inclusion Explained: https://www.acunetix.com/blog/articles/local-file-inclusion-lfi/

Conclusion

This blog post has provided an in-depth look at the Path Traversal vulnerability (CVE-2023-45652) in the Justin Silver Remote Content Shortcode plugin, affecting versions n/a to 1.5. By understanding the exploit details and applying appropriate workarounds, site administrators can better protect their WordPress installations against this security issue.

Timeline

Published on: 05/17/2024 09:15:08 UTC
Last modified on: 06/04/2024 17:19:59 UTC