Common warning signs include malicious behaviour that appears only under specific conditions, such as mobile devices, certain user agents, or narrow time windows. Evasion tactics can also suppress activity when analytics, administrators, or developers are detected. If a package behaves differently in production than in test environments, teams should assume the dependency may be compromised and investigate immediately.
When dependency supply chain compromise starts evading normal tests
Compromised dependencies often fail to look obviously malicious in CI because the payload is conditioned to stay quiet until the right environment, user agent, time window, or role is present. That makes the warning signs less about a single bad scan result and more about inconsistencies between test, review, and production behaviour.
What matters is whether the dependency can recognise who is watching it, where it is running, and whether it is being exercised in a realistic production path. If behaviour changes only when defenders are absent, the normal review process is no longer a reliable trust signal.
One useful way to think about this problem is that testing can confirm what a package does in the lab, but not what it is prepared to do when it detects a live target. That gap is exactly where supply-chain compromise tends to hide, especially in packages that arrive through an SLSA gap or a weak verification process.
The behavioural signs that are most concerning
The clearest sign is environment-sensitive behaviour. If a package only runs destructive, exfiltration, or redirect logic on specific devices, operating systems, IP ranges, languages, or user agents, then passing test coverage means very little. Review teams should treat conditional execution as a serious indicator when the condition is narrow enough to look like evasion rather than normal feature gating.
Another strong signal is detection of observers. Some malicious dependencies suppress payloads when analytics, developers, administrators, sandboxes, or security tooling are present. Others delay execution long enough to miss short review windows or staging checks. Those patterns suggest the package is trying to survive inspection, not merely to function differently by design.
Production-only divergence is especially important. If the dependency behaves one way in test and a materially different way in production, the difference should be investigated as a compromise hypothesis, not dismissed as an environment quirk. That concern is reinforced when the package touches secrets, network calls, update channels, or auth-related workflows that normal unit tests may not exercise.
Why ordinary review misses these compromises
Normal testing usually covers expected paths, not conditional hostility. A package can remain inert during static review, dependency scanning, and happy-path functional tests while still containing logic that activates after install, on first use, or only after a delay. That means the most dangerous part of the payload may be deliberately decoupled from the code path reviewers see.
Review also breaks down when teams trust a package solely because its published version number, maintainer reputation, or prior behaviour looked benign. Supply chain attacks often succeed by preserving enough legitimate functionality to avoid immediate suspicion. The result is a dependency that appears stable until a specific trigger makes the compromise visible.
For practitioners, the real issue is not just malicious code, but malicious dependency behaviour that only appears under production-like conditions. That is why a package that passes ordinary tests can still be the wrong package to trust.
Risk and Threat Considerations
Hidden supply chain compromise is risky because it bypasses the very controls teams rely on to create confidence, including review, sandboxing, and automated test coverage. Once behaviour is conditional on environment or observer presence, defenders can get false reassurance from clean test results while the live path remains exposed.
Failure mechanism: the dependency keeps benign behaviour in inspection contexts and activates harmful logic only when it detects a real target, a privileged environment, or the absence of monitoring.
Impact: compromise can persist until production use, where it can exfiltrate data, alter requests, harvest secrets, or create a foothold for broader intrusion without leaving an obvious pre-release signal.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK addresses the attack and risk surface, while SLSA, CIS Controls v8 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| SLSA | Supply Chain Levels for Software Artifacts | Provenance and build integrity matter when a dependency hides malicious behavior behind release trust. |
| Recommendation — Require provenance and integrity checks before promoting dependency releases. | ||
| MITRE ATT&CK | T1027 — Obfuscated Files or Information | Conditional payloads and observer-aware suppression are concealment techniques used to evade review. |
| T1105 — Ingress Tool Transfer | Compromised dependencies can fetch or stage secondary payloads after initial trust is gained. | |
| Recommendation — Map suspicious dependency behaviour to concealment techniques and hunt for evasion. Monitor dependencies for unexpected outbound retrieval of code or payloads. | ||
| CIS Controls v8 | CIS-15 — Service Provider Management | Third-party package trust and monitoring are part of managing external software dependencies. |
| Recommendation — Review supplier assurance and revoke untrusted dependency sources quickly. | ||
| NIST SP 800-53 Rev 5 | SI-7 — Software, Firmware, and Information Integrity | Integrity controls are directly implicated when a dependency acts benignly in tests but maliciously in production. |
| Recommendation — Validate software integrity before deployment and after suspicious behaviour changes. | ||
Practitioner Guidance
What to verify: Compare dependency behaviour across test, staging, and production-like runs, and specifically check for differences tied to user agent, device class, network location, time, or role. If a package only misbehaves when it appears safe to do so, treat that as a detection priority, not a curiosity.
Decision rule: If a dependency behaves materially differently once it reaches production context, assume compromise until proven otherwise. The safer response is to isolate the package, review recent version changes, and inspect all outbound network, file, and credential-related activity before widening deployment.
Practitioner takeaway: The key judgement is whether the dependency is merely untested or actively evasive, because only the second case turns a routine review miss into a supply chain incident.
Related resources from NHI Mgmt Group
- Why do CI runners make supply-chain malware worse than a normal developer compromise?
- What is the difference between removing a malicious dependency and rebuilding an affected environment after a supply chain compromise?
- What are the signs that a React dependency chain is becoming a supply chain risk?
- What are the signs that a GitHub Actions workflow has been affected by a supply chain compromise?