githubEdit

Supply Chain Attacks

Overview

Supply chain attacks target the software development and delivery process, compromising dependencies, build systems, or distribution channels to inject malicious code into legitimate software.

Dependency Confusion

Concept

When an organization uses private packages with the same name available on public registries, attackers can upload malicious packages with higher version numbers to public registries.

Exploitation

# 1. Find private package names
# Look in package.json, requirements.txt, pom.xml, etc.
# Check JavaScript source for import statements
grep -r "require\|import" --include="*.js" .

# 2. Check if package exists on public registry
npm view private-package-name
pip index versions private-package-name

# 3. Create malicious package with higher version
# npm
npm init
# Set version higher than internal (e.g., 99.0.0)
npm publish

# pip
# Create setup.py with higher version
python setup.py sdist
twine upload dist/*

Detection

Typosquatting

Concept

Registering package names similar to popular packages to catch typos.

Common Patterns

Finding Vulnerable Packages

CI/CD Pipeline Attacks

GitHub Actions Exploitation

GitLab CI Exploitation

Jenkins Exploitation

Package Repository Attacks

NPM

PyPI

Maven/Gradle

Third-Party Library Vulnerabilities

Discovery

Exploitation Research

Source Code Repository Attacks

Exposed Credentials in Repositories

Commit Signature Verification Bypass

Attack Vectors Summary

Vector
Target
Impact

Dependency Confusion

Private packages

Code execution

Typosquatting

Developers

Credential theft

CI/CD Injection

Build pipelines

Code execution, secrets

Malicious Packages

Package registries

Supply chain compromise

Compromised Maintainer

Open source projects

Backdoors

Build System Compromise

Build servers

Signed malware

Detection & Prevention

For Attackers (Testing)

For Defenders

Tools

Resources

Last updated

Was this helpful?