Arbitrary File Read
Introduction
This article covers cases of possible Arbitrary File Read on WordPress. This includes improper file fetch handling inside of the plugin/theme which can be used to read arbitrary local files inside of the server.
Useful Functions
Several functions could be useful to identify a possible Arbitrary File Read vulnerability:
-
PHP related
-
WordPress related
Example Cases
Below is an example of vulnerable code:
To exploit this, any authenticated user just needs to perform a POST request to the /wp-admin/admin-ajax.php
endpoint specifying the needed parameter to trigger the WP_Filesystem_Direct::get_contents
function.
Below are some of the findings related to Arbitrary File Read: