Symfony2 security issue when the trust proxy mode is enabledGHSA-vfm6-r2gc-pwww
Fix: symfony/http-foundation@5cde522GHSA-vfm6-r2gc-pwww is a security vulnerability in symfony/http-foundation. A fix is available for symfony/http-foundation — see the affected versions and patch details below.
Real-World Exposure
symfony/http-foundation🐘symfony/http-foundation🐘symfony/symfony🐘symfony/symfonyReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
An application is vulnerable if it uses the client IP address as returned by the Request::getClientIp() method for sensitive decisions like IP based access control.
To fix this security issue, the following changes have been made to all versions of Symfony2:
A new Request::setTrustedProxies() method has been introduced and should be used intead of Request::trustProxyData() to enable the trust proxy mode. It takes an array of trusted proxy IP addresses as its argument:
// before (probably in your front controller script)
Request::trustProxyData();
// after
Request::setTrustedProxies(array('1.1.1.1'));
// 1.1.1.1 being the IP address of a trusted reverse proxy
The Request::trustProxyData() method has been deprecated (when used, it automatically trusts the latest proxy in the chain -- which is the current remote address):
Request::trustProxyData();
// is equivalent to
Request::setTrustedProxies(array($request->server->get('REMOTE_ADDR')));
We encourage all Symfony2 users to upgrade as soon as possible. It you don't want to upgrade to the latest version yet, you can also apply the following patches:
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | symfony/http-foundation | ≥ 2.0.0&&< 2.0.19 | 2.0.19composer require symfony/http-foundation:^2.0.19 |
| 🐘Packagist | symfony/http-foundation | ≥ 2.1.0&&< 2.1.4 | 2.1.4composer require symfony/http-foundation:^2.1.4 |
| 🐘Packagist | symfony/symfony | ≥ 2.0.0&&< 2.0.19 | 2.0.19composer require symfony/symfony:^2.0.19 |
| 🐘Packagist | symfony/symfony | ≥ 2.1.0&&< 2.1.4 | 2.1.4composer require symfony/symfony:^2.1.4 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for symfony/http-foundation, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update symfony/http-foundation to 2.0.19 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-vfm6-r2gc-pwww is resolved across your whole dependency graph.
Workarounds
Put an independent control in front of the weakness: restrict the affected endpoint or interface to trusted networks, require an additional authentication factor or proxy-level check, and invalidate existing sessions and credentials in case the flaw has already been used.
Frequently Asked Questions
Is GHSA-vfm6-r2gc-pwww in your dependencies?
Find it across Packagist, including transitive dependencies.