Skip to content

ctx project takeover#31

Merged
ewdurbin merged 2 commits into
mainfrom
ctx-account-takeover
May 24, 2022
Merged

ctx project takeover#31
ewdurbin merged 2 commits into
mainfrom
ctx-account-takeover

Conversation

@ewdurbin
Copy link
Copy Markdown
Collaborator

No description provided.

@ewdurbin ewdurbin merged commit bd0d573 into main May 24, 2022
Comment on lines +172 to +173
We also advise PyPI users to enable multi factor authentication on their PyPI
accounts following the references at https://pypi.org/help/#twofa
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We also advise PyPI users to enable multi factor authentication on their PyPI
accounts following the references at https://pypi.org/help/#twofa
We also advise all PyPI users, but especially project maintainers, to enable
multi factor authentication on their PyPI accounts following the references at
https://pypi.org/help/#twofa


Between 2022-05-14T19:18:36Z and 2022-05-24T10:07:17Z the following release
below files were hosted by PyPI at various times containing this malicious
payload
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
payload
payload.


If you installed the package between May 14, 2022 and May 24, 2022, and your
environment variables contain sensitive data like passwords and API keys (like
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY), we advise you rotate your
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY), we advise you rotate your
``AWS_ACCESS_KEY_ID`` and ``AWS_SECRET_ACCESS_KEY``), we advise you rotate your


The ``ctx`` hosted project on PyPI was taken over via user account compromise
and replaced with a malicious project which contained runtime code which
collected the content of ``os.environ.items()``` when instantiating ``Ctx``
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
collected the content of ``os.environ.items()``` when instantiating ``Ctx``
collected the content of ``os.environ.items()`` when instantiating ``Ctx``

* Freeze the compromised user account of the owner

The activity log of the user, action log on the project, metadata for all
historical uploads---including malicious---, archives of the files, and their
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
historical uploads---including malicious---, archives of the files, and their
historical uploads (including malicious), archives of the files, and their

The ``ctx`` project was registered and uploaded to PyPI in 2014. According to
Libraries.io, the project on PyPI that declares it as a dependency is
``context-engine``. No known repositories that Libraries.io analyzes declares
``ctx`` as a dependency.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

publicly visible email addresses associated with project metadata containing
expired domains, which happened to match the domains of owner user accounts for
projects.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Currently, PyPI has some protections in place for expired email domains: if
PyPI sends an email to a user's email address, and that email bounces, PyPI
will disable the verified status of that email. As password resets require
verified email addresses, an attacker would be unable to use the expired domain
to gain access to the account. However, this depends on PyPI sending an email
to the expired domain in the time period between expiry and an attacker
attempting a takeover.


We also advise PyPI users to enable multi factor authentication on their PyPI
accounts following the references at https://pypi.org/help/#twofa

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Additionally, version-pinning and using `hash checking mode
<https://pip.pypa.io/en/stable/topics/secure-installs/#hash-checking-mode`_
would prevent this attack, which depends on users automatically upgrading to
the latest available version at install-time.

@vstinner vstinner deleted the ctx-account-takeover branch May 24, 2022 17:10
di added a commit to di/python-security that referenced this pull request May 24, 2022
ewdurbin added a commit that referenced this pull request May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants