-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Potential security vulnerability #5374
Comments
@SteveTalbot Please, never, never, never report potential security issues on a public tracker. Our README clearly details how to report security issues (tl;dr: email to [email protected]). In the meantime, I've removed the contents of the report until we can review and patch the issue. |
Apologies --- to avoid anyone else doing the same, it'd be helpful to add the zf-security e-mail address to https://github.com/zendframework/zf2/blob/master/CONTRIBUTING.md, which is linked from the "New Issue" page on GitHub. |
@SteveTalbot Definitely, we'll be updating the readme and contributing documents to make this as apparent as possible. Thank you. |
Patches have been reviewed, and I've applied in my local branch. I'll be pushing shortly, and will release with 2.2.5 later today. |
Security fix for `Zend\Http\PhpEnvironment\RemoteAddress`. Fixes #5374
Forward port #5374 (`RemoteAddress` security fix) Conflicts: README.md
- Ensured they were testing what they should, based on the changes to Zend\Http\PhpEnvironment\RemoteAddress
Fix CS and testing issues introduced by security fix for #5374
Forward-ports testing and CS fixes for #5374
Security fix for `Zend\Http\PhpEnvironment\RemoteAddress`. Fixes zendframework/zendframework#5374
Forward port zendframework/zendframework#5374 (`RemoteAddress` security fix) Conflicts: README.md
- trailing whitespace
Fix CS and testing issues introduced by security fix for zendframework/zendframework#5374
Forward-ports testing and CS fixes for zendframework/zendframework#5374
…or tests - Ensured they were testing what they should, based on the changes to Zend\Http\PhpEnvironment\RemoteAddress
Fix CS and testing issues introduced by security fix for zendframework/zendframework#5374
Forward-ports testing and CS fixes for zendframework/zendframework#5374
Note: A fix now exists in both master and develop, and has been released with 2.2.5
The
X-Forwarded-For
header is a comma-separated list of IPaddresses, where the leftmost is the original client and the others
are successive proxies or load balancers. The address of the last
proxy is the apparent source IP address, in
`````` $_SERVER['REMOTE_ADDR']```.
In
Zend\Http\PhpEnvironment\RemoteAddress
, when$useProxy
is set to true, the
getIpAddressFromProxy()
function does notcheck whether
$_SERVER['REMOTE_ADDR']
is one of the trustedproxies. Hence if the client is not behind a trusted proxy and spoofs
the
X-Forwarded-For
header, this function will return a spoofedIP address.
This allows a session hijacking attack because of the way
Zend\Http\PhpEnvironment\RemoteAddress
is used in theZend\Session\Validator\RemoteAddr
session validator.I think it would be safer to replace the start of the function as follows:
So if the source IP address is not a trusted proxy,
getIpAddressFromProxy()
would return false andgetIpAddress()
function would return$_SERVER['REMOTE_ADDR']
, which I think is more desirablebehaviour.
The text was updated successfully, but these errors were encountered: