Privilege Escalationのロゴ

Privilege Escalation

組織
omagents
privilege-escalation

対話を必要としないエージェントのシェルから、root権限が必要なコマンドを実行します。sudoが失敗する、応答しない、タイムアウトする、拒否される、またはTTYやaskpassがないというエラーを返す場合に起動します。また、システムパッケージのインストール、/etcや/usrの編集、システムサービス、マウント、カーネルモジュールなど、特権が必要な作業にも使用します。sudo -n、pkexec、run0、doasを順に試す、事前確認を優先した手順を提供します。

概要

公開者omagents
リポジトリomagents
スキル名privilege-escalation
スター
361
フォーク
2
同梱ファイル
1
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 1個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    omagentsがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Privilege Escalation」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/omagents/omagents/tree/main/packages/core/skills/privilege-escalation
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/omagents/omagents.git /tmp/omagents
mkdir -p .claude/skills
cp -r /tmp/omagents/packages/core/skills/privilege-escalation .claude/skills/privilege-escalation
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでPrivilege Escalationを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にPrivilege Escalationを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Privilege Escalationは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Privilege Escalation for Agent Shells

Agent shells have no TTY. A bare sudo command blocks on a password prompt that no one can type; it stalls until the tool timeout, and on OpenCode 2.3.1+ the timed-out command moves to the background instead of being killed, leaving the blocked process lingering there — and some hosts deny sudo patterns outright before the command even runs. When a command needs root, pick an escalation tool that works without a terminal instead of dying on bare sudo.

When to Use

  • The command needs root: system package installs, writes to /etc or /usr, system systemctl units, mounts, user/group management, privileged journalctl reads.
  • sudo already failed with "a terminal is required", "no askpass program", or "sudo: a password is required", or the command timed out.
  • The host's permission rules denied the sudo pattern.

Probe First, Then Escalate

Work down this chain in order:

Does the command elevate itself (sudo, pkexec, run0, doas, su, mount, …)?
  → Run it as-is. Never wrap a self-elevating command.
Else does `sudo -n true` succeed (passwordless, cached, or askpass configured)?
  → Run `sudo -n <command>`.
Else does `command -v pkexec` find pkexec?
  → Run `pkexec --disable-internal-agent <absolute-path> <args…>`.
Else does `command -v run0` find run0 (systemd 256+)?
  → Run `run0 <command>`.
Else does `command -v doas` find doas?
  → Run `doas -n <command>`.
Else
  → Print the exact command for the user to run manually. Stop.

sudo -n fails fast instead of hanging: it never prompts, so it is a safe probe even when passwordless sudo is not configured. Check which tools exist with command -v pkexec; command -v run0; command -v doas before committing to one.

pkexec Rules

pkexec escalates through Polkit, which shows a GUI password dialog the human at the machine can approve — no terminal required. To use it correctly:

  • Pin the exact executable with an absolute path. pkexec resets the child to a minimal safe environment whose PATH differs from yours, and the Polkit approval dialog shows the fully resolved program — so make the target unambiguous: resolve it first with command -v pacman, then run pkexec /usr/bin/pacman -Syu.

  • Pipes and redirections run as the calling user, not root. pkexec echo 'value' > /etc/example.conf fails or writes a user-owned file. Write root files with tee:

    bash
    printf '%s\n' 'net.ipv4.ip_forward = 1' | pkexec tee /etc/sysctl.d/99-forward.conf
  • Compound commands (pipes, redirections, &&) run as one root shell:

    bash
    pkexec sh -c 'cp /etc/hosts /etc/hosts.bak && printf "%s\n" "10.0.0.5 host" >> /etc/hosts'
  • Always pass --disable-internal-agent. Without a polkit agent, pkexec registers its own textual agent that prompts on the controlling TTY — so in a shell that happens to inherit a TTY, plain pkexec … can block on a password prompt, the exact hang this skill exists to avoid. With the flag, pkexec either prompts through the desktop's GUI polkit agent or fails immediately. If a pkexec invocation ever visibly waits for input, abandon it rather than letting it stall until the timeout — newer OpenCode hosts keep timed-out commands running in the background.

  • A polkit authentication agent must be running for the GUI prompt to appear, which is typical on desktop sessions. Headless servers and plain SSH sessions usually have none — pkexec fails there; fall through to run0, doas, or the manual step.

  • GUI applications are not launchable under pkexec (DISPLAY and XAUTHORITY are dropped); it is for commands, not desktop apps.

run0 and doas

  • run0 is systemd's replacement for sudo (systemd 256+). It authenticates through the same Polkit machinery as pkexec but keeps a saner environment and resolves the command by name, so no absolute-path pinning is needed. Use it when sudo -n fails but a polkit agent exists.
  • doas is the OpenBSD-style alternative, configured in /etc/doas.conf. doas -n is its non-interactive form.

Never

  • Never bare interactive sudo in an agent shell — it blocks on a prompt until the tool timeout and then lingers as a background task on newer OpenCode hosts instead of dying. If sudo -n fails, move down the chain.
  • Never pipe or embed a password: echo '<password>' | sudo -S … leaks the secret into logs and history. If the user offers a password, refuse it and use a tool with a proper prompt instead.
  • Never edit sudoers or add NOPASSWD policy just to unblock an agent — a permanent security weakening is not a fix for a convenience problem.
  • Never double-wrap: sudo pkexec …, pkexec sudo …, or run0 doas … stack prompts and fail.
  • Never run destructive root commands (rm -rf-class) without quoting the exact command to the user first and getting confirmation.

Platform Notes

  • macOS: only sudo exists. If sudo -n fails, hand the command to the user.
  • Windows: no pkexec, run0, or doas. Privileged commands need an elevated shell the agent cannot open — always hand the command to the user.
  • Linux without a desktop session: pkexec and run0 usually cannot prompt. Fall through to the manual step rather than looping.

When Every Tool Fails

Print the exact command — absolute path, full arguments — for the user to run in their own terminal, then stop. Do not retry escalation attempts in a loop: each one either fails immediately (already probed) or hangs (already the failure mode this skill avoids).

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Privilege Escalation」では何ができますか?

対話を必要としないエージェントのシェルから、root権限が必要なコマンドを実行します。sudoが失敗する、応答しない、タイムアウトする、拒否される、またはTTYやaskpassがないというエラーを返す場合に起動します。また、システムパッケージのインストール、/etcや/usrの編集、システムサービス、マウント、カーネルモジュールなど、特権が必要な作業にも使用します。sudo -n、pkexec、run0、doasを順に試す、事前確認を優先した手順を提供します。

TypingMindでPrivilege Escalationを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Privilege Escalationはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにPrivilege Escalationをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/omagents/omagents/tree/main/packages/core/skills/privilege-escalationを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Privilege Escalationを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Privilege Escalationで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもPrivilege Escalationを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Privilege Escalation」は無料ですか?

はい。omagentsがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇