Atomic Arch: Part 2 - Technical Deep Dive

17 June 2026 | Author: Ley

This is the technical continuation of the Atomic Arch analysis. Here, I'll provide the actual source code and detailed reverse engineering notes for the atomic-lockfile package.

⚠️ WARNING: The following contains LIVE MALWARE. Do not execute or download unless you are in a secure, isolated environment. The author takes NO responsibility for any damage caused by misuse.


How I Obtained the Package

The original atomic-lockfile@1.4.2 and nextfile-js@1.4.2 packages were quickly removed from the official npm registry after discovery. However, they remained accessible via Chinese mirrors:


Package Structure Analysis

Both packages (atomic-lockfile and nextfile-js) are structurally identical. Here's the layout:

atomic-lockfile/
├── package.json          # Contains "preinstall": "./src/hooks/deps"
├── README.md             # Looks like a legitimate file-locking library
├── src/
│   └── hooks/
│       └── deps          # ELF binary (the actual malware)
└── dist/                 # Normal-looking compiled code

The Pivotal File: package.json

The trigger for the entire attack is in the package.json scripts section:

"scripts": {
    "preinstall": "./src/hooks/deps"
}

This hook executes immediately when the package is installed via npm. No user interaction is required.


The Payload: deps (ELF Binary)

The malicious binary is a stripped, 64-bit Linux ELF written in Rust. Its key characteristics:

Key Functions Identified:


Community Tools

Several detection tools have been developed by the community:

All tools are available at: github.com/lenucksi/aur-malware-check


IOCs (Indicators of Compromise)


Detection Commands

Run these on any potentially affected system:

# Check for infected AUR packages
curl -s https://raw.githubusercontent.com/lenucksi/aur-malware-check/master/aur_check-v2.sh | bash

# Or, manually scan for npm cache leftovers
find ~/.npm -name "*atomic-lockfile*" -type d 2>/dev/null

# Check for systemd persistence
systemctl list-units --type=service --state=running | grep -E "atomic|nextfile|lockfile"

# Check for eBPF rootkit maps (requires root)
sudo bpftool map list | grep -E "hidden_(pids|names|inodes)"

Mitigation & Recovery Steps

  1. Immediate: Rotate ALL credentials (SSH keys, API tokens, passwords, session cookies).
  2. Detection: Run the community detection scripts to identify infected packages.
  3. Removal: Remove affected AUR packages and npm caches.
  4. Persistence: Check for and remove any suspicious systemd units.
  5. Full recovery: If rootkit or persistence is found, perform a clean OS reinstall from trusted media.
  6. Long-term: Adopt practices like reviewing PKGBUILD diffs and using npm install --ignore-scripts for manual installs.

References & Further Reading


This concludes the technical analysis of the Atomic Arch campaign. The source code is available for research purposes only at blog.unionium.org/atomic.tgz.

Yours, Ley.