What We Do
How we do it
Resources
SECURITY ADVISORIES
May 11, 2022
CVE-2022-26923 - Active Directory Domain Services Elevation of Privilege Vulnerability
THE THREAT Microsoft has disclosed a new vulnerability impacting Active Directory Certificate Services (ADCS) tracked as CVE-2022-26923 (Active Directory Domain Services Elevation of Privilege Vulnerability). If exploited successfully, an authenticated attacker can escalate privileges in environments where ADCS is running on the domain. eSentire is aware of technical details and tooling [2] for…
Read More
View all Advisories →
Company
ABOUT ESENTIRE
About Us
eSentire is The Authority in Managed Detection and Response Services, protecting the critical data and applications of 1200+ organizations in 75+ countries from known and unknown cyber threats. Founded in 2001, the company’s mission is to hunt, investigate and stop cyber threats before they become business disrupting events.
Read about how we got here
Leadership Work at eSentire
LATEST PRESS RELEASE
May 17, 2022
Cybersecurity Leader eSentire Continues Its Commitment to Rigorous Security Standards Earning PCI DSS Certification
Waterloo, ON, May 17, 2022 — eSentire, the Authority in Managed Detection and Response (MDR), maintains one of the most secure and robust IT environments of any MDR provider in the industry. To that end, eSentire today announced that it has received the Payment Card Industry Data Security Standard (PCI DSS) certification, considered one of the most stringent and comprehensive payment card…
Read More
Partners
PARTNER PROGRAM
e3 Ecosystem
We provide sophisticated cybersecurity solutions for Managed Security Service Providers (MSSPs), Managed Service Providers (MSPs), and Value-Added Resellers (VARs). Find out why you should partner with eSentire, the Authority in Managed Detection and Response, today.
Learn more
ECOSYSTEM PARTNER RESOURCES
Apply to become an e3 ecosystem partner with eSentire, the Authority in Managed Detection and Response.
Login to the Partner Portal for resources and content for current partners.
Search
Resources
Blog — Jul 05, 2017

A closer look at Petya's / NotPetya's network spreading code

Speak With A Security Expert Now

The file encryption and MBR infection code of NotPetya has now been carefully scrutinized and found lacking in many respects, sparking debate among researchers as to the true intent of the threat actors.

Here we take a closer look at the network spreading code, and how it finds new victims to infect.

The gathering of potential new infection targets is done in a separate thread that is created by the malware after the MBR is infected and the shutdown task scheduled:

notpetya-code-1

NotPetya maintains a global list of infection targets that it collects from multiple sources. These include command-line parameters, connected subnets, DHCP servers, DHCP clients, ARP table entries, active TCP connections, and servers on the domain found via the network browser service.

Command-Line Parameters

IP addresses or hostnames to infect can be passed in via the -h command-line switch:

Connected Subnets

NotPetya enumerates all local network interfaces and scans the directly connected subnets for hosts that accept TCP connections on port 139 or 445. Any host that answers is added to the target list.

DHCP Servers

For any DHCP-enabled interface, the address of the DHCP server is added to the target list.

DHCP Clients

NotPetya uses the NetServerGetInfo API to determine if it is running on a server or domain controller. If so, it will then use the DhcpEnumSubnets, DhcpGetSubnetInfo and DhcpEnumSubnetClients API to enumerate all clients for which this server is acting as a DHCP server. It will then try to make a TCP connection to the SMB ports of each DHCP client. Any host that answers is added to the target list.

Active TCP Connections

Every 3 minutes, NotPetya fetches a list of active TCP connections via the GetExtendedTcpTable API and adds the remote IP addresses of these connections to the target list. This is one way for hosts outside of the victim’s local Windows network can be selected as propagation targets.

Cached ARP Entries

IP addresses found in the local ARP cache are also added to the target list. The contents of the ARP cache are fetched every 3 minutes via the GetIpNetTable API.

Network Browser Service

Finally, NotPetya uses the browser service to list all servers visible in the Active Directory domain (NetServerEnum API). Any that are running on Windows 2000 or later are added to the target list.

Network Propagation

Once the list of targets is gathered, the malware creates a network propagation thread that attempts to connect to the admin$ share of each target (using dumped credentials if available) and upload a copy of itself to it:

It will then try to remotely execute its copy, first via PsExec, and failing that, via WMIC:


A separate thread is responsible for SMB exploitation via ETERNALBLUE and ETERNALROMANCE.

Conclusion

As we can see, the network propagation code in NotPetya is optimized to efficiently enumerate and attack targets on a typical Active Directory domain. It is not limited to scanning just the local subnet, and is able to traverse entire enterprise networks with ease, especially when it is able to infect a DHCP server or domain controller. By enumerating active TCP connections present on the victim machine, NotPetya is capable of spreading to external/Internet targets as well, although stolen credentials are unlikely to work there, and SMB exploitation becomes the likelier infection mechanim to be effective against these targets.

View Most Recent Blogs
Jacob Gajek
Jacob Gajek Principal Cybersecurity Researcher
Jacob is principal cybersecurity researcher at eSentire, with a focus on intrusion detection, malware analysis, threat intelligence, measurement and metrics.