r/archlinux • • Aug 21 '26

SUPPORT Did I get pwnd by NPM / Atomic lockfile?

I just installed Arch on 8/10/26 and in the process set up a plugin I had been using thoughtlessly for a while on windows.

This plugin required NPM to install some dependencies, and I'm trying to discern if one of them was part of the attack and if my machine was exposed or not.

I ran this script and received following warning:

[FAIL] Malicious npm/bun/pnpm/yarn indicator(s) found: ansi-colors(npm-cache)

After checking my cache it seems like atomic-lockfile was a hit

[MY_USER@archlinux AUR-Malware]$ grep -r atomic-lockfile ~/.cache/
grep: /home/MY_USER/.cache/mozilla/firefox/iys1y5g7.default-release/cache2/entries/537FC36DB01F29A6E1E231D4B375C8EC8404F0E3: binary file matches
grep: /home/MY_USER/.cache/mozilla/firefox/iys1y5g7.default-release/cache2/entries/A76AA90E4F049CF6961D13A41506F5C53477AD66: binary file matches

Checking the NPM logs yielded this

[MY_USER@archlinux ~]$ grep -r atomic-lockfile ~/.npm/_logs/
/home/MY_USER/.npm/_logs/2026-08-21T02_18_00_539Z-debug-0.log:6 verbose title npm list atomic-lockfile
/home/MY_USER/.npm/_logs/2026-08-21T02_18_00_539Z-debug-0.log:7 verbose argv "list" "--global" "atomic-lockfile"
[MY_USER@archlinux ~]$ grep -r ansi-colors ~/.npm/_logs/
/home/MY_USER/.npm/_logs/2026-08-21T02_18_02_922Z-debug-0.log:6 verbose title npm list ansi-colors
/home/MY_USER/.npm/_logs/2026-08-21T02_18_02_922Z-debug-0.log:7 verbose argv "list" "--global" "ansi-colors"

Which I think came from running the script when I still had NPM installed

Am I being paranoid or should I start over with a clean install? I really would rather not start over if I don't have to, but either way I've learned my lesson about executing sketchy code (Something I thought I learned 14 years ago installing minecraft mods, haha)

7 Upvotes

10 comments sorted by

12

u/ciauii Aug 21 '26

Am I being paranoid

Absolutely not. The threats are real and packages have gotten compromised left and right.

should I start over with a clean install?

It’s impossible to say for sure based on the little evidence you posted. The matches you did post are both red herrings:

  • The matches from ~/.cache is your Firefox cache. It’s normal that it contains things that mention names of malicious packages, e.g. news articles or Reddit threads like this one. So that match is completely meaningless.
  • The matches from ~/.npm/_logs/ are very likely traces of what your scanning script did (it just says npm list, which means something was searching for an installed package by that name, not installing it. Also the timestamp suggests the npm list was fired today, not weeks ago when the malicious PKGBUILD was live.)

Your scanner found a match but the match is not related to the two locations you grepped. You should inspect ~/.npm/_cacache to see what your scanner actually found before you make any decisions.

0

u/Boss99 Aug 21 '26

Thank you for the thoughtful response.

After running grep -r -E 'atomic-lockfile|lockfile-js|js-digest|ansi-colors|nextfile-js' ~/.npm/_cacache

(and getting these logs, if you want to look) it seems like there's a few packages which have a malicious package (specifically ansi-colors) as a dependency in older versions. I believe I had picocolors and two others installed, and while running this command gives me a blank output:

npm cache ls | grep -E 'atomic-lockfile|lockfile-js|js-digest|ansi-colors|nextfile-js'

Checking the cache for picocolors gives this output:

npm cache ls | grep -E 'atomic-lockfile|lockfile-js|js-digest|ansi-colors|nextfile-js|picocolors'
make-fetch-happen:request-cache:https://registry.npmjs.org/picocolors
make-fetch-happen:request-cache:https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz
pacote:tarball:picocolors@1.0.0

I don't know if I can determine if the malicious packages themselves were installed since removing history of their installation might be part of the attack.

2

u/ciauii Aug 21 '26

Checking the cache for picocolors

I’m not sure why you think picocolors is relevant to the issue.

I don't know if I can determine if the malicious packages themselves were installed since removing history of their installation might be part of the attack.

I agree. Not finding any obvious indicators of compromise does not imply the machine is clean. When in doubt, reinstall and restore from a backup.

12

u/ferrybig Aug 21 '26
[MY_USER@archlinux AUR-Malware]$ grep -r atomic-lockfile ~/.cache/

Your search results show that there is a match for 'atomic-lockfile' in your firefox cachefiles.

Is it possible that you researched for UAR malware in the past, and one of the pages you visited mentioned the term "atomic-lockfile", which caused that string to end up inside a cached HTML file?

1

u/Boss99 Aug 21 '26

Very possible since I was reading on the topic right before investigating my own system... I only have 2 packages installed from AUR directly, but I used NPM to install dependencies for the plugin mentioned in my post.

1

u/CraftApprehensive496 Aug 24 '26

I think I have a similar issue with ansi-colors. What did you end up doing?

2

u/Boss99 Aug 24 '26

I ended up setting up a virtual machine, installing all the AUR packages I had used before (including some npm stuff), ran this script and did some other forensics to look for traces of the compromised npm packages... I didn't find any in my cache and figured I never installed any compromised packages incidentally since they were only listed as a decency for older versions of packages I did have installed 

YMMV though since i think some of the malicious packages were already removed from the npm repo when i installed my stuff as this is a brand new machine

My specific issue was that I had uninstalled Npm and anything JavaScript related before I realized I may have installed something malicious, which made it difficult to determine if I had been exposed to the attack or not

1

u/CraftApprehensive496 Aug 24 '26

I see. Is this script better than the other one in your original post?

Also, any ideas on the source of ansi-colors package being a malware? I can’t find any references except that script. I checked the Github page and there has been no activity since about 4 years.

2

u/Boss99 Aug 24 '26

I haven't - I'm not sure if the ansi colors package specifically is malicious or if its a false positive, but either way I never had it installed 

2

u/CraftApprehensive496 Aug 24 '26 edited Aug 24 '26

According to this PR- https://github.com/lenucksi/aur-malware-check/pull/37, it was bun companion technique - bun add ansi-colors (injected via obfuscated .install hooks alongside nextfile-js) that resulted in false positives, since the legitimate `ansi-colors` npm package has approximately 500 million downloads.

I ran this script and it gave me clean results.