ZF2011-01: Potential XSS in Development Environment Error View Script
The default error handling view script generated using
Zend_Tool failed to escape request parameters when run in the
"development" configuration environment, providing a potential XSS attack
Zend_Tool_Project_Context_Zf_ViewScriptFile was patched such
that the view script template now calls the
on dumped request variables.
This particular vulnerability affects only those users who (a) are using
Zend_Tool (aka the
zf CLI) to generate their
ErrorController and view script, and (b) are running that
code under the "development" configuration environment on a public-facing
If you are running in any environment other than "development", the issue will not present.
There are three approaches you can take:
- Make sure you set the correct application environment.
You should only ever run in the "development" environment when developing the application, and typically only behind a firewall. Additionally, you should set your
APPLICATION_ENVenvironment variable via your web server's virtual host configuration whenever possible. For public-facing hosts, set the value to anything other than "development".
If you must run under the "development" application environment on a publically accessible server, follow one of the next two recommendations.
- Upgrade to Zend Framework 1.11.4
Zend Framework 1.11.4 includes a patch that adds escaping to the generated
error/error.phtmlview script, ensuring that request variables are escaped appropriately for the browser.
Do note, however, that this will not update any previously generated code. You will still need to follow the next advice for previously generated error view scripts.
- Modify your error/error.phtml view script
If you cannot upgrade, or if you want to patch previously generated error view scripts, do the following:
- Open the
file from your ZF-generated project in a text editor or your
- Find the heading "Request Parameters".
- In the line following, you'll see the following statement:
<pre><?php echo var_export($this->request->getParams(), true) ?>
- Edit the above statement to wrap the
var_exportcall within a
<pre><?php echo $this->escape(var_export($this->request->getParams(), true)) ?>
Once complete, save the file.
- Open the
The Zend Framework team thanks the following for working with us to help protect its users:
- Robert Lehmann
- Frederik Braun
- Hubert Hesse
Reporting Potential Security Issues
If you have encountered a potential security vulnerability in Zend Framework, please report it to us at email@example.com. We will work with you to verify the vulnerability and patch it.
When reporting issues, please provide the following information:
- Component(s) affected
- A description indicating how to reproduce the issue
- A summary of the security vulnerability and impact
We request that you contact us via the email address above and give the project contributors a chance to resolve the vulnerability and issue a new release prior to any public exposure; this helps protect Zend Framework users and provides them with a chance to upgrade and/or update in order to protect their applications.
For sensitive email communications, please use our PGP key.
Zend Framework takes security seriously. If we verify a reported security vulnerability, our policy is:
- We will patch the current release branch, as well as the immediate prior minor release branch.
- After patching the release branches, we will immediately issue new security fix releases for each patched release branch.
- A security advisory will be released on the Zend Framework site detailing the vulnerability, as well as recommendations for end-users to protect themselves. Security advisories will be listed at http://framework.zend.com/security/advisories, as well as via a feed (which is also present in the website head for easy feed discovery)
Released Thu, 03 Mar 2011 12:00:00 -0500.