Vous êtes sur la page 1sur 1120

 Research on commands

performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

1. Initial investigation: Collect information of the infected machine


2. Reconnaissance: Look for information saved in the machine and remote machines within the
network
3. Spread of infection: Infect the machine with other malware or try to access other machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76

4 systeminfo 40
Ranking Command Times executed

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.

at \\[remote host name or IP address] 12:00 cmd /c


"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.
wmic /node:[IP address] /user:”[user name]” /password:”[password]”
process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

4. Initial investigation: Collect information of the infected machine


5. Reconnaissance: Look for information saved in the machine and remote machines within the
network
6. Spread of infection: Infect the machine with other malware or try to access other machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76

4 systeminfo 40
Ranking Command Times executed

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.

at \\[remote host name or IP address] 12:00 cmd /c


"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.
wmic /node:[IP address] /user:”[user name]” /password:”[password]”
process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

7. Initial investigation: Collect information of the infected machine


8. Reconnaissance: Look for information saved in the machine and remote machines within the
network
9. Spread of infection: Infect the machine with other malware or try to access other machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76

4 systeminfo 40
Ranking Command Times executed

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.

at \\[remote host name or IP address] 12:00 cmd /c


"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.
wmic /node:[IP address] /user:”[user name]” /password:”[password]”
process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

10. Initial investigation: Collect information of the infected machine


11. Reconnaissance: Look for information saved in the machine and remote machines
within the network
12. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

13. Initial investigation: Collect information of the infected machine


14. Reconnaissance: Look for information saved in the machine and remote machines
within the network
15. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

16. Initial investigation: Collect information of the infected machine


17. Reconnaissance: Look for information saved in the machine and remote machines
within the network
18. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

19. Initial investigation: Collect information of the infected machine


20. Reconnaissance: Look for information saved in the machine and remote machines
within the network
21. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

22. Initial investigation: Collect information of the infected machine


23. Reconnaissance: Look for information saved in the machine and remote machines
within the network
24. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

25. Initial investigation: Collect information of the infected machine


26. Reconnaissance: Look for information saved in the machine and remote machines
within the network
27. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

28. Initial investigation: Collect information of the infected machine


29. Reconnaissance: Look for information saved in the machine and remote machines
within the network
30. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

31. Initial investigation: Collect information of the infected machine


32. Reconnaissance: Look for information saved in the machine and remote machines
within the network
33. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

34. Initial investigation: Collect information of the infected machine


35. Reconnaissance: Look for information saved in the machine and remote machines
within the network
36. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

37. Initial investigation: Collect information of the infected machine


38. Reconnaissance: Look for information saved in the machine and remote machines
within the network
39. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

40. Initial investigation: Collect information of the infected machine


41. Reconnaissance: Look for information saved in the machine and remote machines
within the network
42. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

43. Initial investigation: Collect information of the infected machine


44. Reconnaissance: Look for information saved in the machine and remote machines
within the network
45. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

46. Initial investigation: Collect information of the infected machine


47. Reconnaissance: Look for information saved in the machine and remote machines
within the network
48. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

49. Initial investigation: Collect information of the infected machine


50. Reconnaissance: Look for information saved in the machine and remote machines
within the network
51. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

52. Initial investigation: Collect information of the infected machine


53. Reconnaissance: Look for information saved in the machine and remote machines
within the network
54. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

55. Initial investigation: Collect information of the infected machine


56. Reconnaissance: Look for information saved in the machine and remote machines
within the network
57. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

58. Initial investigation: Collect information of the infected machine


59. Reconnaissance: Look for information saved in the machine and remote machines
within the network
60. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

61. Initial investigation: Collect information of the infected machine


62. Reconnaissance: Look for information saved in the machine and remote machines
within the network
63. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

64. Initial investigation: Collect information of the infected machine


65. Reconnaissance: Look for information saved in the machine and remote machines
within the network
66. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

67. Initial investigation: Collect information of the infected machine


68. Reconnaissance: Look for information saved in the machine and remote machines
within the network
69. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

70. Initial investigation: Collect information of the infected machine


71. Reconnaissance: Look for information saved in the machine and remote machines
within the network
72. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

73. Initial investigation: Collect information of the infected machine


74. Reconnaissance: Look for information saved in the machine and remote machines
within the network
75. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

76. Initial investigation: Collect information of the infected machine


77. Reconnaissance: Look for information saved in the machine and remote machines
within the network
78. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

79. Initial investigation: Collect information of the infected machine


80. Reconnaissance: Look for information saved in the machine and remote machines
within the network
81. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

82. Initial investigation: Collect information of the infected machine


83. Reconnaissance: Look for information saved in the machine and remote machines
within the network
84. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

85. Initial investigation: Collect information of the infected machine


86. Reconnaissance: Look for information saved in the machine and remote machines
within the network
87. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

88. Initial investigation: Collect information of the infected machine


89. Reconnaissance: Look for information saved in the machine and remote machines
within the network
90. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

91. Initial investigation: Collect information of the infected machine


92. Reconnaissance: Look for information saved in the machine and remote machines
within the network
93. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

94. Initial investigation: Collect information of the infected machine


95. Reconnaissance: Look for information saved in the machine and remote machines
within the network
96. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

97. Initial investigation: Collect information of the infected machine


98. Reconnaissance: Look for information saved in the machine and remote machines
within the network
99. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

100. Initial investigation: Collect information of the infected machine


101. Reconnaissance: Look for information saved in the machine and remote machines
within the network
102. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

103. Initial investigation: Collect information of the infected machine


104. Reconnaissance: Look for information saved in the machine and remote machines
within the network
105. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

106. Initial investigation: Collect information of the infected machine


107. Reconnaissance: Look for information saved in the machine and remote machines
within the network
108. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

109. Initial investigation: Collect information of the infected machine


110. Reconnaissance: Look for information saved in the machine and remote machines
within the network
111. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

112. Initial investigation: Collect information of the infected machine


113. Reconnaissance: Look for information saved in the machine and remote machines
within the network
114. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

115. Initial investigation: Collect information of the infected machine


116. Reconnaissance: Look for information saved in the machine and remote machines
within the network
117. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

118. Initial investigation: Collect information of the infected machine


119. Reconnaissance: Look for information saved in the machine and remote machines
within the network
120. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

121. Initial investigation: Collect information of the infected machine


122. Reconnaissance: Look for information saved in the machine and remote machines
within the network
123. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

124. Initial investigation: Collect information of the infected machine


125. Reconnaissance: Look for information saved in the machine and remote machines
within the network
126. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

127. Initial investigation: Collect information of the infected machine


128. Reconnaissance: Look for information saved in the machine and remote machines
within the network
129. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

130. Initial investigation: Collect information of the infected machine


131. Reconnaissance: Look for information saved in the machine and remote machines
within the network
132. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

133. Initial investigation: Collect information of the infected machine


134. Reconnaissance: Look for information saved in the machine and remote machines
within the network
135. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

136. Initial investigation: Collect information of the infected machine


137. Reconnaissance: Look for information saved in the machine and remote machines
within the network
138. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

139. Initial investigation: Collect information of the infected machine


140. Reconnaissance: Look for information saved in the machine and remote machines
within the network
141. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

142. Initial investigation: Collect information of the infected machine


143. Reconnaissance: Look for information saved in the machine and remote machines
within the network
144. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

145. Initial investigation: Collect information of the infected machine


146. Reconnaissance: Look for information saved in the machine and remote machines
within the network
147. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

148. Initial investigation: Collect information of the infected machine


149. Reconnaissance: Look for information saved in the machine and remote machines
within the network
150. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

151. Initial investigation: Collect information of the infected machine


152. Reconnaissance: Look for information saved in the machine and remote machines
within the network
153. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

154. Initial investigation: Collect information of the infected machine


155. Reconnaissance: Look for information saved in the machine and remote machines
within the network
156. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

157. Initial investigation: Collect information of the infected machine


158. Reconnaissance: Look for information saved in the machine and remote machines
within the network
159. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

160. Initial investigation: Collect information of the infected machine


161. Reconnaissance: Look for information saved in the machine and remote machines
within the network
162. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

163. Initial investigation: Collect information of the infected machine


164. Reconnaissance: Look for information saved in the machine and remote machines
within the network
165. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

166. Initial investigation: Collect information of the infected machine


167. Reconnaissance: Look for information saved in the machine and remote machines
within the network
168. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

169. Initial investigation: Collect information of the infected machine


170. Reconnaissance: Look for information saved in the machine and remote machines
within the network
171. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

172. Initial investigation: Collect information of the infected machine


173. Reconnaissance: Look for information saved in the machine and remote machines
within the network
174. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

175. Initial investigation: Collect information of the infected machine


176. Reconnaissance: Look for information saved in the machine and remote machines
within the network
177. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

178. Initial investigation: Collect information of the infected machine


179. Reconnaissance: Look for information saved in the machine and remote machines
within the network
180. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

181. Initial investigation: Collect information of the infected machine


182. Reconnaissance: Look for information saved in the machine and remote machines
within the network
183. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

184. Initial investigation: Collect information of the infected machine


185. Reconnaissance: Look for information saved in the machine and remote machines
within the network
186. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

187. Initial investigation: Collect information of the infected machine


188. Reconnaissance: Look for information saved in the machine and remote machines
within the network
189. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

190. Initial investigation: Collect information of the infected machine


191. Reconnaissance: Look for information saved in the machine and remote machines
within the network
192. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

193. Initial investigation: Collect information of the infected machine


194. Reconnaissance: Look for information saved in the machine and remote machines
within the network
195. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

196. Initial investigation: Collect information of the infected machine


197. Reconnaissance: Look for information saved in the machine and remote machines
within the network
198. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

199. Initial investigation: Collect information of the infected machine


200. Reconnaissance: Look for information saved in the machine and remote machines
within the network
201. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

202. Initial investigation: Collect information of the infected machine


203. Reconnaissance: Look for information saved in the machine and remote machines
within the network
204. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

205. Initial investigation: Collect information of the infected machine


206. Reconnaissance: Look for information saved in the machine and remote machines
within the network
207. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

208. Initial investigation: Collect information of the infected machine


209. Reconnaissance: Look for information saved in the machine and remote machines
within the network
210. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

211. Initial investigation: Collect information of the infected machine


212. Reconnaissance: Look for information saved in the machine and remote machines
within the network
213. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

214. Initial investigation: Collect information of the infected machine


215. Reconnaissance: Look for information saved in the machine and remote machines
within the network
216. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

217. Initial investigation: Collect information of the infected machine


218. Reconnaissance: Look for information saved in the machine and remote machines
within the network
219. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

220. Initial investigation: Collect information of the infected machine


221. Reconnaissance: Look for information saved in the machine and remote machines
within the network
222. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

223. Initial investigation: Collect information of the infected machine


224. Reconnaissance: Look for information saved in the machine and remote machines
within the network
225. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

226. Initial investigation: Collect information of the infected machine


227. Reconnaissance: Look for information saved in the machine and remote machines
within the network
228. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

229. Initial investigation: Collect information of the infected machine


230. Reconnaissance: Look for information saved in the machine and remote machines
within the network
231. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

232. Initial investigation: Collect information of the infected machine


233. Reconnaissance: Look for information saved in the machine and remote machines
within the network
234. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

235. Initial investigation: Collect information of the infected machine


236. Reconnaissance: Look for information saved in the machine and remote machines
within the network
237. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

238. Initial investigation: Collect information of the infected machine


239. Reconnaissance: Look for information saved in the machine and remote machines
within the network
240. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

241. Initial investigation: Collect information of the infected machine


242. Reconnaissance: Look for information saved in the machine and remote machines
within the network
243. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

244. Initial investigation: Collect information of the infected machine


245. Reconnaissance: Look for information saved in the machine and remote machines
within the network
246. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

247. Initial investigation: Collect information of the infected machine


248. Reconnaissance: Look for information saved in the machine and remote machines
within the network
249. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

250. Initial investigation: Collect information of the infected machine


251. Reconnaissance: Look for information saved in the machine and remote machines
within the network
252. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

253. Initial investigation: Collect information of the infected machine


254. Reconnaissance: Look for information saved in the machine and remote machines
within the network
255. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

256. Initial investigation: Collect information of the infected machine


257. Reconnaissance: Look for information saved in the machine and remote machines
within the network
258. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

259. Initial investigation: Collect information of the infected machine


260. Reconnaissance: Look for information saved in the machine and remote machines
within the network
261. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

262. Initial investigation: Collect information of the infected machine


263. Reconnaissance: Look for information saved in the machine and remote machines
within the network
264. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

265. Initial investigation: Collect information of the infected machine


266. Reconnaissance: Look for information saved in the machine and remote machines
within the network
267. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

268. Initial investigation: Collect information of the infected machine


269. Reconnaissance: Look for information saved in the machine and remote machines
within the network
270. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

271. Initial investigation: Collect information of the infected machine


272. Reconnaissance: Look for information saved in the machine and remote machines
within the network
273. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

274. Initial investigation: Collect information of the infected machine


275. Reconnaissance: Look for information saved in the machine and remote machines
within the network
276. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

277. Initial investigation: Collect information of the infected machine


278. Reconnaissance: Look for information saved in the machine and remote machines
within the network
279. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

280. Initial investigation: Collect information of the infected machine


281. Reconnaissance: Look for information saved in the machine and remote machines
within the network
282. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

283. Initial investigation: Collect information of the infected machine


284. Reconnaissance: Look for information saved in the machine and remote machines
within the network
285. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

286. Initial investigation: Collect information of the infected machine


287. Reconnaissance: Look for information saved in the machine and remote machines
within the network
288. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

289. Initial investigation: Collect information of the infected machine


290. Reconnaissance: Look for information saved in the machine and remote machines
within the network
291. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

292. Initial investigation: Collect information of the infected machine


293. Reconnaissance: Look for information saved in the machine and remote machines
within the network
294. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

295. Initial investigation: Collect information of the infected machine


296. Reconnaissance: Look for information saved in the machine and remote machines
within the network
297. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

298. Initial investigation: Collect information of the infected machine


299. Reconnaissance: Look for information saved in the machine and remote machines
within the network
300. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

301. Initial investigation: Collect information of the infected machine


302. Reconnaissance: Look for information saved in the machine and remote machines
within the network
303. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

304. Initial investigation: Collect information of the infected machine


305. Reconnaissance: Look for information saved in the machine and remote machines
within the network
306. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

307. Initial investigation: Collect information of the infected machine


308. Reconnaissance: Look for information saved in the machine and remote machines
within the network
309. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

310. Initial investigation: Collect information of the infected machine


311. Reconnaissance: Look for information saved in the machine and remote machines
within the network
312. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

313. Initial investigation: Collect information of the infected machine


314. Reconnaissance: Look for information saved in the machine and remote machines
within the network
315. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

316. Initial investigation: Collect information of the infected machine


317. Reconnaissance: Look for information saved in the machine and remote machines
within the network
318. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

319. Initial investigation: Collect information of the infected machine


320. Reconnaissance: Look for information saved in the machine and remote machines
within the network
321. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

322. Initial investigation: Collect information of the infected machine


323. Reconnaissance: Look for information saved in the machine and remote machines
within the network
324. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

325. Initial investigation: Collect information of the infected machine


326. Reconnaissance: Look for information saved in the machine and remote machines
within the network
327. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

328. Initial investigation: Collect information of the infected machine


329. Reconnaissance: Look for information saved in the machine and remote machines
within the network
330. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

331. Initial investigation: Collect information of the infected machine


332. Reconnaissance: Look for information saved in the machine and remote machines
within the network
333. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.
 Research on commands
performed by malicious
intents
In Windows OS, various commands (hereafter “Windows commands”) are installed by default. However,
what is actually used by general users is just a small part of it. On the other hand, JPCERT/CC has
observed that attackers intruding into a network also use Windows commands in order to collect
information and/or to spread malware infection within the network. What is worth noting here is the gap
between those Window commands used by general users and by attackers. If there is a huge difference, it
would be possible to detect or limit the attackers’ behaviour by monitoring/controlling the Windows
command execution.

This entry will demonstrate how to mitigate the attack impact by revealing Windows commands that
attackers use on the intruded Windows OS, and by restricting the execution of those commands that are
unnecessary for general users.

Malware for remote control (Remote Access Tool/Trojan – RAT) has a function to execute shell
commands from a remote environment. With this, attackers can execute Windows commands from a
remote environment.

Attackers who successfully installed such malware in a network will attempt to take control of the system
within the network in the following sequence in order to collect confidential information, etc.

334. Initial investigation: Collect information of the infected machine


335. Reconnaissance: Look for information saved in the machine and remote machines
within the network
336. Spread of infection: Infect the machine with other malware or try to access other
machines
Windows commands are used in all of the phases above. Respective Windows commands used in each
phase are introduced here below.

Initial Investigation
Table 1 lists the commands that are often used by attackers in an attempt to collect information of the
infected machine. “Times executed” is derived from the sum of Windows commands used by 3 different
attack groups in their respective C&C servers (Please refer to Appendix A, B and C for details).

Ranking Command Times executed

1 tasklist 155

2 ver 95

3 ipconfig 76
Ranking Command Times executed

4 systeminfo 40

5 net time 31

6 netstat 27

7 whoami 22

8 net start 16

9 qprocess 15

10 query 14

Table 1: Initial Investigation (Top 10 commands)


Attackers use commands such as “tasklist”, “ver”, “ipconfig” and “systeminfo”, etc., and collect
information of the network, process and OS in order to investigate what kind of machine they succeeded in
infecting. This is presumably how they make sure that the machine is not a sandbox for malware analysis
purposes and so on.

Reconnaissance
Commands shown in Table 2 are often used to search for confidential information and remote machines
within the network.

Ranking Command Times executed

1 dir 976

2 net view 236

3 ping 200

4 net use 194

5 type 120

6 net user 95

7 net localgroup 39

8 net group 20

9 net config 16

10 net share 11
Ranking Command Times executed

Table 2: Reconnaissance (Top 10 commands)


Attackers use “dir” and “type” to search for files. Sometimes they collect a list of all the document files in
the infected machine by setting appropriate options and arguments for “dir” command.

For searching networks, “net” is used. In particular, the following commands are often seen:

 net view: Obtain a list of connectable domain resources


 net user: Manage local/domain accounts
 net localgroup: Obtain a list of users belonging to local groups
 net group: Obtain a list of users belonging to certain domain groups
 net use: Access to resources
Furthermore, the following commands may be used in an environment where Active Directory is used
(Please refer to Table 5 in Appendix A). These commands are installed in Windows Server and do not
originally exist in client OS such as Windows 7 and 8.1 – but attackers download and install these
commands from outside and execute them.

 dsquery: Search for accounts in Active Directory


 csvde: Obtain account information in Active Directory
Spread of Infection
To intrude remote machines and spread malware infection within the network, the following commands
are often executed:

Ranking Command Times executed

1 at 103

2 reg 31

3 wmic 24

4 wusa 7

5 netsh advfirewall 4

6 sc 4

7 rundll32 2

Table 3: Spread of Infection


*”wmic” is also used for reconnaissance.
“at” and “wmic” are often used to execute malware on remote machines.

With “at” command, attackers can execute commands on remote machines, by registering tasks to execute
files against connectable machines as follows.
at \\[remote host name or IP address] 12:00 cmd /c
"C:\windows\temp\mal.exe"
Also, by setting the following options and arguments with “wmic” command, attackers can execute
commands on remote machines.

wmic /node:[IP address] /user:”[user name]” /password:”[password]”


process call create “cmd /c c:\Windows\System32\net.exe user”
Restricting Execution of Unnecessary Windows Commands
It is fair to say that these Windows commands used by attackers include those that are unused by general
users, if carefully selected. With AppLocker and software restriction policy, which restrict such commands
from being executed, it would be possible to limit the attackers’ behaviour. For example, if you wish to
restrict “net” commands, you can set rules as in Figure 1. (For details of AppLocker configuration, please
see Microsoft’s Website [1]).

Figure 1: AppLocker Rules


Also, by enabling AppLocker, events where selected Windows commands were executed or attempted but
denied will be recorded in the event logs, which can be utilized for investigation on Windows commands
that attackers executed after infecting the machine with malware.
Figure 2: Logs of the Processes Restricted by AppLocker
AppLocker can also just monitor Windows commands [2]. With this, AppLocker cannot prevent
unintended Windows commands from being executed, but the execution history will be recorded in the
event log. If the users themselves use Windows commands that may be used for attacks, it is a good idea to
set AppLocker just for monitoring purpose. (Windows command execution can also be monitored by
activating “Audit Process Creation” in the local security policy.)

Conclusion
In targeted attacks, attackers not only use functions implemented in the malware, but also often use
Windows commands to pursue their purposes. If such activities can be hindered, spread of incidents can be
prevented in a fairly early stage. However, it may be difficult to limit the usage of Windows commands
right away – so our recommendation is to start by collecting logs of executed processes by using
AppLocker, etc.

Thank you for reading and best wishes for the New Year!

- Shusei Tomonaga
Reference:
[1] Microsoft - Windows AppLocker
https://technet.microsoft.com/en-us/library/dd759117.aspx
[2] Microsoft – Using Auditing to Track Which Applications Are Used
https://technet.microsoft.com/en-us/library/dd723693%28v=ws.10%29.aspx

Appendix A: List of Executed Commands by respective Attack Groups (Attack Group


A)
Ranking Command Times executed Option

1 tasklist 119 /s /v

2 ver 92

3 ipconfig 58 /all

4 net time 30

5 systeminfo 24

6 netstat 22 -ano

7 qprocess 15

8 query 14 user

9 whoami 14 /all

10 net start 10

11 nslookup 4

12 fsutil 3 fsinfo drives

13 time 2 /t

14 set 1

Table 4: Initial Investigation (Attack Group A)

Ranking Command Times executed Option

1 dir 903

2 net view 226

3 ping 196

4 net use 193


Ranking Command Times executed Option

5 type 118

6 net user 74

7 net localgroup 35

8 net group 19

9 net config 16

10 net share 11

11 dsquery 6

12 csvde 5 /f /q

13 nbtstat 5 -a

14 net session 3

15 nltest 3 /dclist

16 wevtutil 2

Table 5: Reconnaissance (Attack Group A)

Ranking Command Times executed Option

1 at 98

2 reg 29 add export query

3 wmic 24

4 netsh advfirewall 4

5 sc 4 qc query

6 wusa 2

Table 6: Spread of Infection (Attack Group A)


Appendix B: List of Executed Commands by respective Attack Groups (Attack Group
B)
Ranking Command Times executed Option

1 tasklist 29 /m /svc

2 whoami 6

3 ipconfig 5 /all

4 net start 4

5 netstat 3 -ano

6 nslookup 3

7 ver 2

8 time 1 /t

Table 7: Initial Investigation (Attack Group B)

Ranking Command Times executed Option

1 dir 62

2 net user 21 /domain /add

3 net view 9 /domain

4 ping 4

5 net localgroup 4 /add

6 tree 3 /F

7 type 2

8 net group 1 /domain

Table 8: Reconnaissance (Attack Group B)

Ranking Command Times executed Option

1 at 5

2 wusa 5

3 reg 2
Ranking Command Times executed Option

4 rundll32 2

Table 9: Spread of Infection (Attack Group B)


Appendix C: List of Executed Commands by respective Attack Groups (Attack Group
C)
Ranking Command Times executed Option

1 systeminfo 16

2 ipconfig 13 /all /?

3 tasklist 7

4 netstat 5 -ano

5 whoami 2

6 net start 2

7 arp 1 -a

8 chcp 1

9 net time 1

10 ver 1

Table 10: Initial Investigation (Attack Group C)

Ranking Command Times executed Option

1 dir 11

2 net user 1 /all /?

3 net view 1

4 qwinsta 1 -ano

Table 11: Reconnaissance (Attack Group C)


*Commands for “Spread of Infection” by Attack Group C are omitted since they did not
spread the infection.

Author

朝長 秀誠 (Shusei Tomonaga)
Since December 2012, he has been engaged in malware analysis and forensics investigation, and is
especially involved in analyzing incidents of targeted attacks. Prior to joining JPCERT/CC, he was
engaged in security monitoring and analysis operations at a foreign-affiliated IT vendor. He presented at
CODE BLUE, BsidesLV, BlackHat USA Arsenal, Botconf, PacSec and FIRST Conference. JSAC
organizer.

Vous aimerez peut-être aussi