Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-97514: Don't use Linux abstract sockets for multiprocessing #98501

Merged
merged 5 commits into from
Oct 20, 2022

Conversation

gpshead
Copy link
Member

@gpshead gpshead commented Oct 20, 2022

Linux abstract sockets lack any form of permissions so their use allows any process in the same host-local network namespace (which means any user on the system in many default configurations) to inject code into the process. A "same machine Remote Code Execution RCE" vulnerability.

This removes the default preference for abstract sockets in multiprocessing introduced in Python 3.9+ via
#18866 while fixing #84031.

This issue was reported to the PSRT on 2022-09-07 by Devin Jeanpierre @ssbr from Google. @gpshead requested the CVE.

More good reasoning on why to avoid abstract AF_UNIX sockets on Linux: https://web.archive.org/web/20220107100548/https://utcc.utoronto.ca/~cks/space/blog/linux/SocketAbstractNamespace?showcomments#comments

This is intended for backporting to apply to 3.9 - 3.12.


Urgency: The Release Manager @pablogsal has approved having this in 3.11.0. As the issue is Linux only, there is NO urgent need for new Windows or macOS package builds. So even if a new 3.10.x and 3.9.x release is not officially cut while making it public, this small change is trivially back-ported by all involved Linux Python binary package distributors whom we assume will be very interested in having it.


PSRT report & discussion: https://mail.python.org/archives/list/psrt@python.org/thread/WMFW2T2I4P3I7SQHYJEBZTSHRVJT44F6/

gpshead and others added 5 commits October 13, 2022 23:39
Linux abstract sockets are insecure as they lack any form of filesystem
permissions so their use allows anyone on the system to inject code into
the process.

This removes the default preference for abstract sockets in
multiprocessing introduced in Python 3.9+ via
python#18866 while fixing
python#84031.

Explicit use of an abstract socket by a user now generates a
RuntimeWarning.  If we choose to keep this warning, it should be
backported to the 3.7 and 3.8 branches.
The right people won't see it and it won't blame the right code.
@gpshead gpshead added type-bug An unexpected behavior, bug, or error type-security A security issue needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes release-blocker needs backport to 3.11 only security fixes labels Oct 20, 2022
@gpshead gpshead self-assigned this Oct 20, 2022
@gpshead gpshead marked this pull request as ready for review October 20, 2022 21:59
@gpshead gpshead requested a review from Yhg1s October 20, 2022 22:21
@Yhg1s Yhg1s merged commit 49f6106 into python:main Oct 20, 2022
@miss-islington
Copy link
Contributor

Thanks @gpshead for the PR, and @Yhg1s for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10, 3.11.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@bedevere-bot
Copy link

GH-98502 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 20, 2022
…ythonGH-98501)

Linux abstract sockets are insecure as they lack any form of filesystem
permissions so their use allows anyone on the system to inject code into
the process.

This removes the default preference for abstract sockets in
multiprocessing introduced in Python 3.9+ via
python#18866 while fixing
python#84031.

Explicit use of an abstract socket by a user now generates a
RuntimeWarning.  If we choose to keep this warning, it should be
backported to the 3.7 and 3.8 branches.
(cherry picked from commit 49f6106)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Oct 20, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 20, 2022
…ythonGH-98501)

Linux abstract sockets are insecure as they lack any form of filesystem
permissions so their use allows anyone on the system to inject code into
the process.

This removes the default preference for abstract sockets in
multiprocessing introduced in Python 3.9+ via
python#18866 while fixing
python#84031.

Explicit use of an abstract socket by a user now generates a
RuntimeWarning.  If we choose to keep this warning, it should be
backported to the 3.7 and 3.8 branches.
(cherry picked from commit 49f6106)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
@bedevere-bot
Copy link

GH-98503 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Oct 20, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 20, 2022
…ythonGH-98501)

Linux abstract sockets are insecure as they lack any form of filesystem
permissions so their use allows anyone on the system to inject code into
the process.

This removes the default preference for abstract sockets in
multiprocessing introduced in Python 3.9+ via
python#18866 while fixing
python#84031.

Explicit use of an abstract socket by a user now generates a
RuntimeWarning.  If we choose to keep this warning, it should be
backported to the 3.7 and 3.8 branches.
(cherry picked from commit 49f6106)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
@gpshead gpshead deleted the multiprocessing-abstract branch October 20, 2022 23:11
@gpshead gpshead added needs backport to 3.9 only security fixes and removed needs backport to 3.9 only security fixes labels Oct 20, 2022
@miss-islington
Copy link
Contributor

Thanks @gpshead for the PR, and @Yhg1s for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 20, 2022
…ythonGH-98501)

Linux abstract sockets are insecure as they lack any form of filesystem
permissions so their use allows anyone on the system to inject code into
the process.

This removes the default preference for abstract sockets in
multiprocessing introduced in Python 3.9+ via
python#18866 while fixing
python#84031.

Explicit use of an abstract socket by a user now generates a
RuntimeWarning.  If we choose to keep this warning, it should be
backported to the 3.7 and 3.8 branches.
(cherry picked from commit 49f6106)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
@gpshead
Copy link
Member Author

gpshead commented Oct 20, 2022

GH-98504 is the backport of this pull request to the 3.9 branch. (miss-islington created the PR but some how fell over applying labels to it and posting this message here)

miss-islington added a commit that referenced this pull request Oct 20, 2022
…GH-98501) (GH-98503)

Linux abstract sockets are insecure as they lack any form of filesystem
permissions so their use allows anyone on the system to inject code into
the process.

This removes the default preference for abstract sockets in
multiprocessing introduced in Python 3.9+ via
#18866 while fixing
#84031.

Explicit use of an abstract socket by a user now generates a
RuntimeWarning.  If we choose to keep this warning, it should be
backported to the 3.7 and 3.8 branches.
(cherry picked from commit 49f6106)


Co-authored-by: Gregory P. Smith <greg@krypto.org>

Automerge-Triggered-By: GH:gpshead
miss-islington added a commit that referenced this pull request Oct 20, 2022
…GH-98501) (GH-98502)

Linux abstract sockets are insecure as they lack any form of filesystem
permissions so their use allows anyone on the system to inject code into
the process.

This removes the default preference for abstract sockets in
multiprocessing introduced in Python 3.9+ via
#18866 while fixing
#84031.

Explicit use of an abstract socket by a user now generates a
RuntimeWarning.  If we choose to keep this warning, it should be
backported to the 3.7 and 3.8 branches.
(cherry picked from commit 49f6106)


Co-authored-by: Gregory P. Smith <greg@krypto.org>

Automerge-Triggered-By: GH:gpshead
pablogsal pushed a commit that referenced this pull request Oct 22, 2022
…GH-98501) (GH-98502)

Linux abstract sockets are insecure as they lack any form of filesystem
permissions so their use allows anyone on the system to inject code into
the process.

This removes the default preference for abstract sockets in
multiprocessing introduced in Python 3.9+ via
#18866 while fixing
#84031.

Explicit use of an abstract socket by a user now generates a
RuntimeWarning.  If we choose to keep this warning, it should be
backported to the 3.7 and 3.8 branches.
(cherry picked from commit 49f6106)


Co-authored-by: Gregory P. Smith <greg@krypto.org>

Automerge-Triggered-By: GH:gpshead
ambv pushed a commit that referenced this pull request Oct 28, 2022
…H-98501) (#98504)

Linux abstract sockets are insecure as they lack any form of filesystem
permissions so their use allows anyone on the system to inject code into
the process.

This removes the default preference for abstract sockets in
multiprocessing introduced in Python 3.9+ via
#18866 while fixing
#84031.

Explicit use of an abstract socket by a user now generates a
RuntimeWarning.  If we choose to keep this warning, it should be
backported to the 3.7 and 3.8 branches.
(cherry picked from commit 49f6106)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs backport to 3.9 only security fixes release-blocker type-bug An unexpected behavior, bug, or error type-security A security issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants