Bug 998223 (CVE-2013-4259)
Summary: | CVE-2013-4259 ansible: insecure location for ssh ControlMaster socket | ||||||
---|---|---|---|---|---|---|---|
Product: | [Other] Security Response | Reporter: | Michael S. <misc> | ||||
Component: | vulnerability | Assignee: | Red Hat Product Security <security-response-team> | ||||
Status: | CLOSED ERRATA | QA Contact: | |||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | unspecified | CC: | athmanem, jrusnack, kevin, maxim, security-response-team, vdanen, vkrizan | ||||
Target Milestone: | --- | Keywords: | Security | ||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2017-05-12 07:04:19 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | 999621, 1001454 | ||||||
Bug Blocks: | 998712 | ||||||
Attachments: |
|
Description
Michael S.
2013-08-18 11:40:22 UTC
The issue is in https://github.com/ansible/ansible/blob/devel/lib/ansible/runner/connection_plugins/ssh.py#L59 Possible fix : commit d06eaae5fa32ae24e8076f846bdf3f04e6090384 Author: Michael Scherer <misc> Date: Sun Aug 18 13:19:01 2013 +0200 Try to mitigate symlink attacks on newer platform A attacker could pre create a socket in /tmp and so divert the ssh connexion to another server. However, newer platform are protected against this since kernel 3.10 and surely with a proper selinux policy. diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py index abbffcf..be8289e 100644 --- a/lib/ansible/runner/connection_plugins/ssh.py +++ b/lib/ansible/runner/connection_plugins/ssh.py @@ -51,12 +51,15 @@ class Connection(object): self.common_args = [] extra_args = C.ANSIBLE_SSH_ARGS + control_path_dir = '/tmp' + if 'XDG_RUNTIME_DIR' in os.environ: + control_path_dir = os.environ['XDG_RUNTIME_DIR'] if extra_args is not None: self.common_args += shlex.split(extra_args) else: self.common_args += ["-o", "ControlMaster=auto", "-o", "ControlPersist=60s", - "-o", "ControlPath=/tmp/ansible-ssh-%h-%p-%r"] + "-o", "ControlPath=%s/ansible-ssh-%%h-%%p-%%r" % control_path_dir] if not C.HOST_KEY_CHECKING: self.common_args += ["-o", "StrictHostKeyChecking=no"] Created attachment 787788 [details]
better patch
So here is a proper patch, using a temporary directory shared during the playbook run.
However, it could be written more cleanly without using global, and using proper object lifecycle, but I consider that being minor when compared to the security fix.
Hi, Michael. The best thing to do here would be to alert upstream to this. We can assign a CVE for this that you can pass along as well, and then we can open this bug up and get fixes into Fedora and EPEL6 once the issue is fixed upstream. Acknowledgements: Red Hat would like to thank Michael Scherer for reporting this issue. Michael, when you report this to upstream can you also note that it was assigned CVE-2013-4259? Thanks. Yep, will do. I keep you in CC to see how we organize the embargo, if upstream want one. Created ansible tracking bugs for this issue: Affects: fedora-all [bug 999621] This is public now: https://groups.google.com/forum/#!topic/ansible-project/UVDYW0HGcNg Created ansible tracking bugs for this issue: Affects: epel-6 [bug 1001454] ansible-1.2.3-2.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report. ansible-1.2.3-2.fc18 has been pushed to the Fedora 18 stable repository. If problems still persist, please make note of it in this bug report. ansible-1.2.3-2.fc19 has been pushed to the Fedora 19 stable repository. If problems still persist, please make note of it in this bug report. |