{"action":"opened","number":1941,"pull_request":{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1941","id":64939307,"html_url":"https://github.com/ansible/ansible-modules-extras/pull/1941","diff_url":"https://github.com/ansible/ansible-modules-extras/pull/1941.diff","patch_url":"https://github.com/ansible/ansible-modules-extras/pull/1941.patch","issue_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/1941","number":1941,"state":"open","locked":false,"title":"do not use a predictable filenames in the LXC plugin","user":{"login":"evgeni","id":94284,"avatar_url":"https://avatars.githubusercontent.com/u/94284?v=3","gravatar_id":"","url":"https://api.github.com/users/evgeni","html_url":"https://github.com/evgeni","followers_url":"https://api.github.com/users/evgeni/followers","following_url":"https://api.github.com/users/evgeni/following{/other_user}","gists_url":"https://api.github.com/users/evgeni/gists{/gist_id}","starred_url":"https://api.github.com/users/evgeni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evgeni/subscriptions","organizations_url":"https://api.github.com/users/evgeni/orgs","repos_url":"https://api.github.com/users/evgeni/repos","events_url":"https://api.github.com/users/evgeni/events{/privacy}","received_events_url":"https://api.github.com/users/evgeni/received_events","type":"User","site_admin":false},"body":"##### ISSUE TYPE\r\n\r\n - Bugfix Pull Request\r\n\r\n##### COMPONENT NAME\r\n\r\nlxc_container\r\n\r\n##### ANSIBLE VERSION\r\n\r\nGit\r\n\r\n##### SUMMARY\r\n\r\nThe attach script of the LXC module currently uses predictable names, allowing symlink attacks.\r\nUsing mkstemp and not NamedTempFile to keep Py 2.4 compat :(\r\n\r\nCVE-2016-3096\r\n\r\nPoC:\r\n\r\n    root@container:/# cd /opt/\r\n    root@container:/opt# echo foo > foo\r\n    root@container:/opt# ln -s foo .lxc-attach-script\r\n    root@container:/opt# ls -alh\r\n    total 12K\r\n    drwxr-xr-x  2 root root 4.0K Apr  1 13:46 .\r\n    drwxr-xr-x 22 root root 4.0K Apr  1 13:39 ..\r\n    lrwxrwxrwx  1 root root    3 Apr  1 13:46 .lxc-attach-script -> foo\r\n    -rw-r--r--  1 root root    4 Apr  1 13:46 foo\r\n    root@container:/opt# cat foo \r\n    foo\r\n    \r\n    # run ansible with \"container_command: echo bar\"\r\n    \r\n    root@container:/opt# cat foo \r\n    #!/usr/bin/env bash\r\n    pushd \"$(grep $(whoami) /etc/passwd | awk -F':' '{print $6}')\"\r\n        if [[ -f \".bashrc\" ]];then\r\n            source .bashrc\r\n        fi\r\n    popd\r\n    \r\n    # User defined command\r\n    echo bar\r\n","created_at":"2016-04-01T12:48:02Z","updated_at":"2016-04-01T12:48:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1941/commits","review_comments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1941/comments","review_comment_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/1941/comments","statuses_url":"https://api.github.com/repos/ansible/ansible-modules-extras/statuses/114f313eb840e39468dba364236a593cb8e2f79e","head":{"label":"evgeni:lxc-predictable-filenames","ref":"lxc-predictable-filenames","sha":"114f313eb840e39468dba364236a593cb8e2f79e","user":{"login":"evgeni","id":94284,"avatar_url":"https://avatars.githubusercontent.com/u/94284?v=3","gravatar_id":"","url":"https://api.github.com/users/evgeni","html_url":"https://github.com/evgeni","followers_url":"https://api.github.com/users/evgeni/followers","following_url":"https://api.github.com/users/evgeni/following{/other_user}","gists_url":"https://api.github.com/users/evgeni/gists{/gist_id}","starred_url":"https://api.github.com/users/evgeni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evgeni/subscriptions","organizations_url":"https://api.github.com/users/evgeni/orgs","repos_url":"https://api.github.com/users/evgeni/repos","events_url":"https://api.github.com/users/evgeni/events{/privacy}","received_events_url":"https://api.github.com/users/evgeni/received_events","type":"User","site_admin":false},"repo":{"id":55070626,"name":"ansible-modules-extras","full_name":"evgeni/ansible-modules-extras","owner":{"login":"evgeni","id":94284,"avatar_url":"https://avatars.githubusercontent.com/u/94284?v=3","gravatar_id":"","url":"https://api.github.com/users/evgeni","html_url":"https://github.com/evgeni","followers_url":"https://api.github.com/users/evgeni/followers","following_url":"https://api.github.com/users/evgeni/following{/other_user}","gists_url":"https://api.github.com/users/evgeni/gists{/gist_id}","starred_url":"https://api.github.com/users/evgeni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evgeni/subscriptions","organizations_url":"https://api.github.com/users/evgeni/orgs","repos_url":"https://api.github.com/users/evgeni/repos","events_url":"https://api.github.com/users/evgeni/events{/privacy}","received_events_url":"https://api.github.com/users/evgeni/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/evgeni/ansible-modules-extras","description":"Ansible extra modules - these modules ship with ansible","fork":true,"url":"https://api.github.com/repos/evgeni/ansible-modules-extras","forks_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/forks","keys_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/keys{/key_id}","collaborators_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/teams","hooks_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/hooks","issue_events_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/issues/events{/number}","events_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/events","assignees_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/assignees{/user}","branches_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/branches{/branch}","tags_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/tags","blobs_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/git/refs{/sha}","trees_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/git/trees{/sha}","statuses_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/statuses/{sha}","languages_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/languages","stargazers_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/stargazers","contributors_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/contributors","subscribers_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/subscribers","subscription_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/subscription","commits_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/commits{/sha}","git_commits_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/git/commits{/sha}","comments_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/comments{/number}","issue_comment_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/issues/comments{/number}","contents_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/contents/{+path}","compare_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/compare/{base}...{head}","merges_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/merges","archive_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/downloads","issues_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/issues{/number}","pulls_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/pulls{/number}","milestones_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/milestones{/number}","notifications_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/labels{/name}","releases_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/releases{/id}","deployments_url":"https://api.github.com/repos/evgeni/ansible-modules-extras/deployments","created_at":"2016-03-30T14:38:01Z","updated_at":"2016-03-30T14:38:05Z","pushed_at":"2016-04-01T12:47:34Z","git_url":"git://github.com/evgeni/ansible-modules-extras.git","ssh_url":"git@github.com:evgeni/ansible-modules-extras.git","clone_url":"https://github.com/evgeni/ansible-modules-extras.git","svn_url":"https://github.com/evgeni/ansible-modules-extras","homepage":"","size":6927,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"devel"}},"base":{"label":"ansible:devel","ref":"devel","sha":"daddc7caf40b8dfbec91f3c6ce3e1aba934e7744","user":{"login":"ansible","id":1507452,"avatar_url":"https://avatars.githubusercontent.com/u/1507452?v=3","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"repo":{"id":24474138,"name":"ansible-modules-extras","full_name":"ansible/ansible-modules-extras","owner":{"login":"ansible","id":1507452,"avatar_url":"https://avatars.githubusercontent.com/u/1507452?v=3","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ansible/ansible-modules-extras","description":"Ansible extra modules - these modules ship with ansible","fork":false,"url":"https://api.github.com/repos/ansible/ansible-modules-extras","forks_url":"https://api.github.com/repos/ansible/ansible-modules-extras/forks","keys_url":"https://api.github.com/repos/ansible/ansible-modules-extras/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ansible/ansible-modules-extras/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ansible/ansible-modules-extras/teams","hooks_url":"https://api.github.com/repos/ansible/ansible-modules-extras/hooks","issue_events_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/events{/number}","events_url":"https://api.github.com/repos/ansible/ansible-modules-extras/events","assignees_url":"https://api.github.com/repos/ansible/ansible-modules-extras/assignees{/user}","branches_url":"https://api.github.com/repos/ansible/ansible-modules-extras/branches{/branch}","tags_url":"https://api.github.com/repos/ansible/ansible-modules-extras/tags","blobs_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/refs{/sha}","trees_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ansible/ansible-modules-extras/statuses/{sha}","languages_url":"https://api.github.com/repos/ansible/ansible-modules-extras/languages","stargazers_url":"https://api.github.com/repos/ansible/ansible-modules-extras/stargazers","contributors_url":"https://api.github.com/repos/ansible/ansible-modules-extras/contributors","subscribers_url":"https://api.github.com/repos/ansible/ansible-modules-extras/subscribers","subscription_url":"https://api.github.com/repos/ansible/ansible-modules-extras/subscription","commits_url":"https://api.github.com/repos/ansible/ansible-modules-extras/commits{/sha}","git_commits_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/commits{/sha}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/comments{/number}","issue_comment_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/comments{/number}","contents_url":"https://api.github.com/repos/ansible/ansible-modules-extras/contents/{+path}","compare_url":"https://api.github.com/repos/ansible/ansible-modules-extras/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ansible/ansible-modules-extras/merges","archive_url":"https://api.github.com/repos/ansible/ansible-modules-extras/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ansible/ansible-modules-extras/downloads","issues_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues{/number}","pulls_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls{/number}","milestones_url":"https://api.github.com/repos/ansible/ansible-modules-extras/milestones{/number}","notifications_url":"https://api.github.com/repos/ansible/ansible-modules-extras/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ansible/ansible-modules-extras/labels{/name}","releases_url":"https://api.github.com/repos/ansible/ansible-modules-extras/releases{/id}","deployments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/deployments","created_at":"2014-09-25T20:28:42Z","updated_at":"2016-04-01T00:08:27Z","pushed_at":"2016-04-01T12:25:49Z","git_url":"git://github.com/ansible/ansible-modules-extras.git","ssh_url":"git@github.com:ansible/ansible-modules-extras.git","clone_url":"https://github.com/ansible/ansible-modules-extras.git","svn_url":"https://github.com/ansible/ansible-modules-extras","homepage":"","size":13013,"stargazers_count":536,"watchers_count":536,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1081,"mirror_url":null,"open_issues_count":524,"forks":1081,"open_issues":524,"watchers":536,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1941"},"html":{"href":"https://github.com/ansible/ansible-modules-extras/pull/1941"},"issue":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/1941"},"comments":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/1941/comments"},"review_comments":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1941/comments"},"review_comment":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1941/commits"},"statuses":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/statuses/114f313eb840e39468dba364236a593cb8e2f79e"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":2,"additions":4,"deletions":12,"changed_files":1}}