diff options
author | 2004-04-16 07:03:04 +0000 | |
---|---|---|
committer | 2004-04-16 07:03:04 +0000 | |
commit | 396ed77acf875746bd79fab456acbb44d978baa7 (patch) | |
tree | bafcaa858e71f82913ac9b15df41acc5b7ef9e6a /gnu/usr.bin/cvs/src | |
parent | During bootup, only print the VMEChip2 decoder settings for those which are (diff) | |
download | wireguard-openbsd-396ed77acf875746bd79fab456acbb44d978baa7.tar.xz wireguard-openbsd-396ed77acf875746bd79fab456acbb44d978baa7.zip |
- a malicious server may send path names that translate out of the
local cvs tree on the client, enabling the server to overwrite files
on the client.
- a client may read files outside the repository using the -p flag
with the checkout command.
ok deraadt@
Diffstat (limited to 'gnu/usr.bin/cvs/src')
-rw-r--r-- | gnu/usr.bin/cvs/src/client.c | 14 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/src/modules.c | 7 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gnu/usr.bin/cvs/src/client.c b/gnu/usr.bin/cvs/src/client.c index e234af594fe..57739524ee2 100644 --- a/gnu/usr.bin/cvs/src/client.c +++ b/gnu/usr.bin/cvs/src/client.c @@ -1003,6 +1003,20 @@ call_in_directory (pathname, func, data) char *rdirp; int reposdirname_absolute; + /* + * For security reasons, if PATHNAME is absolute or attempts to + * ascend outside of the current sandbox, we abort. The server should not + * send us anything but relative paths which remain inside the sandbox + * here. Anything less means a trojan CVS server could create and edit + * arbitrary files on the client. + */ + if (isabsolute (pathname) || pathname_levels (pathname) > 0) + { + error (0, 0, + "Server attempted to update a file via an invalid pathname:"); + error (1, 0, "`%s'.", pathname); + } + reposname = NULL; read_line (&reposname); assert (reposname != NULL); diff --git a/gnu/usr.bin/cvs/src/modules.c b/gnu/usr.bin/cvs/src/modules.c index a4658815d24..c588b71cd04 100644 --- a/gnu/usr.bin/cvs/src/modules.c +++ b/gnu/usr.bin/cvs/src/modules.c @@ -170,6 +170,13 @@ do_module (db, mname, m_type, msg, callback_proc, where, shorten, if (isabsolute (mname)) error (1, 0, "Absolute module reference invalid: `%s'", mname); + /* Similarly for directories that attempt to step above the root of the + * repository. + */ + if (pathname_levels (mname) > 0) + error (1, 0, "up-level in module reference (`..') invalid: `%s'.", + mname); + /* if this is a directory to ignore, add it to that list */ if (mname[0] == '!' && mname[1] != '\0') { |