.. Licensed under the Apache License, Version 2.0 (the "License"); you may not
.. use this file except in compliance with the License. You may obtain a copy of
.. the License at
..
..   http://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
.. License for the specific language governing permissions and limitations under
.. the License.

.. _cve/2012-5650:

==========================================================
CVE-2012-5650: DOM based Cross-Site Scripting via Futon UI
==========================================================

:Date: 14.01.2013

:Affected: Apache CouchDB releases up to and including 1.0.3, 1.1.1,
           and 1.2.0 are vulnerable.

:Severity: Moderate

:Vendor: The Apache Software Foundation

Description
===========

Query parameters passed into the browser-based test suite are not sanitised,
and can be used to load external resources. An attacker may execute JavaScript
code in the browser, using the context of the remote user.

Mitigation
==========

Upgrade to a supported CouchDB release that includes this fix, such as:

- :ref:`1.0.4 <release/1.0.4>`
- :ref:`1.1.2 <release/1.1.2>`
- :ref:`1.2.1 <release/1.2.1>`
- :ref:`1.3.x <release/1.3.x>`

All listed releases have included a specific fix.

Work-Around
===========

Disable the Futon user interface completely, by adapting `local.ini` and
restarting CouchDB::

  [httpd_global_handlers]
  _utils = {couch_httpd_misc_handlers, handle_welcome_req, <<"Forbidden">>}

Or by removing the UI test suite components:

- share/www/verify_install.html
- share/www/couch_tests.html
- share/www/custom_test.html

Acknowledgement
===============

This vulnerability was discovered & reported to the Apache Software Foundation
by `Frederik Braun`_.

.. _Frederik Braun: https://frederik-braun.com/
