Detecting Memory Safety Bugsのロゴ

Detecting Memory Safety Bugs

組織
UnboundCompute
detecting-memory-safety-bugs

Find memory-safety bugs in C/C++ and other unmanaged code - use-after-free, double-free, out-of-bounds read/write, uninitialized use, and NULL deref - by reasoning about object lifetime and buffer bounds along real code paths. Use on an authorized source target when a candidate catalog does NOT model these temporal/lifetime classes (most don't), so a keyword or sink scan will miss them; when reviewing allocators, parsers, buffer handling, or refcounting. Pairs the lifetime/bounds reasoning with source→sink confirmation and the shared finding schema.

概要

公開者UnboundCompute
リポジトリsecurity-agent-skills
スキル名detecting-memory-safety-bugs
スター
27
フォーク
8
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

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

  • どのLLMでも利用可能

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

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

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

インストール

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

1

TypingMindにインストール

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

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

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

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

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

TypingMindで使用

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

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

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

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

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

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

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

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

スキルの指示

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

Detecting memory-safety bugs

Temporal and spatial memory bugs are the ones a sink-based catalog usually doesn't model: there's no single "dangerous function" to grep - the bug is a relationship between a pointer's lifetime and its use, or between an index and a bound, spread across code paths. So you hunt them by reasoning about lifetime and bounds, not by matching a call. This skill covers the five workhorse classes and how to confirm each.

When to use

  • The target is C/C++/Rust-unsafe/CGo or any unmanaged memory, and you want the classes a catalog leaves out (hunting-bugs-with-a-code-graph flags these as out-of-catalog and sends you here).
  • You're reviewing allocators, parsers, serializers, ring buffers, refcounting, or anything doing pointer arithmetic.

Scope check

Authorized source only. If you can't name the authorization, stop.

The five classes and how to confirm each

For every candidate, the confirmation is a path: an allocation/definition site, the operation that changes its state, and the use - read the source at each.

  1. Use-after-free (UAF). A pointer is used after its object is freed. Hunt: for each free/delete/refcount-drop, ask what still holds this pointer and can any path reach a use after this point - including aliases stored in structs, callbacks, and error paths. Confirm: a live path free → … → deref with no reassignment in between. Watch the classic shapes: free-in-a-loop then use, free in an error branch then fallthrough use, and a cached pointer that outlives the object.

  2. Double-free. The same allocation freed twice. Hunt: two frees reachable in sequence on some path without a nulling/reassignment between them; ownership handed to a callee that also frees; error paths that free then fall into a cleanup that frees again. Confirm: both frees hit the same object on one path.

  3. Out-of-bounds read/write. An index or pointer crosses a buffer's bound. Hunt: every buffer access where the index/length is attacker-influenced or derived from a separate field (length prefixes are a hotspot). Confirm: trace the index/length source and the buffer's true size; the bug is any path where index/len can exceed size - off-by-one at <= size, unchecked memcpy length, integer-truncated length, signed/unsigned confusion at the check.

  4. Uninitialized use. A value is read before it's written. Hunt: stack structs and locals used on a path that skipped their initialization (an early goto, an error branch, a partially-filled struct). Confirm: a path from declaration to use with no write on that path.

  5. NULL / invalid-pointer deref. A pointer that can be NULL (or an error sentinel) is dereferenced without a check. Hunt: allocation and lookup returns that can fail; dereferences of a parameter documented as nullable. Confirm: a path where the returning call can yield NULL and the deref has no guard between.

Integer overflow feeds all of the above

Overflow is rarely the final bug - it's the step that produces a bad length/index/size. Treat a * b, a + b, and truncating casts on attacker-influenced sizes as candidates because they flow into an allocation or a bound. Trace overflow → size/index → memory op; report the memory bug with the overflow as its cause.

Worked example

UAF via error path. In parse_record: rec = alloc(); if (read(rec) < 0) { free(rec); } … use(rec->field); - the free is in the error branch but the function falls through to use(rec->field) without returning. Path: alloc → free (error branch) → deref (fallthrough). Confirmed UAF; reachable = conditional (read returns < 0); impact = attacker-triggered malformed record frees then dereferences. Remediation: return after the free, or restructure cleanup with a single exit.

Rationalizations to reject

  • "There's no dangerous function call, so it's memory-safe." → These classes have no single sink. Reason about lifetime and bounds, not calls.
  • "The length is checked." → Checked where, against the true size, before every path to the access, and without integer truncation? Verify all four.
  • "It's freed once in the code I can see." → Ownership may free again in a callee or a cleanup path. Follow the pointer, including aliases.
  • "The compiler/sanitizer would catch it." → Only on inputs the test suite exercised. Static path reasoning finds the untested path.

Executing this in practice

You need to follow a pointer's aliases and a value's flow across functions, and read the exact body at each site. A code property graph with points-to/alias information makes "what else holds this pointer" answerable; a memory-safety static analyzer (or the compiler's sanitizers on targeted inputs) corroborates; manual path reading closes it. Confirm every class as a concrete path, then emit per the finding schema with the alloc/free/use hops in path.

Related

  • adjudicating-taint-paths - for the attacker-input side (who controls the length/index).
  • hunting-bugs-with-a-code-graph - the master loop that routes these here.
  • FINDING-SCHEMA.md.

よくある質問

AIスキル「Detecting Memory Safety Bugs」では何ができますか?

Find memory-safety bugs in C/C++ and other unmanaged code - use-after-free, double-free, out-of-bounds read/write, uninitialized use, and NULL deref - by reasoning about object lifetime and buffer bounds along real code paths. Use on an authorized source target when a candidate catalog does NOT model these temporal/lifetime classes (most don't), so a keyword or sink scan will miss them; when reviewing allocators, parsers, buffer handling, or refcounting. Pairs the lifetime/bounds reasoning with source→sink confirmation and the shared finding schema.

TypingMindでDetecting Memory Safety Bugsを使うメリットは何ですか?

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

TypingMindにDetecting Memory Safety Bugsをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/UnboundCompute/security-agent-skills/tree/main/skills/detecting-memory-safety-bugsを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Detecting Memory Safety Bugsを使えるAIモデルはどれですか?

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

Detecting Memory Safety Bugsで使えるAIモデルの数に制限はありますか?

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

AIスキル「Detecting Memory Safety Bugs」は無料ですか?

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

AIスキルとは何ですか?

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

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

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

すべて見る

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

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