Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

RunasCs

> 编程语言
Open source

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

1.4K stars0 likes0 views
WebsiteGitHub

About

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

RunasCs


RunasCs is an utility to run specific processes with different permissions than the user's current logon provides using explicit credentials. This tool is an improved and open version of windows builtin runas.exe that solves some limitations:

  • Allows explicit credentials
  • Works both if spawned from interactive process and from service process
  • Manage properly DACL for Window Stations and Desktop for the creation of the new process
  • Uses more reliable create process functions like CreateProcessAsUser() and CreateProcessWithTokenW() if the calling process holds the required privileges (automatic detection)
  • Allows to specify the logon type, e.g. 8-NetworkCleartext logon (no UAC limitations)
  • Allows to bypass UAC when an administrator password is known (flag --bypass-uac)
  • Allows to create a process with the main thread impersonating the requested user (flag --remote-impersonation)
  • Allows redirecting stdin, stdout and stderr to a remote host
  • It's Open Source :)

RunasCs has an automatic detection to determine the best create process function for every contexts. Based on the process caller token permissions, it will use one of the create process function in the following preferred order:

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

Requirements


.NET Framework >= 2.0

Usage


…

The two processes (calling and called) will communicate through one pipe (both for stdout and stderr). The default logon type is 2 (Interactive).

By default, the Interactive (2) logon type is restricted by UAC and the generated token from these authentications are filtered. You can make interactive logon without any restrictions by setting the following regkey to 0 and restart the server:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA

Otherwise, you can try the flag --bypass-uac for an attempt in bypassing the token filtering limitation.

NetworkCleartext (8) logon type is the one with the widest permissions as it doesn't get filtered by UAC in local tokens and still allows authentications over the Network as it stores credentials in the authentication package. If you holds enough privileges, try to always specify this logon type through the flag --logon-type 8.

By default, the calling process (RunasCs) will wait until the end of the execution of the spawned process. If you need to spawn a background or async process, i.e. spawning a reverse shell, you need to set the parameter -t timeout to 0. In this case RunasCs won't wait for the end of the newly spawned process execution.

References


  • Potatoes and tokens
  • Starting an Interactive Client Process in C++
  • Creating a Child Process with Redirected Input and Output
  • Interactive Services
  • What is up with "The application failed to initialize properly (0xc0000142)" error?
  • Getting an Interactive Service Account Shell
  • Reading Your Way Around UAC (Part 1)
  • Reading Your Way Around UAC (Part 2)
  • Reading Your Way Around UAC (Part 3)
  • Vanara - A set of .NET libraries for Windows implementing PInvoke calls to many native Windows APIs with supporting wrappers

Credits


  • @decoder
  • @qtc-de
  • @winlogon0

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言