GHSA-jq87-2wxp-8349 ZendFramework Route Parameter Injection Via Query String in `Zend\Mvc`

Not scored Published

Attackers can bypass routing constraints and execute unintended controllers by injecting query parameters, potentially accessing restricted functionality.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is GHSA-jq87-2wxp-8349?

GHSA-jq87-2wxp-8349 is a missing authorization vulnerability in zendframework/zendframework, published on 7 Jun 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

In Zend Framework 2, Zend\Mvc\Router\Http\Query is used primarily to allow appending query strings to URLs when assembled. However, due to the fact that it captures any query parameters into the RouteMatch, and the fact that RouteMatch parameters are merged with any parent routes, this can lead to overriding already captured routing parameters, bypassing constraints defined in the parents.

As an example, consider the following route definition:

array(
    'user' => array(
        'type' => 'segment',
        'options' => array(
            'route' => '/user/:key',
            'defaults' => array(
                'controller' => 'UserController',
                'action'     => 'show-action',
            ),
            'constraints' => array(
                'key' => '[a-z0-9]+',
            ),
        ),
        'child_routes' => array(
            'query' => array('type' => 'query'),
        ),
    ),
)

If the request URI was /user/foo/?controller=SecretController&key=invalid_value, the RouteMatch returned after routing would contain the following:

array(
    'controller' => 'SecretController',
    'action'     => 'show-action',
    'key'        => 'invalid_value',
)

This would lead to execution of a different controller than intended, with a value for the key parameter that bypassed the constraints outlined in the parent route.

Which versions are affected by GHSA-jq87-2wxp-8349?

4 open source packages ship an affected version, including zendframework/zendframework.

PackageAffectedFixed in
zendframework/zendframework PackagistFrom 2.0.02.0.8
zendframework/zendframework PackagistFrom 2.0.02.0.8
zendframework/zendframework PackagistFrom 2.1.02.1.4
zendframework/zendframework PackagistFrom 2.1.02.1.4

How do I fix GHSA-jq87-2wxp-8349?

Upgrade zendframework/zendframework to a fixed version for your release line: 2.0.8 or 2.1.4.

Upgrade, and check permissions on every request on the server, not only in the interface. More about Missing authorization.

Is GHSA-jq87-2wxp-8349 being exploited?

There is no known exploitation of GHSA-jq87-2wxp-8349 in the wild and no public exploit code.

Sources

Is GHSA-jq87-2wxp-8349 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free