百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

RunasCs

> 编程语言
开源

RunasCs - C# 版和开放版的 Windows 内置 runas.exe

1.4K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

RunasCs - C# 版和开放版的 Windows 内置 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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

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