ZF-8029: Script injection using the 'default' route
When assembling URLs with $encode = true and using the default route, for instance a URL like controller/action/paramName/paramValue, the Zend_Controller_Router_Route_Module class urlencode's 'controller', 'action' and 'paramValue', but not 'paramName'.
This allows for an attack vector where HTML is injected into the 'paramName' segment of the URL. For example, the default route will parse the following URL:
Into the following request:
'controller' => 'foo' 'action' => 'bar' '">
If you then use the default route to construct a URL in the foo/bar view (with $reset = false), it will display this way:
Looks like script injection to me. This particular instance doesn't do the alert because the closing script tag is malformed (properly encoded). The obvious workaround for this is to additionally escape the resulting URL with htmlspecialchars(), but that requirement didn't seem intuitive given that the URL was already supposed to be encoded.
So, is this a bug or expected behavior for some other reason?