Patient Sabotage: Malicious NuGet Packages with Time-Delayed ICS Payloads Discovered

Malicious NuGet Packages with Time-Delayed Industrial Sabotage Code Found on Official Repository

CRITICAL
November 7, 2025
6m read
Supply Chain AttackIndustrial Control SystemsMalware

Related Entities

Threat Actors

shanhai666

Organizations

Socket

Products & Tech

NuGetIndustrial Control Systems (ICS) Programmable Logic Controller (PLC)

Other

Sharp7Extend

Full Report

Executive Summary

Researchers at Socket have uncovered a highly sophisticated and patient supply-chain attack targeting developers via the official NuGet package repository. Nine malicious packages, published by an actor using the alias "shanhai666" and downloaded nearly 9,500 times, were found to contain dormant sabotage code. The packages provided legitimate functionality to avoid suspicion, but included hidden logic set to activate on specific future dates, some as late as 2027 and 2028. The most alarming of these, Sharp7Extend, contained a payload specifically designed to disrupt Industrial Control Systems (ICS). After a delay, this code would cause write operations to Programmable Logic Controllers (PLCs) to fail silently, potentially leading to catastrophic physical process failures. This attack represents a dangerous evolution in supply chain threats, blending stealth, patience, and the potential for physical-world impact.


Threat Overview

The attack was carried out by publishing nine seemingly useful packages to the NuGet repository. The threat actor, "shanhai666," leveraged C# extension methods to weaponize the code. This technique is particularly insidious because the malicious logic is implicitly executed whenever a developer uses a standard function, such as writing to a database or a PLC, without any explicit call to the malicious code visible in their own source.

The payload had two main components:

  1. Time-Delayed Activation: The malicious functions were programmed with hardcoded or encrypted trigger dates. This ensures the code remains dormant for months or years, evading detection during development and testing phases.
  2. Probabilistic Sabotage: Once activated, the code would perform one of two actions:
    • Process Termination: A function would calculate a random number and, if a condition was met, call Process.GetCurrentProcess().Kill(), causing the application to crash intermittently and making debugging extremely difficult.
    • ICS Write Failure (Sharp7Extend): This more targeted function included a 30-90 minute grace period after application startup. Following this, it would cause up to 80% of PLC write operations to fail silently. The function would not return an error, making the application believe the operation was successful. This is designed to mimic intermittent hardware failure and could lead to severe consequences in an industrial environment.

Technical Analysis

  • Attack Vector: This is a classic software supply chain attack. The actor poisoned a public software repository with malicious libraries, knowing developers would unwittingly incorporate them into their applications. T1195.001 - Compromise Software Dependencies and Development Tools.
  • Malicious Logic: The use of C# extension methods is a clever defense evasion and obfuscation technique. It hides the malicious call stack, making it hard for developers to trace the source of the failure.
  • Payload: The dual-purpose payload demonstrates intent. The generic process-killing function causes disruption, while the PLC-specific function in Sharp7Extend points to a clear intent to sabotage industrial processes. This is a form of T1499 - Endpoint Denial of Service at the application level and, more critically, T0886 - Impair Process Control in the ICS context.
  • Dormancy: The use of future trigger dates is a key element of T1484 - Domain Policy Modification (in a broader sense of time-based triggers) and is a powerful method to bypass security checks that analyze package behavior at install time.

Impact Assessment

The potential impact of this attack is critical, especially for the industrial sector. The Sharp7Extend package could cause:

  • Physical Damage: Failure of safety systems, leading to equipment damage or personnel injury.
  • Production Loss: Silent failure of write commands could lead to incorrect manufacturing processes, resulting in defective products and massive financial loss.
  • Diagnostic Hell: By mimicking intermittent hardware failure, the malware sends maintenance and engineering teams on a wild goose chase, wasting time and resources trying to fix non-existent physical problems while the software root cause remains hidden. For non-ICS applications, the random process termination would lead to instability, data corruption, and a poor user experience, causing significant reputational damage to the software provider.

Detection & Response

  • Dependency Scanning: Organizations must use Software Composition Analysis (SCA) tools to scan their dependencies for known malicious packages. Socket, the discovering company, and others maintain databases of such threats. D3FEND Technique: D3-FA: File Analysis.
  • Behavioral Analysis: In sandboxed environments, monitor applications for unexpected process terminations (Process.GetCurrentProcess().Kill()) or discrepancies between command execution and expected outcomes (e.g., a PLC write command that doesn't result in a state change).
  • Source Code Review: For critical applications, perform manual or automated source code review of third-party libraries. Look for suspicious code patterns like hardcoded dates, use of randomness for logic forks, or calls to process termination functions. D3FEND Technique: D3-SCA: Static Code Analysis.

Mitigation and Recommendations

  1. Vet Third-Party Packages: Do not blindly trust packages from public repositories. Use trusted, well-vetted libraries. Establish an internal policy for approving and managing third-party dependencies. D3FEND Technique: D3-EAL: Executable Allowlisting (applied to software libraries).
  2. Use Scoped Dependencies: Whenever possible, use private, internal package repositories that only contain approved and scanned versions of external libraries. This prevents developers from accidentally pulling a malicious package from the public internet.
  3. Implement Runtime Protection: For critical ICS applications, deploy runtime application self-protection (RASP) or similar tools that can monitor application behavior and detect/block anomalous actions like silent error suppression or unexpected process termination.
  4. Principle of Least Privilege: Run applications with the minimum privileges necessary. While this wouldn't stop the sabotage, it could limit the blast radius if the malicious code attempted other actions.

Timeline of Events

1
January 1, 2023
The threat actor 'shanhai666' begins publishing malicious packages to NuGet.
2
November 7, 2025
This article was published
3
June 6, 2028
The probabilistic process-kill mechanism in the Sharp7Extend package is set to remain active until this date.

MITRE ATT&CK Mitigations

Enforce policies that only allow dependencies signed by trusted publishers, though this can be bypassed if a legitimate publisher is compromised.

Mapped D3FEND Techniques:

Run applications in a sandboxed environment to observe their behavior and detect malicious actions like process killing.

Mapped D3FEND Techniques:

Audit

M1047enterprise

Use Software Composition Analysis (SCA) tools to audit all dependencies for known vulnerabilities and malicious packages.

D3FEND Defensive Countermeasures

Implement a mandatory Static Code Analysis (SCA) or Software Composition Analysis (SCA) step in your CI/CD pipeline. This process should automatically scan all third-party dependencies, like the malicious NuGet packages, before they are compiled into production software. Configure the scanner to specifically look for high-risk indicators such as calls to Process.GetCurrentProcess().Kill(), the use of hardcoded future dates as logic triggers, or obfuscated code within extension methods. A tool like Socket (which found this threat) or others can identify packages with these characteristics, as well as those published by known malicious actors like 'shanhai666'. This automated check acts as a critical gate, preventing such time bombs from ever entering the software supply chain.

Establish a policy of dependency allowlisting, moving away from pulling packages directly from public repositories like NuGet. Instead, create a private, internal artifact repository (e.g., JFrog Artifactory, Sonatype Nexus). This repository should only contain a curated list of third-party packages that have been vetted and approved by a security team. Developers would then configure their environments to pull dependencies exclusively from this internal source. This prevents a developer from accidentally downloading a malicious or typosquatted package like 'Sharp7Extend' and ensures that only known-good components are used in the development of critical applications, especially those controlling ICS environments.

For critical ICS environments, deploy runtime monitoring and process analysis on the host machines running the control software. This defense-in-depth layer is designed to catch malicious behavior that slips past static checks. Configure monitoring to alert on any self-termination of the main application process, as seen with the Process.GetCurrentProcess().Kill() call. Additionally, for the PLC write-failure scenario, the monitoring system should correlate the software's write commands with the actual state feedback from the PLC. If the software logs a successful write but the PLC state does not change, it should trigger a high-severity alert for silent failure, allowing operators to intervene before physical processes are dangerously corrupted.

Sources & References

Malicious NuGet Packages Hide Time-Delayed Sabotage Code
eSecurityPlanet (esecurityplanet.com) November 7, 2025

Article Author

Jason Gomes

Jason Gomes

• Cybersecurity Practitioner

Cybersecurity professional with over 10 years of specialized experience in security operations, threat intelligence, incident response, and security automation. Expertise spans SOAR/XSOAR orchestration, threat intelligence platforms, SIEM/UEBA analytics, and building cyber fusion centers. Background includes technical enablement, solution architecture for enterprise and government clients, and implementing security automation workflows across IR, TIP, and SOC use cases.

Threat Intelligence & AnalysisSecurity Orchestration (SOAR/XSOAR)Incident Response & Digital ForensicsSecurity Operations Center (SOC)SIEM & Security AnalyticsCyber Fusion & Threat SharingSecurity Automation & IntegrationManaged Detection & Response (MDR)

Tags

Supply Chain AttackICSOTNuGetSabotageMalware

📢 Share This Article

Help others stay informed about cybersecurity threats

Continue Reading