Back to Intelligence

Axios NPM Supply Chain Compromise: Detecting Industrialized Social Engineering and Malicious Packages

SA
Security Arsenal Team
April 6, 2026
5 min read

Introduction

The recent attack on the axios NPM package is a wake-up call for the software development lifecycle. Threat actors have moved beyond opportunistic typo-squatting; they are now executing sophisticated, industrialized social engineering campaigns aimed directly at maintainers of critical open-source infrastructure. By compromising trusted identities, attackers can inject malicious code directly into production libraries, bypassing traditional perimeter defenses and creating a ripple effect of compromise across thousands of downstream organizations. Defenders must shift their focus from simple dependency scanning to active behavioral monitoring of build pipelines and package registries.

Technical Analysis

Affected Products and Platforms:

  • Platform: Node.js ecosystems (NPM registry)
  • Target Package: axios (HTTP client)
  • Downstream Impact: Any application or CI/CD pipeline executing npm install or npm update during the compromise window.

Attack Chain:

  1. Initial Access (Social Engineering): Threat actors utilized complex, industrialized social engineering (likely masquerading as job offers or security researchers) to trick a maintainer into revealing credentials or executing malicious payloads on their development machine.
  2. Account Takeover: Once authenticated, the attacker gained publishing rights to the axios package namespace.
  3. Supply Chain Injection: A compromised version of the package was published to the NPM registry. This version contained obfuscated JavaScript designed to execute malicious post-install scripts.
  4. Execution: When downstream users or automated build systems installed the package, the malicious script (preinstall or postinstall hook) executed immediately within the context of the build environment.
  5. Payload Delivery: The payload typically exfiltrates sensitive environment variables (e.g., AWS keys, CI tokens) or establishes persistence on the build server.

Exploitation Status:

  • Confirmed Active Exploitation: Yes. The package was briefly published with malicious code before being reverted.
  • Technique: Social Engineering + Supply Chain Compromise (Software Supply Chain).

Detection & Response

Sigma Rules

YAML
---
title: Potential NPM Supply Chain Compromise via Postinstall Scripts
id: 9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects suspicious execution of Node.js child processes (sh, bash, curl) during package installation, indicative of malicious postinstall scripts common in supply chain attacks like Axios.
references:
  - https://attack.mitre.org/techniques/T1195/
  - https://www.darkreading.com/threat-intelligence/axios-attack-complex-social-engineering-industrialized
author: Security Arsenal
date: 2024/11/14
tags:
  - attack.initial_access
  - attack.t1195.002
  - attack.execution
  - attack.t1059.004
logsource:
  category: process_creation
  product: linux
detection:
  selection_parent:
    ParentImage|endswith:
      - '/node'
      - '/npm'
    ParentCommandLine|contains:
      - 'install'
      - 'ci'
  selection_child:
    Image|endswith:
      - '/sh'
      - '/bash'
      - '/curl'
      - '/wget'
      - '/python'
  filter_legit_dev:
    User|contains:
      - 'jenkins'
      - 'gitlab'
      - 'vsts'
      - 'build'
  condition: selection_parent and selection_child and not filter_legit_dev
falsepositives:
  - Legitimate build scripts requiring network requests or system calls during install (rare)
level: high
---
title: NPM Publish Activity from Unusual Location or User
id: b1c2d3e4-5f6a-7b8c-9d0e-1f2a3b4c5d6e
status: experimental
description: Detects execution of 'npm publish' commands. In the context of the Axios attack, detecting publishes outside of known CI/CD pipelines or from unexpected users is critical.
references:
  - https://attack.mitre.org/techniques/T1195/
author: Security Arsenal
date: 2024/11/14
tags:
  - attack.persistence
  - attack.t1508
logsource:
  category: process_creation
  product: linux
detection:
  selection:
    Image|endswith: '/npm'
    CommandLine|contains: 'publish'
  condition: selection
falsepositives:
  - Authorized releases by maintainers
level: medium

KQL (Microsoft Sentinel / Defender)

KQL — Microsoft Sentinel / Defender
// Hunt for suspicious Node child processes indicative of supply chain malware
// Looks for node or npm spawning shells or network tools
DeviceProcessEvents
| where Timestamp > ago(7d)
| where InitiatingProcessFileName in~ ("node", "npm")
| where InitiatingProcessCommandLine contains_any ("install", "update", "ci")
| where FileName in~ ("sh", "bash", "powershell", "cmd", "curl", "wget", "python")
| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, InitiatingProcessCommandLine, FileName, CommandLine, FolderPath
| order by Timestamp desc

Velociraptor VQL

VQL — Velociraptor
-- Hunt for obfuscated JavaScript files in node_modules that may contain base64 or hex encoded payloads
-- Common in sophisticated supply chain attacks like the Axios compromise
SELECT FullPath, Size, Mtime
FROM glob(globs="/*/node_modules/**/*.js")
WHERE read_file(filename=FullPath, length=10000) =~ "eval\("
   OR read_file(filename=FullPath, length=10000) =~ "Buffer\.from"
   OR read_file(filename=FullPath, length=10000) =~ "atob"
   OR read_file(filename=FullPath, length=10000) =~ "\\x[0-9a-f]{2}"

Remediation Script (Bash)

Bash / Shell
#!/bin/bash
# Audit script to check for integrity of Axios and suspicious scripts in node_modules
echo "[+] Auditing package-lock. for axios integrity..."

# Check for axios in package-lock and verify version integrity (Example logic)
if grep -q '"axios"' package-lock.; then
    echo "[!] Axios found in dependencies."
    # Extract installed version
    INSTALLED_VERSION=$(grep -A 5 '"axios"' package-lock. | grep -o '"version": "[^"]*"' | head -n 1 | cut -d'"' -f 4)
    echo "[+] Installed Version: $INSTALLED_VERSION"
else
    echo "[-] Axios not found in this project."
fi

echo "[+] Scanning node_modules/.hooks for suspicious scripts..."
if [ -d "node_modules/.hooks" ]; then
    find node_modules/.hooks -type f -exec ls -la {} \;
else
    echo "[-] No .hooks directory found."
fi

echo "[+] Checking for preinstall scripts in package. of dependencies..."
find node_modules -name "package." -exec sh -c 'grep -l "preinstall" "$1" 2>/dev/null && echo "Found preinstall in: $1"' _ {} \;

echo "[+] Remediation: Run 'npm audit fix' and manually verify the integrity of axios source code if suspicious versions were found."

Remediation

Immediate Actions:

  1. Audit Dependencies: Immediately check package-lock. files to ensure the axios version matches the official, uncompromised release. Revert to known good commits if compromised versions were pulled.
  2. Rotate Secrets: Treat build environments as compromised. Rotate all API keys, tokens, and credentials that may have been present in environment variables during a build or install operation within the last 30 days.
  3. Maintainer Hygiene: If you maintain open-source packages, enforce hardware security keys (FIDO2) for NPM registry authentication. Never execute commands from strangers in DMs, regardless of how professional the "job offer" or "security report" appears.

Long-Term Protections:

  • Branch Protection & CI gating: Require signed commits and manual approval (code review) before any publishing action can run in CI/CD.
  • Dependency Pinning: Avoid using semantic version ranges (e.g., ^1.0.0) in production builds; pin exact versions and control updates via pull requests.
  • Registry Provenance: Enable and enforce NPM's digital signature/provenance features to verify that packages were published by the intended maintainer's build pipeline.

Official Vendor Resources:

Related Resources

Security Arsenal Managed SOC Services AlertMonitor Platform Book a SOC Assessment soc-mdr Intel Hub

socthreat-intelmanaged-socnpmaxiossupply-chainsocial-engineeringnodejs

Is your security operations ready?

Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.