# s1ngularity: AI CLIs used to search for secrets

> Compromised Nx packages used installed AI CLIs to search for secrets. Examine the execution chain and the evidence needed for investigation.

Published: 2026-11-17  
Canonical: https://rootzero.eu/en/research/s1ngularity-ai-cli-secret-theft/

A compromised package can execute a script before the developer starts work. In s1ngularity, that script also sought installed coding assistants and delegated file searches to them.

[Wiz describes calls to Claude, Gemini and Amazon Q](https://www.wiz.io/blog/s1ngularity-supply-chain-attack) from malicious Nx versions published on August 26, 2025. [Nx’s postmortem](https://nx.dev/blog/s1ngularity-postmortem) traces the publishing compromise. These accounts distinguish registry access from effects on consuming systems.

![Nx package → Postinstall script → AI CLI → Local files. Capability depends on the compromised process permissions.](../../../assets/editorial/orca/a14-en.png)

*Capability depends on the compromised process permissions.*

## Package code runs first

A postinstall hook executes within the installation process’s context. It can encounter that account’s accessible environment variables, files and programs. An assistant adds a possible interface; not all credential collection requires one.

Review both branches:

```text
package -> postinstall -> direct file reads
                       -> AI CLI -> file selection
collected results -> outbound destination
```

This avoids attributing every malware read to a model. A CLI invocation establishes interaction; confirm effects through process output, produced files and subsequent requests.

## The script inherits workstation access

An agent does not automatically add operating-system rights to its account. It can make useful documents easier to identify among many readable files.

Install and build in an environment with limited credentials. An isolated project directory is insufficient if the same account can read the home directory or use existing sessions.

Distinguish a key’s presence on disk, process access and successful use against a service. Each requires different evidence.

## A lockfile can pin a malicious release

[npm ci](https://docs.npmjs.com/cli/v11/commands/npm-ci/) reproduces the lockfile’s dependency tree and rejects certain package.json mismatches. This supports reproducibility; it does not judge the legitimacy of pinned contents.

Disabling install scripts can reduce some package effects while affecting legitimate dependencies. Test that mode in the build chain and review exceptions rather than treat an option as complete safety evidence.

A provenance attestation informs the relationship between build and source. Examine producer identity and executed code as well. A compromised publishing process can produce an artifact with verifiable provenance.

## Establish the exposure window

Downloading a version does not prove its hook ran. Find the exact package in lockfiles, caches and install logs, then examine endpoint or runner records.

| Stage | Evidence |
| --- | --- |
| Version present | Lockfile and retained artifact |
| Hook executed | Process tree and package-manager log |
| CLI invoked | Command line and related output |
| Data transferred | Collection file and network event |
| Credential reused | Service authentication record |

Revoke credentials whose exposure is established or plausible in context, then examine permissions and usage. Uninstalling removes a future execution source; it does not revoke copied access.

For later builds, ask which secret remains readable by a script installed through dependencies. Verify the answer in the build environment, even when the invoked program is a trusted assistant.
