diff options
author | Jiaying Song <jiaying.song.cn@windriver.com> | 2024-12-13 15:20:37 +0800 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2024-12-23 05:46:32 -0800 |
commit | 8f8989071a41ea73e9c2977445f45d541b7a198f (patch) | |
tree | 765ab3822d35c9ad665208d038a00a81350933f4 /meta/recipes-devtools/subversion | |
parent | 1e47fd8e4427f9d84048139804f75b83471bab28 (diff) | |
download | poky-8f8989071a41ea73e9c2977445f45d541b7a198f.tar.gz |
subversion: fix CVE-2024-46901
Insufficient validation of filenames against control characters in
Apache Subversion repositories served via mod_dav_svn allows
authenticated users with commit access to commit a corrupted revision,
leading to disruption for users of the repository. All versions of
Subversion up to and including Subversion 1.14.4 are affected if serving
repositories via mod_dav_svn. Users are recommended to upgrade to
version 1.14.5, which fixes this issue. Repositories served via other
access methods are not affected.
References:
https://nvd.nist.gov/vuln/detail/CVE-2024-46901
Upstream patches:
https://subversion.apache.org/security/CVE-2024-46901-advisory.txt
(From OE-Core rev: 16c212bd9a9e9c35256ff308da72a518c76ce11d)
Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-devtools/subversion')
-rw-r--r-- | meta/recipes-devtools/subversion/subversion/CVE-2024-46901.patch | 161 | ||||
-rw-r--r-- | meta/recipes-devtools/subversion/subversion_1.14.3.bb | 3 |
2 files changed, 163 insertions, 1 deletions
diff --git a/meta/recipes-devtools/subversion/subversion/CVE-2024-46901.patch b/meta/recipes-devtools/subversion/subversion/CVE-2024-46901.patch new file mode 100644 index 0000000000..4b28a58507 --- /dev/null +++ b/meta/recipes-devtools/subversion/subversion/CVE-2024-46901.patch | |||
@@ -0,0 +1,161 @@ | |||
1 | From 149e299cd7eaadc8248480300b6e13b097c5b3fa Mon Sep 17 00:00:00 2001 | ||
2 | From: Jiaying Song <jiaying.song.cn@windriver.com> | ||
3 | Date: Fri, 13 Dec 2024 12:19:43 +0800 | ||
4 | Subject: [PATCH] Fix CVE-2024-46901 | ||
5 | |||
6 | It has been discovered that the patch for CVE-2013-1968 was incomplete and unintentionally left mod_dav_svn vulnerable to control characters in filenames. | ||
7 | |||
8 | Upstream-Status: Backport | ||
9 | [https://subversion.apache.org/security/CVE-2024-46901-advisory.txt] | ||
10 | |||
11 | CVE: CVE-2024-46901 | ||
12 | |||
13 | Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com> | ||
14 | --- | ||
15 | .../include/private/svn_repos_private.h | 8 +++++ | ||
16 | subversion/libsvn_repos/commit.c | 3 +- | ||
17 | subversion/libsvn_repos/repos.c | 10 +++++++ | ||
18 | subversion/mod_dav_svn/lock.c | 7 +++++ | ||
19 | subversion/mod_dav_svn/repos.c | 29 +++++++++++++++++++ | ||
20 | 5 files changed, 55 insertions(+), 2 deletions(-) | ||
21 | |||
22 | diff --git a/subversion/include/private/svn_repos_private.h b/subversion/include/private/svn_repos_private.h | ||
23 | index 1fd34e8..1d5fc9c 100644 | ||
24 | --- a/subversion/include/private/svn_repos_private.h | ||
25 | +++ b/subversion/include/private/svn_repos_private.h | ||
26 | @@ -390,6 +390,14 @@ svn_repos__get_dump_editor(const svn_delta_editor_t **editor, | ||
27 | const char *update_anchor_relpath, | ||
28 | apr_pool_t *pool); | ||
29 | |||
30 | +/* Validate that the given PATH is a valid pathname that can be stored in | ||
31 | + * a Subversion repository, according to the name constraints used by the | ||
32 | + * svn_repos_* layer. | ||
33 | + */ | ||
34 | +svn_error_t * | ||
35 | +svn_repos__validate_new_path(const char *path, | ||
36 | + apr_pool_t *scratch_pool); | ||
37 | + | ||
38 | #ifdef __cplusplus | ||
39 | } | ||
40 | #endif /* __cplusplus */ | ||
41 | diff --git a/subversion/libsvn_repos/commit.c b/subversion/libsvn_repos/commit.c | ||
42 | index 515600d..aad37ee 100644 | ||
43 | --- a/subversion/libsvn_repos/commit.c | ||
44 | +++ b/subversion/libsvn_repos/commit.c | ||
45 | @@ -308,8 +308,7 @@ add_file_or_directory(const char *path, | ||
46 | svn_boolean_t was_copied = FALSE; | ||
47 | const char *full_path, *canonicalized_path; | ||
48 | |||
49 | - /* Reject paths which contain control characters (related to issue #4340). */ | ||
50 | - SVN_ERR(svn_path_check_valid(path, pool)); | ||
51 | + SVN_ERR(svn_repos__validate_new_path(path, pool)); | ||
52 | |||
53 | SVN_ERR(svn_relpath_canonicalize_safe(&canonicalized_path, NULL, path, | ||
54 | pool, pool)); | ||
55 | diff --git a/subversion/libsvn_repos/repos.c b/subversion/libsvn_repos/repos.c | ||
56 | index 2189de8..119f04b 100644 | ||
57 | --- a/subversion/libsvn_repos/repos.c | ||
58 | +++ b/subversion/libsvn_repos/repos.c | ||
59 | @@ -2092,3 +2092,13 @@ svn_repos__fs_type(const char **fs_type, | ||
60 | svn_dirent_join(repos_path, SVN_REPOS__DB_DIR, pool), | ||
61 | pool); | ||
62 | } | ||
63 | + | ||
64 | +svn_error_t * | ||
65 | +svn_repos__validate_new_path(const char *path, | ||
66 | + apr_pool_t *scratch_pool) | ||
67 | +{ | ||
68 | + /* Reject paths which contain control characters (related to issue #4340). */ | ||
69 | + SVN_ERR(svn_path_check_valid(path, scratch_pool)); | ||
70 | + | ||
71 | + return SVN_NO_ERROR; | ||
72 | +} | ||
73 | diff --git a/subversion/mod_dav_svn/lock.c b/subversion/mod_dav_svn/lock.c | ||
74 | index 7e9c94b..d2a6aa9 100644 | ||
75 | --- a/subversion/mod_dav_svn/lock.c | ||
76 | +++ b/subversion/mod_dav_svn/lock.c | ||
77 | @@ -36,6 +36,7 @@ | ||
78 | #include "svn_pools.h" | ||
79 | #include "svn_props.h" | ||
80 | #include "private/svn_log.h" | ||
81 | +#include "private/svn_repos_private.h" | ||
82 | |||
83 | #include "dav_svn.h" | ||
84 | |||
85 | @@ -717,6 +718,12 @@ append_locks(dav_lockdb *lockdb, | ||
86 | |||
87 | /* Commit a 0-byte file: */ | ||
88 | |||
89 | + if ((serr = svn_repos__validate_new_path(resource->info->repos_path, | ||
90 | + resource->pool))) | ||
91 | + return dav_svn__convert_err(serr, HTTP_BAD_REQUEST, | ||
92 | + "Request specifies an invalid path.", | ||
93 | + resource->pool); | ||
94 | + | ||
95 | if ((serr = dav_svn__get_youngest_rev(&rev, repos, resource->pool))) | ||
96 | return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR, | ||
97 | "Could not determine youngest revision", | ||
98 | diff --git a/subversion/mod_dav_svn/repos.c b/subversion/mod_dav_svn/repos.c | ||
99 | index 8cbd5e7..778ae9b 100644 | ||
100 | --- a/subversion/mod_dav_svn/repos.c | ||
101 | +++ b/subversion/mod_dav_svn/repos.c | ||
102 | @@ -2928,6 +2928,15 @@ open_stream(const dav_resource *resource, | ||
103 | |||
104 | if (kind == svn_node_none) /* No existing file. */ | ||
105 | { | ||
106 | + serr = svn_repos__validate_new_path(resource->info->repos_path, | ||
107 | + resource->pool); | ||
108 | + | ||
109 | + if (serr != NULL) | ||
110 | + { | ||
111 | + return dav_svn__convert_err(serr, HTTP_BAD_REQUEST, | ||
112 | + "Request specifies an invalid path.", | ||
113 | + resource->pool); | ||
114 | + } | ||
115 | serr = svn_fs_make_file(resource->info->root.root, | ||
116 | resource->info->repos_path, | ||
117 | resource->pool); | ||
118 | @@ -4120,6 +4129,14 @@ create_collection(dav_resource *resource) | ||
119 | return err; | ||
120 | } | ||
121 | |||
122 | + if ((serr = svn_repos__validate_new_path(resource->info->repos_path, | ||
123 | + resource->pool)) != NULL) | ||
124 | + { | ||
125 | + return dav_svn__convert_err(serr, HTTP_BAD_REQUEST, | ||
126 | + "Request specifies an invalid path.", | ||
127 | + resource->pool); | ||
128 | + } | ||
129 | + | ||
130 | if ((serr = svn_fs_make_dir(resource->info->root.root, | ||
131 | resource->info->repos_path, | ||
132 | resource->pool)) != NULL) | ||
133 | @@ -4193,6 +4210,12 @@ copy_resource(const dav_resource *src, | ||
134 | if (err) | ||
135 | return err; | ||
136 | } | ||
137 | + | ||
138 | + serr = svn_repos__validate_new_path(dst->info->repos_path, dst->pool); | ||
139 | + if (serr) | ||
140 | + return dav_svn__convert_err(serr, HTTP_BAD_REQUEST, | ||
141 | + "Request specifies an invalid path.", | ||
142 | + dst->pool); | ||
143 | |||
144 | src_repos_path = svn_repos_path(src->info->repos->repos, src->pool); | ||
145 | dst_repos_path = svn_repos_path(dst->info->repos->repos, dst->pool); | ||
146 | @@ -4430,6 +4453,12 @@ move_resource(dav_resource *src, | ||
147 | if (err) | ||
148 | return err; | ||
149 | |||
150 | + serr = svn_repos__validate_new_path(dst->info->repos_path, dst->pool); | ||
151 | + if (serr) | ||
152 | + return dav_svn__convert_err(serr, HTTP_BAD_REQUEST, | ||
153 | + "Request specifies an invalid path.", | ||
154 | + dst->pool); | ||
155 | + | ||
156 | /* Copy the src to the dst. */ | ||
157 | serr = svn_fs_copy(src->info->root.root, /* the root object of src rev*/ | ||
158 | src->info->repos_path, /* the relative path of src */ | ||
159 | -- | ||
160 | 2.25.1 | ||
161 | |||
diff --git a/meta/recipes-devtools/subversion/subversion_1.14.3.bb b/meta/recipes-devtools/subversion/subversion_1.14.3.bb index 1cf4e1734b..1ef3d498a5 100644 --- a/meta/recipes-devtools/subversion/subversion_1.14.3.bb +++ b/meta/recipes-devtools/subversion/subversion_1.14.3.bb | |||
@@ -10,7 +10,8 @@ DEPENDS:append:class-native = " file-replacement-native" | |||
10 | 10 | ||
11 | SRC_URI = "${APACHE_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \ | 11 | SRC_URI = "${APACHE_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \ |
12 | file://serfmacro.patch \ | 12 | file://serfmacro.patch \ |
13 | " | 13 | file://CVE-2024-46901.patch \ |
14 | " | ||
14 | 15 | ||
15 | SRC_URI[sha256sum] = "949efd451a09435f7e8573574c71c7b71b194d844890fa49cd61d2262ea1a440" | 16 | SRC_URI[sha256sum] = "949efd451a09435f7e8573574c71c7b71b194d844890fa49cd61d2262ea1a440" |
16 | 17 | ||