Skip to content
Account takeover Write-up Intermediate

How I Hacked Ctx And Phpass Modules

The author found that package owners on PyPI and Packagist had email domains that had expired, allowing him to register those domains and reset the owners' passwords to take over the packages. He also found a way to bypass GitHub's restriction on creating repositories with retired names by changing his username temporarily.

sockpuppets Follow

Published on infosecwriteups.com

All this research DOES NOT contain any malicious activity. I want to show how this simple attack affects +10M users and companies.

sockpuppets, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the package registries allowed password resets to email addresses on domains that had expired and were available for anyone to register.

Impact

The author could take over popular packages and distribute malicious code to millions of users, and he received 1000 environment variables from victims who installed the modified packages.

What the attacker needed

Expired domain of package owner; ability to register domain; package registry allows password reset

The fix

The author suggests that package authors should not be able to modify the oldest versions, and GitHub did not fix the repository name bypass.

How it was found

  1. Scrape package registries to find owners whose GitHub profiles or email domains no longer exist.
  2. Register the expired domain and create an email account matching the owner's address.
  3. Request a password reset for the package owner account and use the new email to set a new password.
  4. Log in to the package owner account and upload a new version or modify an existing version with malicious code.
  5. For GitHub, change username to a random string, create the desired repository, then change username back to the original to bypass the retired repository restriction.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When you sign up for a website, you often use an email address. If that email address stops working because the domain expired, someone else can buy the domain and receive password reset emails. This lets them take over your account. The author did this to take over software packages that millions of people download.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

More by sockpuppets

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.