Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
cobbler.7535
escape-shell-parameters-provided-by-user-on-rep...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File escape-shell-parameters-provided-by-user-on-reposync.patch of Package cobbler.7535
From 3963770499540f291e2745478d01431fae76bb54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= <psuarezhernandez@suse.com> Date: Thu, 26 Apr 2018 12:37:43 +0100 Subject: [PATCH] Escape shell parameters provided by user on reposync action (CVE-2017-1000469) --- cobbler/action_reposync.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cobbler/action_reposync.py b/cobbler/action_reposync.py index 8054b4aa..4366c62c 100644 --- a/cobbler/action_reposync.py +++ b/cobbler/action_reposync.py @@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA import os import os.path +import pipes import time import sys import urlgrabber @@ -210,7 +211,7 @@ class RepoSync: flags = blended.get("createrepo_flags","(ERROR: FLAGS)") try: # BOOKMARK - cmd = "createrepo %s %s %s" % (" ".join(mdoptions), flags, dirname) + cmd = "createrepo %s %s %s" % (" ".join(mdoptions), flags, pipes.quote(dirname)) utils.subprocess_call(self.logger, cmd) except: utils.log_exc(self.logger) @@ -234,7 +235,7 @@ class RepoSync: dest_path = os.path.join(self.settings.webdir + "/repo_mirror", repo.name) # FIXME: wrapper for subprocess that logs to logger - cmd = "wget -N -np -r -l inf -nd -P %s %s" % (dest_path, repo_mirror) + cmd = "wget -N -np -r -l inf -nd -P %s %s" % (pipes.quote(dest_path), pipes.quote(repo_mirror)) rc = utils.subprocess_call(self.logger, cmd) if rc != 0: @@ -268,7 +269,7 @@ class RepoSync: repo.mirror = "%s/" % repo.mirror # FIXME: wrapper for subprocess that logs to logger - cmd = "rsync -rltDv --copy-unsafe-links --delete-after %s --delete --exclude-from=/etc/cobbler/rsync.exclude %s %s" % (spacer, repo.mirror, dest_path) + cmd = "rsync -rltDv --copy-unsafe-links --delete-after %s --delete --exclude-from=/etc/cobbler/rsync.exclude %s %s" % (spacer, pipes.quote(repo.mirror), pipes.quote(dest_path)) rc = utils.subprocess_call(self.logger, cmd) if rc !=0: @@ -320,7 +321,7 @@ class RepoSync: if has_rpm_list: self.logger.warning("warning: --rpm-list is not supported for RHN content") rest = repo.mirror[6:] # everything after rhn:// - cmd = "/usr/bin/reposync %s -r %s --download_path=%s" % (self.rflags, rest, self.settings.webdir+"/repo_mirror") + cmd = "/usr/bin/reposync %s -r %s --download_path=%s" % (self.rflags, pipes.quote(rest), pipes.quote(self.settings.webdir+"/repo_mirror")) if repo.name != rest: args = { "name" : repo.name, "rest" : rest } utils.die(self.logger,"ERROR: repository %(name)s needs to be renamed %(rest)s as the name of the cobbler repository must match the name of the RHN channel" % args) @@ -395,7 +396,7 @@ class RepoSync: if not has_rpm_list and repo.mirror_locally: # if we have not requested only certain RPMs, use reposync - cmd = "/usr/bin/reposync %s --config=%s --repoid=%s --download_path=%s" % (self.rflags, temp_file, repo.name, self.settings.webdir+"/repo_mirror") + cmd = "/usr/bin/reposync %s --config=%s --repoid=%s --download_path=%s" % (self.rflags, temp_file, pipes.quote(repo.name), pipes.quote(self.settings.webdir+"/repo_mirror")) if repo.arch != "": if repo.arch == "x86": repo.arch = "i386" # FIX potential arch errors @@ -418,7 +419,7 @@ class RepoSync: # older yumdownloader sometimes explodes on --resolvedeps # if this happens to you, upgrade yum & yum-utils extra_flags = self.settings.yumdownloader_flags - cmd = "/usr/bin/yumdownloader %s %s --disablerepo=* --enablerepo=%s -c %s --destdir=%s %s" % (extra_flags, use_source, repo.name, temp_file, dest_path, " ".join(repo.rpm_list)) + cmd = "/usr/bin/yumdownloader %s %s --disablerepo=* --enablerepo=%s -c %s --destdir=%s %s" % (extra_flags, use_source, pipes.quote(repo.name), temp_file, pipes.quote(dest_path), " ".join(repo.rpm_list)) # now regardless of whether we're doing yumdownloader or reposync # or whether the repo was http://, ftp://, or rhn://, execute all queued @@ -514,7 +515,7 @@ class RepoSync: dists = ",".join(repo.apt_dists) components = ",".join(repo.apt_components) - mirror_data = "--method=%s --host=%s --root=%s --dist=%s --section=%s" % (method,host,mirror,dists,components) + mirror_data = "--method=%s --host=%s --root=%s --dist=%s --section=%s" % (pipes.quote(method), pipes.quote(host), pipes.quote(mirror), pipes.quote(dists), pipes.quote(components)) rflags = "--nocleanup" for x in repo.yumopts: @@ -522,7 +523,7 @@ class RepoSync: rflags += " %s %s" % ( x , repo.yumopts[x] ) else: rflags += " %s" % x - cmd = "%s %s %s %s" % (mirror_program, rflags, mirror_data, dest_path) + cmd = "%s %s %s %s" % (mirror_program, rflags, mirror_data, pipes.quote(dest_path)) if repo.arch == "src": cmd = "%s --source" % cmd else: -- 2.15.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor