首页 -> 安全研究
安全研究
安全漏洞
Apache Subversion安全限制绕过漏洞(CVE-2013-4505)
发布日期:2013-11-27
更新日期:2013-11-28
受影响系统:
Apache Group Subversion 1.8.5描述:
Apache Group Subversion 1.7.14
BUGTRAQ ID: 63966
CVE(CAN) ID: CVE-2013-4505
Subversion是一款开源多用户版本控制系统,支持非ASCII文本和二进制数据。
Apache Subversion 1.7.14 、1.8.5之前版本的mod_dontdothat没有阻止某些serf客户端的请求,这可使客户端绕过mod_dontdothat限制并非法访问服务器资源。
<*来源:Ben Reser
链接:https://bugzilla.redhat.com/show_bug.cgi?id=1033995
http://subversion.apache.org/security/CVE-2013-4505-advisory.txt
*>
建议:
厂商补丁:
Apache Group
------------
Apache Group已经为此发布了一个安全公告(CVE-2013-4505-advisory)以及相应补丁:
CVE-2013-4505-advisory:mod_dontdothat does not restrict requests from serf based clients.
链接:http://subversion.apache.org/security/CVE-2013-4505-advisory.txt
补丁下载:
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;
}
]]]
浏览次数:3075
严重程度:0(网友投票)
绿盟科技给您安全的保障