Executive Summary
Security researchers have uncovered a sophisticated supply-chain attack targeting Python developers via a malicious package hosted on the Python Package Index (PyPI). The package, named requests-aws-v2, was designed to typosquat the legitimate requests-aws library. Upon installation, the package silently scans local environment variables and developer configuration directories, exfiltrating active AWS IAM access keys, secret keys, and session tokens to a remote command-and-control (C2) server.
Deep-Dive Technical Analysis
The attack mechanism relies on a heavily obfuscated setup.py script that executes automatically during package installation via pip. The malicious payload decodes a Base64-encoded Python script that inspects environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN) and reads local credential files located at ~/.aws/credentials and ~/.aws/config.
Once collected, the sensitive cloud credentials are encrypted using AES-256-GCM and transmitted via an HTTPS POST request to an attacker-controlled endpoint operating behind a Cloudflare proxy. The payload also installs a persistent cron job (on Linux/macOS) or a scheduled task (on Windows) to maintain backdoor access and monitor for newly created AWS profiles or rotated API tokens.
Industry Impact and Recommendations/Mitigations
Supply-chain compromises targeting developer environments pose severe systemic risks to enterprise cloud infrastructure. Stolen AWS credentials enable threat actors to perform unauthorized cloud resource provisioning, access sensitive S3 storage buckets, alter IAM policies, and launch secondary supply-chain attacks against production software builds.
Recommended Mitigations
* Remove Malicious Dependencies: Immediately audit Python virtual environments and requirements.txt files for requests-aws-v2 and remove the package.
* Rotate Cloud Credentials: Revoke and rotate all AWS IAM access keys and secret tokens used on developer workstations where the package was installed.
* Enforce Private Package Repositories: Implement internal repository proxies (e.g., AWS CodeArtifact, JFrog Artifactory) with strict package allowlisting to prevent direct downloading of unverified public PyPI packages.
* Implement IAM Least Privilege: Restrict developer IAM roles using permission boundaries and enforce short-lived temporary session credentials via AWS STS and SSO.
________________
Report Details:
Analysis Date: Date
Reviewed By: Person