Server Side Request Forgery (SSRF)
Introduction
This article covers ways to secure the code from Server Side Request Forgery vulnerability. This includes applying a proper function to check for the userβs input.
How to secure
If the plugin or theme needs to fetch or perform a request to an external URL, we can use WordPress built-in functions depending on the HTTP methods such as:
The above functions will mostly protect from SSRF vulnerability and deny access to an internal service. However, please note that the above functions currently are not 100% secure and have some rare cases that still allow for internal service access. Please refer to this article:
With that mentioned, we recommend not trusting the entire URL string to the userβs input and applying some limitations before passing the URL to the above functions: