mezzio-swoole Applications Using Diactoros Vulnerable to HTTP Host Header AttackGHSA-c8rp-cgf4-937w
GHSA-c8rp-cgf4-937w is a security vulnerability in mezzio/mezzio-swoole. A fix is available for mezzio/mezzio-swoole — see the affected versions and patch details below.
Real-World Exposure
mezzio/mezzio-swoole🐘mezzio/mezzio-swooleReal-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
Impact
mezzio-swoole applications using Diactoros for their PSR-7 implementation, and which are either not behind a proxy, or can be accessed via untrusted proxies, can potentially have the host, protocol, and/or port of a Laminas\Diactoros\Uri instance associated with the incoming server request modified to reflect values from X-Forwarded-* headers. Such changes can potentially lead to XSS attacks (if a fully-qualified URL is used in links) and/or URL poisoning.
Patches
3.7.0, and 4.3.0 and later.
The patches present in these versions update the SwooleServerRequestFactory to filter out X-Forwarded-* headers when creating the initial request. They then by default pass that instance through a Laminas\Diactoros\ServerRequestFilter\FilterUsingXForwardedHeaders instance created from the trustReservedSubnet() constructor, ensuring that the request only honors the X-Forwarded-* headers for private reserved subnets.
Users can define the Laminas\Diactoros\ServerRequestFilter\FilterServerRequestInterface service if they wish to provide a different implementation, or configure the FilterUsingXForwardedHeaders instance differently. When defined, that instance will be used to filter the generated request instance.
Workarounds
Infrastructure or DevOps can place a trusted reverse proxy in front of the mezzio-swoole server.
References
For more information
If you have any questions or comments about this advisory:
- Open an issue in mezzio/mezzio-swoole
- Email us
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | mezzio/mezzio-swoole | all versions | 3.7.0composer require mezzio/mezzio-swoole:^3.7.0 |
| 🐘Packagist | mezzio/mezzio-swoole | ≥ 4.0.0&&< 4.3.0 | 4.3.0composer require mezzio/mezzio-swoole:^4.3.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for mezzio/mezzio-swoole, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update mezzio/mezzio-swoole to 3.7.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-c8rp-cgf4-937w is resolved across your whole dependency graph.
Workarounds
Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.
Frequently Asked Questions
Is GHSA-c8rp-cgf4-937w in your dependencies?
Find it across Packagist, including transitive dependencies.