|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-07-22 21:13 UTC] geeknik at protonmail dot ch
Description:
------------
I believe that I have found a server side request forgery bug in exif_read_data().
From machine A:
php-7.2.8 -r 'exif_read_data(file_get_contents("http://dtf.pw/php728/poc/722/http.jpeg"));'
The http.jpeg on Machine B starts with http://@2328211425:8000, which ip2long converts into an IP I happen to control, aka Machine C.
And if we look at the console over on Machine C:
Serving HTTP on 0.0.0.0 port 8000 ...
138.68.249.154 - - [22/Jul/2018 19:05:18] code 404, message File not found
138.68.249.154 - - [22/Jul/2018 19:05:18] "GET //c&_▒ HTTP/1.0" 404 -
Machine A never contacts Machine C directly but as soon as Machine A requests the "jpeg" from Machine B, a request is simultaneously sent to Machine C.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 10:00:02 2025 UTC |
> A is where the php request originates, B is where the "jpeg" > resides, and when A requests that "jpeg" from B, a request from A > is logged on C. This is expected. file_get_contents() retrieves the “image”, and passes its result to exif_read_data(), which accepts stream wrapper URLs as of PHP 7.2.0. So, basically, this is like file_get_contents("http://dtf.pw/php728/poc/722/http.jpeg"); exif_read_data('http://@2328211425:8000'); Since this doesn't trigger a request from B to C, I don't see a problem here.