Built byPhoenix

© 2026 Phoenix

Blog

September 14, 2026·6 min read

The Fix That Didn't Remove the Malware

A cleanup commit for a supply-chain dropper was reviewed and merged, and the malware was still there. How it hid behind hundreds of tabs, why the diff lied, and the required check that now catches it by shape.

  • Security
  • Supply Chain
  • Incident Response
  • CI/CD
  • GitHub Actions

On a Monday in early September, a commit landed in our main repository at Ellum with the message security: remove supply-chain malware dropper. It was reviewed. It was merged. The diff was one line out, one line in. Everyone moved on.

Two days later I read the file at that exact commit, byte by byte. The malware was still there: same file size, same 7,613-character line, same attacker wallet. Nothing had re-infected the repository. The payload had simply never been removed.

This is the write-up of that incident: how the payload hid, why the first fix looked right and wasn't, and what we changed so a fix can't pass review without actually removing anything.

What we found

Eight of our nine repositories carried the same kind of dropper.

  • In six web apps it lived in postcss.config.mjs, a file nobody reads because it never changes.
  • In the other two it was a file in public/fonts/ with a .woff2 extension that was not a font. A real WOFF2 file starts with the bytes wOF2. These didn't.

Open the infected config in an editor and you see a perfectly normal PostCSS config. The payload is on the same line, after 273 to 311 tab characters. Unless your editor wraps long lines and you scroll a long way right, you never see it. A diff shows one changed line, because that's all it is: one very long line.

The attacker had also added entries to .gitignore to keep their working files out of git status. That should have been the first clue that this was deliberate and careful, not a one-off.

What the payload does

It's a variant of a technique usually called EtherHiding. Stripped of the obfuscation, it does five things:

  1. Injects createRequire(import.meta.url) above the config, so a CommonJS payload gets a working require inside an ES module.
  2. Stashes require and module on global, and tags the victim with an ID that differs per repository.
  3. Calls public Ethereum RPC endpoints (eth_blockNumber, eth_getBlockByNumber, eth_getTransactionCount) to find transactions sent by an attacker-controlled wallet.
  4. Decodes the next stage from the transaction's calldata and decompresses it.
  5. Spawns that next stage as a detached process, with the process environment appended to the code.

Two details make this nasty.

It runs on every build. PostCSS loads its config during next build and next dev. Every developer machine and every CI runner that built one of these repositories executed the dropper, and handed it the environment: every secret in .env, every CI variable.

The command-and-control server is the blockchain. There is no domain to block and no host to take down. The attacker updates the payload by sending a transaction. You can block egress to the public RPC hosts, but that is mitigation. It is not a fix.

The fix that wasn't

The first cleanup commit changed one line. In a diff viewer that is exactly what a successful removal looks like: the long line goes out, a clean line comes in.

Except the line that went out and the line that came in were both the long line. Whatever edited the file had cleaned the part it could see, the visible PostCSS config at the start of the line, and kept everything after the tabs. The file was still 7,815 bytes. The 7,613-character line was still there. The wallet address was still in it.

I only caught it because I stopped trusting the diff and read the file at the commit:

bash
git show <sha>:postcss.config.mjs | wc -c                                   # sizegit show <sha>:postcss.config.mjs | awk '{ print length }' | sort -n | tail -1   # longest line

A clean PostCSS config is a few hundred bytes with nothing longer than about fifty characters. Two numbers told the whole story.

One more trap: GitHub's code search didn't return one of the infected repositories for the payload's indicators at all. Code search on private repositories isn't a complete index. It's fine for exploring; it is not evidence that something is gone.

Cleaning up for real

The order matters here.

  1. Assume execution. Anyone who had built an infected repository since the payload arrived had run it. Treat those machines and CI runners as compromised.
  2. Rotate first. The payload ships the environment out, so every credential those builds could see is exposed: CI secrets, deploy tokens, database URLs, AI provider keys, social tokens, npm and GitHub tokens. Cleaning git without rotating leaves the attacker holding the keys.
  3. Scan by shape, not just by indicators. Wallets, tags and constants change between variants. The shape doesn't: a line far longer than anything in a config file, a run of 16 or more consecutive tabs, a .woff2 file without the wOF2 magic bytes, createRequire next to global.r = require. The scanner flags all of them.
  4. Clean, then verify twice. After each cleanup push we ran the scanner locally, then re-fetched every touched file from GitHub at the new HEAD and checked it there: no wallet, no line longer than 51 characters, and the fake fonts gone (404). The second check is against what GitHub serves, not what's on my disk.
  5. Mind the branches. Default branches were clean after the push. Dozens of feature branches still carried the payload, and checking one out and running a build would execute it. Cleaning them means force-pushing branches other people hold locally, so that is a coordination decision: announce it, or have each owner rebase onto a clean default branch.

Making it a gate

A one-off cleanup protects you until the next variant. What stops the next one is a check that runs whether or not anyone remembers.

  • A required supply-chain guard on every repository. It's one reusable workflow in the organisation's .github repository, called from every repo, and required on every pull request. It fails on the known indicators and, more importantly, on the structural signals, so it still fires when the wallet and constants change.
  • Signed commits required on the branch we deploy the backend from.

The guard has one limit worth saying out loud: it protects what gets merged. It can't stop someone checking out an old infected branch and running a build on their laptop. That gap is closed by cleaning the branches, not by CI.

What I'd tell another team

  • Read the bytes, not the diff. For anything security-related, verify the file at the commit: its size and its longest line. A diff is a summary, and summaries can be gamed.
  • Build configs are code. postcss.config.mjs, next.config, ESLint configs and anything else your build loads all execute with your secrets in scope. Review them like code.
  • Rotate before you clean. If a payload ran with your environment, your secrets are gone. Rotation is the part that actually takes the keys back.
  • Detect structure, and make it required. Indicators expire. "No 7,000-character lines in a config file" does not.

Read next

  • Building Payweave: One SDK for Every Payment ProviderAdd a second payment provider and you learn how much of your 'integration' was secretly just Stripe: different money units, different webhook signatures, different error shapes. Payweave is a TypeScript SDK that unifies Stripe, Paystack, and Flutterwave behind one client without hiding the parts where they genuinely differ.Jul 25, 2026·18 min read
  • The Index You're Missing: A Practical Guide to Postgres PerformanceMost slow Postgres queries aren't a hardware problem — they're a missing index. Here's how to read query plans and build the indexes your database is begging for.Jun 5, 2026·16 min read
All postsShare on X ↗
git show <sha>:postcss.config.mjs | wc -c                                   # sizegit show <sha>:postcss.config.mjs | awk '{ print length }' | sort -n | tail -1   # longest line