PHP SSRF
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
SSRF PHP functions
Some function such as file_get_contents(), fopen(), file(), md5_file() accept URLs as input that they will follow making possible SSRF vulnerabilities if the use can control the data:
Wordpress SSRF via DNS Rebinding
As explained in this blog post, even the Wordpress function wp_safe_remote_get
is vulnerable to DNS rebinding, making it potentially vulnerable to SSRF attacks. The main validation it calls is wp_http_validate_url, which checks that the protocol is http://
or https://
and that the port is one of 80, 443, and 8080, but it's vulnerable to DNS rebinding.
Other vulnerable functions according to the post are:
wp_safe_remote_request()
wp_safe_remote_post()
wp_safe_remote_head()
WP_REST_URL_Details_Controller::get_remote_url()
download_url()
wp_remote_fopen()
WP_oEmbed::discover()
CRLF
Moreover, in some cases it might be even possible to send arbitrary headers via CRLF "vulnerabilities" in the previous functions:
For more info about that CRLF vuln, check this bug https://bugs.php.net/bug.php?id=81680&edit=1
Note that these function might have other methods to set arbitrary headers in requests, like:
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Last updated