PyPI

The ctx PyPI and phpass Supply Chain Attack

Updated 5 Oct 2026 · Incident date 21 May 2022

The ctx package on PyPI and hautelook/phpass on Packagist were hijacked and sent the host's environment variables to a stranger in May 2022.

The last real ctx release was in December 2014, so the new releases looked like a revival of an old package. Both packages sent the host's environment variables to the attacker.

What happened

The attacker took over two long-idle packages and added code that stole environment variables.

  • The attacker bought the expired domain figlief[.]com on 14 May 2022 and used the password reset to take the PyPI account.
  • Checkmarx dates the account takeover to 15 May and the malicious ctx versions to 21 May 2022.
  • For phpass, the attacker registered the closed hautelook GitHub account name on 15 May 2022 and added malicious commits on 19 May.
  • The code encodes all environment variables in Base64 and sends them to anti-theft-web.herokuapp[.]com. The code aims at AWS credentials.
  • In phpass the original function kept working as cover.

Detection came on 24 May 2022.

Affected versions

  • ctx on PyPI: 0.1.2 (the old release was replaced with tainted code), 0.2.2 and 0.2.6. Sonatype says later versions also held the code.
  • hautelook/phpass on Packagist, in the same time window.
  • Checkmarx also names optimistdigital/nova-tailwind as hit by the same attacker through a recreated GitHub name.
  • The last real ctx release was 0.1.2 on 19 December 2014. The last real phpass update was 31 August 2012.

Indicators of compromise

  • Exfiltration host: anti-theft-web.herokuapp[.]com, and the path /hacked/ reported by Sonatype.
  • ctx versions 0.2.2 or 0.2.6, or a 0.1.2 that was installed after 21 May 2022.
  • Domain tied to the hijacked account: figlief[.]com.
  • Sonatype tracking ID: sonatype-2022-3060.

How to check

Check whether ctx is installed and which version.

pip show ctx

Search code and logs for the exfiltration host.

grep -rn "anti-theft-web" . $(python3 -c "import site;print(site.getsitepackages()[0])") 2>/dev/null

What to do now

  1. Remove ctx from every environment where it is installed.
  2. If ctx or the bad phpass ran, rotate every secret in the environment variables of that host, especially AWS keys. Review AWS CloudTrail for use of those keys after May 2022.
  3. For PHP, run grep -n "hautelook/phpass" composer.lock and read the commit hash. Use a maintained phpass fork and pin the commit hash.
  4. Block the Heroku host at the network edge.

What Vigilance would show

These examples show an install hold and the corresponding owner report.

Example install message

Vigilance blocked `ctx` 0.1.2. This version is too new or changed in a way Vigilance must check first.

Example owner report

Bad update

ctx 0.1.2

A small helper library gained the ability to read the machine's stored cloud passwords and mail them to a stranger.

See what to do now.

No security team? See who reads the alert.

Frequently asked questions

Who was the attacker?

The Hacker News names an Istanbul-based researcher who said the goal was to show a weakness in supply chains.

How popular was the PHP package?

The Hacker News describes hautelook/phpass as a Packagist fork with few installs.

Sources

  1. thehackernews.com/2022/05/pypi-package-ctx-and-php-library-phpass.html
  2. checkmarx.com/blog/attacker-caught-hijacking-packages-using-multiple-techniques-to-steal-aws-credentials/
  3. sonatype.com/blog/pypi-package-ctx-compromised-are-you-at-risk

Send this page to the person who looks after AI at your company.

Email it

More supply chain attacks

All 172 attacks in the library · What is a supply chain attack? · How to prevent supply chain attacks

Check the next update before you install it

Vigilance compares the version you trust with the new one. It names the one file that gained a power the old version did not have.

Start the free 14-day trialBrowse the attack library