Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 491298 (CVE-2013-4505) - <dev-vcs/subversion-1.7.14 - multiple vulnerabilities (CVE-2013-{4505,4558})
Summary: <dev-vcs/subversion-1.7.14 - multiple vulnerabilities (CVE-2013-{4505,4558})
Status: RESOLVED FIXED
Alias: CVE-2013-4505
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Security
URL:
Whiteboard: B3 [noglsa]
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-15 06:39 UTC by Sergey Popov
Modified: 2013-12-29 12:36 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Popov gentoo-dev 2013-11-15 06:39:22 UTC
This email is a confidential pre-notification for security issues with 
Subversion:
 * CVE-2013-4505
 * CVE-2013-4558

The public announcement is not until 25 November 2013 17:00 UTC, and we'd like
to keep the information embargoed until the announcement.

You are receiving this mail because (we think) you distribute software
that uses the Subversion libraries or that you host a Subversion installation
used by a large number of users.  We believe that you might want to have your
software patched by the time these security holes are made public on 25
November.

If you no longer maintain Subversion-related packages or hosting, please reply
to this mail indicating who the appropriate contact would be for your
organization.

Below are the advisories, followed by patches to fix the problems.  The
patches apply to Subversion 1.7.x and Subversion 1.8.x.  Subversion 1.8.5
and Subversion 1.7.14 will be published on 25 November, including the patches
below, as well as other stability and bug fixes. You can get an advance copy of
the source distribution here:

  https://dist.apache.org/repos/dist/dev/subversion/

Here are the full advisories:
{{{
  mod_dontdothat does not restrict requests from serf based clients.

Summary:
========

  mod_dontdothat allows you to block update REPORT requests against certain
  paths in the repository.  It expects the paths in the REPORT request
  to be absolute URLs.  Serf based clients send relative URLs instead
  of absolute URLs in many cases.  As a result these clients are not blocked
  as configured by mod_dontdothat.

Known vulnerable:
=================

  mod_dontdothat 1.4.0 through 1.7.13
  mod_dontdothat 1.8.0 through 1.8.4

  Note that mod_dontdothat was in contrib until 1.7.3 and contrib is not
  included in Subversion source tarballs since 1.7.0, so Subversion 1.7.0
  through 1.7.2 did not included mod_dontdothat (it was still available
  from the repository tags for those versions under contrib).

Known fixed:
============

  mod_dontdothat 1.7.14
  mod_dontdothat 1.8.5 

Details:
========

  mod_dontdothat allows the blocking of certain update REPORT requests based
  on the paths of the requests.  This is typically done to block requests
  against the root of the repository or the tags and branches directories where
  there may be large trees and require a large amount of server resources to
  fulfill.

  Update REPORT requests are used to fulfill requests from the client for the
  following commands:
    checkout
    update
    export
    diff (when a server URL or revision other than the BASE is specified)
    status -u
    copy $URL $WC

  The request body for the request includes a src-path and sometimes a
  dst-path entity.  mod_dontdothat matches those paths against the configured
  paths to deny.  When matching the src-path and dst-path, mod_dontdothat
  expects that an absolute URL will be provided.  However, serf clients in the
  case of the src-path entity only provided a relative path.  Relative paths
  have been supported by mod_dav_svn since before Subversion 1.0, but neon
  based clients never produced them.

  When a path is not an absolute URL then mod_dontdothat allowed the request.
  As a result a serf client was not blocked by mod_dontdothat.  It's possible
  for other clients to be modified to avoid the restrictions as well, though
  we are unaware of anyone doing so.

Severity:
=========

  CVSSv2 Base Score: 2.6
  CVSSv2 Base Vector: AV:N/AC:H/Au:N/C:N/I:N/A:P

  We consider this to be a low risk vulnerability.  mod_dontdothat is not
  typically installed.  It is not intended or useful as an access control
  mechanism.  Rather it exists primarily to prevent users unintentionally
  making expensive requests against the server.

  Clients may be able to use more resources than the server admin may have
  expected and planned for based on their configuration.  This increased
  resource usage may impact performance and the availability of the server.

  A server admin who has configured mod_dontdothat would expect matching
  update REPORT requests to be blocked, but they will not be with serf based
  clients.  Serf was added as a http library in Subversion 1.4 as a compile
  time option.  In 1.5 it was possible to chose it at run time, provided it
  had been enabled at compile time.  With 1.8 it became the only supported
  http library.

  As a result clients that can evade these restrictions are in common use and
  no special effort is required to do so.

Recommendations:
================

  Admins using mod_dontdothat are advised to upgrade to 1.7.14 or 1.8.5.

  It may be possible to configure http to disable all requests without an
  absolute URL in the update REPORT requests.  However, doing so has the 
  effect of disabling all serf based clients.  Given that serf is the only
  http library for 1.8.x we do not recommend doing so.  

References:
===========

  CVE-2013-4505  (Subversion)

Reported by:
============

  Ben Reser, WANdisco 

Patches:
========

Patch for Subversion 1.7.x and 1.8.x:
[[[
Index: tools/server-side/mod_dontdothat/mod_dontdothat.c
===================================================================
--- tools/server-side/mod_dontdothat/mod_dontdothat.c	(revision 1541183)
+++ tools/server-side/mod_dontdothat/mod_dontdothat.c	(working copy)
@@ -30,6 +30,7 @@
 #include <util_filter.h>
 #include <ap_config.h>
 #include <apr_strings.h>
+#include <apr_uri.h>
 
 #include <expat.h>
 
@@ -36,6 +37,8 @@
 #include "mod_dav_svn.h"
 #include "svn_string.h"
 #include "svn_config.h"
+#include "svn_path.h"
+#include "private/svn_fspath.h"
 
 module AP_MODULE_DECLARE_DATA dontdothat_module;
 
@@ -161,6 +164,34 @@
     }
 }
 
+/* duplicate of dav_svn__log_err() from mod_dav_svn/util.c */
+static void
+log_dav_err(request_rec *r,
+            dav_error *err,
+            int level)
+{
+    dav_error *errscan;
+
+    /* Log the errors */
+    /* ### should have a directive to log the first or all */
+    for (errscan = err; errscan != NULL; errscan = errscan->prev) {
+        apr_status_t status;
+
+        if (errscan->desc == NULL)
+            continue;
+
+#if AP_MODULE_MAGIC_AT_LEAST(20091119,0)
+        status = errscan->aprerr;
+#else
+        status = errscan->save_errno;
+#endif
+
+        ap_log_rerror(APLOG_MARK, level, status, r,
+                      "%s  [%d, #%d]",
+                      errscan->desc, errscan->status, errscan->error_id);
+    }
+}
+
 static svn_boolean_t
 is_this_legal(dontdothat_filter_ctx *ctx, const char *uri)
 {
@@ -167,20 +198,37 @@
   const char *relative_path;
   const char *cleaned_uri;
   const char *repos_name;
+  const char *uri_path;
   int trailing_slash;
   dav_error *derr;
 
-  /* Ok, so we need to skip past the scheme, host, etc. */
-  uri = ap_strstr_c(uri, "://");
-  if (uri)
-    uri = ap_strchr_c(uri + 3, '/');
+  /* uri can be an absolute uri or just a path, we only want the path to match
+   * against */
+  if (uri && svn_path_is_url(uri))
+    {
+      apr_uri_t parsed_uri;
+      apr_status_t rv = apr_uri_parse(ctx->r->pool, uri, &parsed_uri);
+      if (APR_SUCCESS != rv)
+        {
+          /* Error parsing the URI, log and reject request. */
+          ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, ctx->r,
+                        "mod_dontdothat: blocked request after failing "
+                        "to parse uri: '%s'", uri);
+          return FALSE;
+        }
+      uri_path = parsed_uri.path;
+    }
+  else
+    {
+      uri_path = uri;
+    }
 
-  if (uri)
+  if (uri_path)
     {
       const char *repos_path;
 
       derr = dav_svn_split_uri(ctx->r,
-                               uri,
+                               uri_path,
                                ctx->cfg->base_path,
                                &cleaned_uri,
                                &trailing_slash,
@@ -194,7 +242,7 @@
           if (! repos_path)
             repos_path = "";
 
-          repos_path = apr_psprintf(ctx->r->pool, "/%s", repos_path);
+          repos_path = svn_fspath__canonicalize(repos_path, ctx->r->pool);
 
           /* First check the special cases that are always legal... */
           for (idx = 0; idx < ctx->allow_recursive_ops->nelts; ++idx)
@@ -228,7 +276,20 @@
                 }
             }
         }
+      else
+        {
+          log_dav_err(ctx->r, derr, APLOG_ERR);
+          return FALSE;
+        }
+
     }
+  else
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r,
+                    "mod_dontdothat: empty uri passed to is_this_legal(), "
+                    "module bug?");
+      return FALSE;
+    }
 
   return TRUE;
 }
]]]
}}}

{{{
  mod_dav_svn assertion triggered by non-canonical URLs in autoversioning
  commits.

Summary:
========

  When SVNAutoversioning is enabled via

    SVNAutoversioning on

  commits can be made by single HTTP requests such as MKCOL and
  PUT.  If Subversion is built with assertions enabled any such
  requests that have non-canonical URLs, such as URLs with a
  trailing /, may trigger an assert.  An assert will cause the
  Apache process to abort.

Known vulnerable:
=================

  mod_dav_svn 1.7.0 through 1.7.13
  mod_dav_svn 1.8.0 through 1.8.4

Known fixed:
============

  mod_dav_svn 1.7.14
  mod_dav_svn 1.8.5

Details:
========

  Given a repository located at http://example.com/repos the assert can
  be triggered by commands like:

    curl -X PUT http://example.com/repos/A/
    curl -X MKCOL http://example.com/repos/A/../B

  The assert happens after the commit has happened in the repository
  and will not occur if the commit is rejected.

Severity:
=========

  CVSSv2 Base Score: 3.5
  CVSSv2 Base Vector: AV:N/AC:M/Au:S/C:N/I:N/A:P

  We consider this to be a low risk vulnerability.

  The attacker needs to have commit access to the repository to
  exploit the vulnerability.

  Most Subversion servers do not have autoversioning enabled. 

  In order for there to be any impact assertions must have been enabled when
  mod_dav_svn was built.  In this case if assertions are disabled there is no
  impact.  They are enabled by default on *nix and disabled on Windows.

  The assertion will cause the http server process to abort.  Apache httpd
  servers using a prefork MPM will simply start a new process to replace
  the process that died.  Servers using threaded MPMs may be processing other
  requests in the same process as the process that the attack causes to die.
  In either case there is an increased processing impact of restarting a
  process and the cost of per process caches being lost.

Recommendations:
================

  We recommend all users upgrade mod_dav_svn to Subversion 1.8.5 or 1.7.14 or
  newer.

  Disabling SVNAutoversioning will avoid the problem.

  Building Subversion with assertions disabled will avoid the problem.
  This can be done using the -disable-debug option to configure on *nix and
  by using a Release buld profile on Windows.

References:
===========

  CVE-2013-4558 (Subversion)

Reported by:
============

  Philip Martin, WANdisco

Patches:
========

Patch for Subversion 1.7.x and 1.8.x:
[[[
Index: subversion/mod_dav_svn/repos.c
===================================================================
--- subversion/mod_dav_svn/repos.c	(revision 1539596)
+++ subversion/mod_dav_svn/repos.c	(working copy)
@@ -2456,9 +2456,12 @@ get_parent_resource(const dav_resource *resource,
       parent->info = parentinfo;
 
       parentinfo->uri_path =
-        svn_stringbuf_create(get_parent_path(resource->info->uri_path->data,
-                                             TRUE, resource->pool),
-                             resource->pool);
+        svn_stringbuf_create(
+               get_parent_path(
+                   svn_urlpath__canonicalize(resource->info->uri_path->data,
+                                            resource->pool),
+                   TRUE, resource->pool),
+               resource->pool);
       parentinfo->repos = resource->info->repos;
       parentinfo->root = resource->info->root;
       parentinfo->r = resource->info->r;
]]]
}}}
Comment 1 Sergey Popov gentoo-dev 2013-11-15 06:46:05 UTC
SEMI-PUBLIC, as fix can be viewed in trunk
Comment 2 Sergey Popov gentoo-dev 2013-11-26 15:29:38 UTC
A small update to the advisory for CVE-2013-4558 that I sent out on
14 November 2013.  The only thing that has changed is that the vulnerable
versions has been reduced since the issue was created by the fix for
CVE-2013-4131.

Thanks to Murray McAllister of RedHat for asking some questions that lead to
the discovery of this inaccuracy in our advisory.

The embargo date for this remains 25 November 2013 17:00 UTC.

The updated advisory follows:

{{{
  mod_dav_svn assertion triggered by non-canonical URLs in autoversioning
  commits.

Summary:
========

  When SVNAutoversioning is enabled via

    SVNAutoversioning on

  commits can be made by single HTTP requests such as MKCOL and
  PUT.  If Subversion is built with assertions enabled any such
  requests that have non-canonical URLs, such as URLs with a
  trailing /, may trigger an assert.  An assert will cause the
  Apache process to abort.

Known vulnerable:
=================

  mod_dav_svn 1.7.11 through 1.7.13
  mod_dav_svn 1.8.1 through 1.8.4

Known fixed:
============

  mod_dav_svn 1.7.14
  mod_dav_svn 1.8.5

Details:
========

  Given a repository located at http://example.com/repos the assert can
  be triggered by commands like:

    curl -X PUT http://example.com/repos/A/
    curl -X MKCOL http://example.com/repos/A/../B

  The assert happens after the commit has happened in the repository
  and will not occur if the commit is rejected.

Severity:
=========

  CVSSv2 Base Score: 3.5
  CVSSv2 Base Vector: AV:N/AC:M/Au:S/C:N/I:N/A:P

  We consider this to be a low risk vulnerability.

  The attacker needs to have commit access to the repository to
  exploit the vulnerability.

  Most Subversion servers do not have autoversioning enabled. 

  In order for there to be any impact assertions must have been enabled when
  mod_dav_svn was built.  In this case if assertions are disabled there is no
  impact.  They are enabled by default on *nix and disabled on Windows.

  The assertion will cause the http server process to abort.  Apache httpd
  servers using a prefork MPM will simply start a new process to replace
  the process that died.  Servers using threaded MPMs may be processing other
  requests in the same process as the process that the attack causes to die.
  In either case there is an increased processing impact of restarting a
  process and the cost of per process caches being lost.

Recommendations:
================

  We recommend all users upgrade mod_dav_svn to Subversion 1.8.5 or 1.7.14 or
  newer.

  Disabling SVNAutoversioning will avoid the problem.

  Building Subversion with assertions disabled will avoid the problem.
  This can be done using the -disable-debug option to configure on *nix and
  by using a Release buld profile on Windows.

References:
===========

  CVE-2013-4558 (Subversion)

Reported by:
============

  Philip Martin, WANdisco

Patches:
========

Patch for Subversion 1.7.x and 1.8.x:
[[[
Index: subversion/mod_dav_svn/repos.c
===================================================================
--- subversion/mod_dav_svn/repos.c	(revision 1539596)
+++ subversion/mod_dav_svn/repos.c	(working copy)
@@ -2456,9 +2456,12 @@ get_parent_resource(const dav_resource *resource,
       parent->info = parentinfo;
 
       parentinfo->uri_path =
-        svn_stringbuf_create(get_parent_path(resource->info->uri_path->data,
-                                             TRUE, resource->pool),
-                             resource->pool);
+        svn_stringbuf_create(
+               get_parent_path(
+                   svn_urlpath__canonicalize(resource->info->uri_path->data,
+                                            resource->pool),
+                   TRUE, resource->pool),
+               resource->pool);
       parentinfo->repos = resource->info->repos;
       parentinfo->root = resource->info->root;
       parentinfo->r = resource->info->r;
]]]
}}}
Comment 3 Sergey Popov gentoo-dev 2013-11-26 15:33:03 UTC
This issue is now public

@maintainers: please bump it in tree and say when it will be ready to stabilize, thanks
Comment 4 Agostino Sarubbo gentoo-dev 2013-11-26 16:53:02 UTC
*** Bug 492626 has been marked as a duplicate of this bug. ***
Comment 5 Thomas Sachau gentoo-dev 2013-11-26 20:50:12 UTC
version 1.7.14 added, will add arch teams for stabilizatin tomorrow, if no major regressions are reported till then
Comment 6 Thomas Sachau gentoo-dev 2013-11-27 19:21:37 UTC
arches, please mark stable:

=dev-vcs/subversion-1.7.14

target keywords="alpha amd64 arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2013-11-28 13:34:10 UTC
Stable for HPPA.
Comment 8 Agostino Sarubbo gentoo-dev 2013-12-01 12:18:11 UTC
amd64 stable
Comment 9 Agostino Sarubbo gentoo-dev 2013-12-01 12:19:11 UTC
x86 stable
Comment 10 Agostino Sarubbo gentoo-dev 2013-12-01 18:09:51 UTC
ppc stable
Comment 11 Agostino Sarubbo gentoo-dev 2013-12-01 18:10:13 UTC
ppc64 stable
Comment 12 Agostino Sarubbo gentoo-dev 2013-12-07 19:51:34 UTC
arm stable
Comment 13 Agostino Sarubbo gentoo-dev 2013-12-08 17:05:54 UTC
alpha stable
Comment 14 GLSAMaker/CVETool Bot gentoo-dev 2013-12-12 17:24:19 UTC
CVE-2013-4558 (http://nvd.nist.gov/nvd.cfm?cvename=CVE-2013-4558):
  The get_parent_resource function in repos.c in mod_dav_svn Apache HTTPD
  server module in Subversion 1.7.11 through 1.7.13 and 1.8.1 through 1.8.4,
  when built with assertions enabled and SVNAutoversioning is enabled, allows
  remote attackers to cause a denial of service (assertion failure and Apache
  process abort) via a non-canonical URL in a request, as demonstrated using a
  trailing /.

CVE-2013-4505 (http://nvd.nist.gov/nvd.cfm?cvename=CVE-2013-4505):
  The is_this_legal function in mod_dontdothat for Apache Subversion 1.4.0
  through 1.7.13 and 1.8.0 through 1.8.4 allows remote attackers to bypass
  intended access restrictions and possibly cause a denial of service
  (resource consumption) via a relative URL in a REPORT request.
Comment 15 Agostino Sarubbo gentoo-dev 2013-12-14 19:46:50 UTC
sparc stable
Comment 16 Tobias Heinlein (RETIRED) gentoo-dev 2013-12-22 15:04:11 UTC
Ready for vote, I vote NO.
Comment 17 Chris Reffett (RETIRED) gentoo-dev Security 2013-12-22 16:39:58 UTC
GLSA vote: no. Note to maintainers: please clean up after the last version is stabled.
Comment 18 Thomas Sachau gentoo-dev 2013-12-22 23:24:57 UTC
still waiting for ia64 stabilization
Comment 19 Akinori Hattori gentoo-dev 2013-12-29 07:10:37 UTC
ia64 stable
Comment 20 Thomas Sachau gentoo-dev 2013-12-29 11:57:52 UTC
old version removed
Comment 21 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2013-12-29 12:36:40 UTC
closed as [noglsa]