2020-06-18 01:57:35 +00:00
# T1007 - System Service Discovery
2022-06-16 22:47:00 +00:00
2026-02-18 16:46:29 +00:00
## Description from ATT&CK
2025-02-13 22:03:40 +00:00
2026-02-18 16:55:45 +00:00
> Adversaries may try to gather information about registered local system services. Adversaries may obtain information about services using tools as well as OS utility commands such as <code>sc query</code>, <code>tasklist /svc</code>, <code>systemctl --type=service</code>, and <code>net start</code>. Adversaries may also gather information about schedule tasks via commands such as `schtasks` on Windows or `crontab -l` on Linux and macOS.(Citation: Elastic Security Labs GOSAR 2024)(Citation: SentinelLabs macOS Malware 2021)(Citation: Splunk Linux Gormir 2024)(Citation: Aquasec Kinsing 2020)
>
> Adversaries may use the information from [System Service Discovery](https://attack.mitre.org/techniques/T1007) during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.
2025-02-13 22:03:40 +00:00
2026-02-18 16:46:29 +00:00
[Source ](https://attack.mitre.org/techniques/T1007 )
2020-06-18 01:57:35 +00:00
## Atomic Tests
2026-02-18 16:46:29 +00:00
- [Atomic Test #1: System Service Discovery ](#atomic-test-1-system-service-discovery )
- [Atomic Test #2: System Service Discovery - net.exe ](#atomic-test-2-system-service-discovery---netexe )
- [Atomic Test #3: System Service Discovery - systemctl/service ](#atomic-test-3-system-service-discovery---systemctlservice )
- [Atomic Test #4: Get-Service Execution ](#atomic-test-4-get-service-execution )
- [Atomic Test #5: System Service Discovery - macOS launchctl ](#atomic-test-5-system-service-discovery---macos-launchctl )
- [Atomic Test #6: System Service Discovery - Windows Scheduled Tasks (schtasks) ](#atomic-test-6-system-service-discovery---windows-scheduled-tasks-schtasks )
- [Atomic Test #7: System Service Discovery - Services Registry Enumeration ](#atomic-test-7-system-service-discovery---services-registry-enumeration )
- [Atomic Test #8: System Service Discovery - Linux init scripts ](#atomic-test-8-system-service-discovery---linux-init-scripts )
2020-06-18 01:57:35 +00:00
2026-02-18 16:46:29 +00:00
### Atomic Test #1: System Service Discovery
2020-06-18 01:57:35 +00:00
Identify system services.
Upon successful execution, cmd.exe will execute service commands with expected result to stdout.
2021-06-24 17:04:33 +00:00
2020-06-18 01:57:35 +00:00
**Supported Platforms: ** Windows
2026-02-18 16:46:29 +00:00
**auto_generated_guid: ** `89676ba1-b1f8-47ee-b940-2e1a113ebc71`
2020-06-18 01:57:35 +00:00
2026-02-18 16:46:29 +00:00
#### Attack Commands: Run with `command_prompt`! Elevation Required (e.g. root or admin)
2020-06-18 01:57:35 +00:00
``` cmd
2025-11-29 04:49:25 +00:00
tasklist.exe /svc
2020-06-18 01:57:35 +00:00
sc query
sc query state= all
```
2026-02-18 16:46:29 +00:00
### Atomic Test #2: System Service Discovery - net.exe
2020-06-18 01:57:35 +00:00
Enumerates started system services using net.exe and writes them to a file. This technique has been used by multiple threat actors.
2022-12-14 20:35:27 +00:00
Upon successful execution, net.exe will run from cmd.exe that queries services. Expected output is to a txt file in in the temp directory called service-list.txt.
2021-06-24 17:04:33 +00:00
2020-06-18 01:57:35 +00:00
**Supported Platforms: ** Windows
2026-02-18 16:46:29 +00:00
**auto_generated_guid: ** `5f864a3f-8ce9-45c0-812c-bdf7d8aeacc3`
2020-06-18 01:57:35 +00:00
2026-02-18 16:46:29 +00:00
#### Inputs
2021-06-24 17:04:33 +00:00
2021-06-24 15:16:54 +00:00
| Name | Description | Type | Default Value |
2020-06-18 01:57:35 +00:00
|------|-------------|------|---------------|
2023-02-13 23:11:19 +00:00
| output_file | Path of file to hold net.exe output | path | %temp%\ ;service-list.txt|
2020-06-18 01:57:35 +00:00
2026-02-18 16:46:29 +00:00
#### Attack Commands: Run with `command_prompt`!
2020-06-18 01:57:35 +00:00
``` cmd
net.exe start >> #{output_file}
```
2026-02-18 16:46:29 +00:00
#### Cleanup Commands
2020-06-18 01:57:35 +00:00
``` cmd
del /f /q /s #{output_file} > nul 2 >& 1
```
2026-02-18 16:46:29 +00:00
### Atomic Test #3: System Service Discovery - systemctl/service
2020-06-18 01:57:35 +00:00
2023-11-13 21:46:56 +00:00
Enumerates system service using systemctl/service
2022-04-29 21:06:05 +00:00
**Supported Platforms: ** Linux
2026-02-18 16:46:29 +00:00
**auto_generated_guid: ** `f4b26bce-4c2c-46c0-bcc5-fce062d38bef`
2022-04-29 21:06:05 +00:00
2026-02-18 16:46:29 +00:00
#### Attack Commands: Run with `bash`!
2022-04-29 21:06:05 +00:00
``` bash
2023-11-13 21:46:56 +00:00
if [ " $( uname) " = 'FreeBSD' ] ; then service -e; else systemctl --type= service; fi ;
2023-11-02 00:56:51 +00:00
```
2026-02-18 16:46:29 +00:00
### Atomic Test #4: Get-Service Execution
2023-11-02 00:56:51 +00:00
2024-10-17 00:25:05 +00:00
Executes the Get-Service cmdlet to gather objects representing all services on the local system.
**Supported Platforms: ** Windows
2026-02-18 16:46:29 +00:00
**auto_generated_guid: ** `51f17016-d8fa-4360-888a-df4bf92c4a04`
2024-10-17 00:25:05 +00:00
2026-02-18 16:46:29 +00:00
#### Attack Commands: Run with `command_prompt`!
2024-10-17 00:25:05 +00:00
``` cmd
powershell.exe Get-Service
```
2026-02-18 16:46:29 +00:00
### Atomic Test #5: System Service Discovery - macOS launchctl
2024-10-17 00:25:05 +00:00
2025-11-29 04:49:25 +00:00
Enumerates services on macOS using launchctl. Used by adversaries for
identifying daemons, background services, and persistence mechanisms.
**Supported Platforms: ** macOS
2026-02-18 16:46:29 +00:00
**auto_generated_guid: ** `9b378962-a75e-4856-b117-2503d6dcebba`
2025-11-29 04:49:25 +00:00
2026-02-18 16:46:29 +00:00
#### Attack Commands: Run with `sh`!
2025-11-29 04:49:25 +00:00
``` sh
launchctl list
```
2026-02-18 16:46:29 +00:00
### Atomic Test #6: System Service Discovery - Windows Scheduled Tasks (schtasks)
2025-11-29 04:49:25 +00:00
Enumerates scheduled tasks on Windows using schtasks.exe.
**Supported Platforms: ** Windows
2026-02-18 16:46:29 +00:00
**auto_generated_guid: ** `7cd7eaa3-9ccc-460d-96d2-c6fb13e6d58a`
2025-11-29 04:49:25 +00:00
2026-02-18 16:46:29 +00:00
#### Attack Commands: Run with `command_prompt`!
2025-11-29 04:49:25 +00:00
``` cmd
schtasks /query /fo LIST /v
```
2026-02-18 16:46:29 +00:00
### Atomic Test #7: System Service Discovery - Services Registry Enumeration
2025-11-29 04:49:25 +00:00
Enumerates Windows services by reading the Services registry key
(HKLM\SYSTEM\CurrentControlSet\Services) instead of using Service Control
Manager APIs or CLI tools such as sc.exe or Get-Service.
**Supported Platforms: ** Windows
2026-02-18 16:46:29 +00:00
**auto_generated_guid: ** `d70d82bd-bb00-4837-b146-b40d025551b2`
2025-11-29 04:49:25 +00:00
2026-02-18 16:46:29 +00:00
#### Attack Commands: Run with `powershell`!
2025-11-29 04:49:25 +00:00
``` powershell
Get-ChildItem -Path 'HKLM:\SYSTEM\CurrentControlSet\Services' |
ForEach-Object {
$p = Get-ItemProperty -Path $_ . PSPath -ErrorAction SilentlyContinue
[ PSCustomObject ] @ {
Name = $_ . PSChildName
DisplayName = $p . DisplayName
ImagePath = $p . ImagePath
StartType = $p . Start
}
}
```
2026-02-18 16:46:29 +00:00
### Atomic Test #8: System Service Discovery - Linux init scripts
2025-11-29 04:49:25 +00:00
Enumerates system services by listing SysV init scripts and runlevel
symlinks under /etc/init.d and /etc/rc*.d.
**Supported Platforms: ** Linux
2026-02-18 16:46:29 +00:00
**auto_generated_guid: ** `8f2a5d2b-4018-46d4-8f3f-0fea53754690`
2025-11-29 04:49:25 +00:00
2026-02-18 16:46:29 +00:00
#### Attack Commands: Run with `sh`!
2025-11-29 04:49:25 +00:00
``` sh
echo "[*] Listing SysV init scripts (/etc/init.d):"
if [ -d /etc/init.d ] ; then ls -l /etc/init.d; else echo "/etc/init.d not present on this system" ; fi
echo
echo "[*] Listing runlevel directories (/etc/rc*.d):"
ls -ld /etc/rc*.d 2>/dev/null || echo "No /etc/rc*.d directories found"
```