In the past few weeks, a sophisticated phishing campaign has targeted maintainers of packages on the Python Package Index (PyPI), exploiting domain confusion and deceptively authentic-looking emails to harvest login credentials.
The fraudulent emails, purporting to come from the Python Packaging Authority (PyPA), warn recipients that their accounts will be suspended unless they “verify their email address” for “account maintenance and security procedures.”
Unsuspecting maintainers who follow the embedded link find themselves on pypi-mirror.org, a site masquerading as an official PyPI portal but wholly unaffiliated with the Python Software Foundation (PSF).<p style=”text-align: center;”><em>Figure 1: Example of the phishing email’s header and forged links</em></p>
Campaign Tactics and Technical Details
The phishing messages employ a near-identical header and footer to legitimate PyPI notifications, including the use of PyPI’s logo and a footer link labeled “[email protected]” that actually opens a mail client to the genuine address.
Hyperlinks in the body text are obfuscated through URL shorteners or subdomain variations, redirecting users to pypi-mirror.org. Once on the malicious domain, the landing page presents a login form visually indistinguishable from the authentic PyPI sign-in page.
JavaScript code on the page captures the submitted credentials and transmits them via an AJAX POST request to the attacker’s command-and-control server. This technique bypasses simple URL inspections by leveraging an inline script that only executes after form submission.
Further complicating detection, the attackers have registered multiple look-alike domains such as pypi-verify.org and pythonpkgs.org.
Each domain employs valid HTTPS certificates obtained from free certificate authorities, ensuring the padlock icon appears in the browser’s address bar.
Users relying solely on HTTPS indicators are therefore unlikely to suspect foul play. Additionally, the phishing infrastructure is hosted on widely used content delivery networks, making takedown requests less effective unless they are coordinated with the network providers.
PyPI’s Defensive Measures and Recommendations
To mitigate the campaign’s impact, PyPI administrators are working closely with domain registrars and CDN operators to suspend the malicious domains.
They are also submitting these domains to industry-wide phishing blocklists, prompting major browsers to display warnings before users access suspicious sites.
PyPI has established collaborative channels with maintainers of other popular open-source repositories, including npm and RubyGems, to share intelligence and streamline domain takedown processes.
Recognizing the limitations of TOTP-based two-factor authentication (2FA) against phishing, PyPI is exploring the integration of phishing-resistant hardware security keys under WebAuthn.
While widespread adoption will require time and user education, hardware tokens significantly reduce the risk of credential interception by preventing attacker-controlled forms from initiating authentication requests.
Maintainers are urged to adopt the following best practices: never click on unsolicited links, especially if password managers fail to auto-fill credentials; enable phishing-resistant two-factor authentication (2FA) where possible; and regularly review their account’s Security History for anomalous login attempts.
Report suspected phishing attempts to [email protected] and share warnings within developer communities to raise collective awareness. As domain-confusion attacks continue to evolve, vigilance and community collaboration remain the most effective defenses.
Find this Story Interesting! Follow us on Google News , LinkedIn and X to Get More Instant Updates