Detect build-time package-manager installs; gate adopted-package installs to MALICIOUS#22
Closed
adelmonte wants to merge 1 commit into
Closed
Conversation
…alls to MALICIOUS
Closes the detection gap exposed by the June 2026 "Atomic Arch" AUR
supply-chain attack, which hijacked orphaned packages and added a benign
looking `npm install atomic-lockfile` / `bun install js-digest` line to
the PKGBUILD or .install file. The payload lived inside the fetched npm/bun
package's lifecycle scripts, so the PKGBUILD itself scored TRUSTED.
- patterns: P-NET-PKG-INSTALL{,-JS} (PKGBUILD) and
P-INSTALL-PKG-MANAGER{,-JS} (.install) flag a build/install step that
fetches a *named* package over the network (npm/pnpm/yarn/bun/pip/gem/
cargo/go). A package argument is required so bare `npm install`/`npm ci`/
`bun install` (lockfile installs) do not match.
- composite gate: coordinator emits B-ORPHAN-NET-INSTALL (override gate ->
MALICIOUS) when an adopted/taken-over package (B-SUBMITTER-CHANGED) also
has one of the network-install signals.
- tests for both patterns (incl. bare-install negatives) and the gate.
- silence pre-existing unused-variable warning in bulk.rs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The June 2026 "Atomic Arch" AUR supply-chain campaign hijacked orphaned/adopted packages and added a benign-looking
npm install atomic-lockfile/bun install js-digestline to the PKGBUILD or.installfile. The malicious payload lives inside the fetched npm/bun package's lifecycle scripts, so the PKGBUILD itself looks clean — traur scored a reconstructed sample 89/100 TRUSTED.This also addresses the real-world miss in #14: the compromised
alvrpackage firedB-SUBMITTER-CHANGEDbut still scored 73/OK, because no signal escalated it.Changes
1. Build-time package-manager install patterns (
data/patterns.toml)P-NET-PKG-INSTALL-JS/P-NET-PKG-INSTALL(PKGBUILD) andP-INSTALL-PKG-MANAGER-JS/P-INSTALL-PKG-MANAGER(.install) flag a build/install step that fetches a named package over the network: npm/pnpm/yarn/bun (+35) and pip/gem/cargo/go (+25).npm install/npm ci/bun install(lockfile installs — legitimate and common) do not match. This is the core false-positive control.2. Composite escalation gate (
src/coordinator.rs)B-SUBMITTER-CHANGED) and has one of the network-install signals, the coordinator emitsB-ORPHAN-NET-INSTALL(Behavioral, +90, override gate) → escalates directly to MALICIOUS. This is the piece that catches the alvr-style takeover that previously slipped through at OK.apply_composite_gates) because no single feature can see another feature's signals.3. Tests
pkgbuild_analysisandinstall_script_analysis.coordinator: adopted + install → MALICIOUS; not-adopted + install → no gate.Relationship to #20
#20 targets the same campaign by flagging newly-added
npm/bunentries in themakedependsarray via diff (T-DIFF-NEW-DEP-NPM-BUN, +50 Temporal). This PR is complementary and, I think, more complete for actually catching the attack:npm/bunis already a declared makedepend, and even on packages that are malicious from creation (no prior version to diff).#20's dependency-array diff check remains a useful complementary signal (it catches the case where the install is buried in a fetched build script with no visible command), and the two approaches compose well.