stack-bounds-format-auditing

A C/C++ security review for finding stack or heap buffer overflows in formatting and memory-copy code. It checks whether the remaining buffer size is reduced when the destination position moves forward.

In plain words
What is it for?
Use it to review network serializers, URL builders, header or query-string construction, and formatting loops using functions such as snprintf, strncpy, or memcpy.
Why use it?
It helps catch incorrect size calculations that can make writes run past a fixed buffer and corrupt memory.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/securitytalent/bugskill-ai/stack-bounds-format-auditing
Any agent
npx skills add SecurityTalent/bugskill-ai --skill stack-bounds-format-auditing
Clone the repo
git clone --depth 1 https://github.com/SecurityTalent/bugskill-ai

Made for: Claude Code, Codex.

Per session 98 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,104 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00098 $0.02104
Opus 5 $0.00049 $0.01052
Sonnet 5 $0.00020 $0.00421
Haiku 4.5 $0.00010 $0.00210

Measured 2d ago against content hash 9d153da6259e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

stack-bounds-format-auditing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/fmt_bounds_audit.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Personal-Claude-Code-Agent-Skills/stack-bounds-format-auditing/SKILL.md · 174 lines

How it starts

The opening of the file, as written. The whole thing — 174 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Stack-Bounds Format Auditing (C/C++)

Find, validate, and remediate stack buffer overflows in C/C++ string-formatting and serialization routines where the size argument to a bounded function is incorrect — specifically when destination pointers advance without a corresponding decrement to the remaining buffer size. Targets and codebases must be within the authorized scope of your assessment.


When to Use

  • Auditing C/C++ network protocol serializers, deserializers, and packet formatters.
  • Reviewing URL/URI generators, query-string builders, and header concatenation routines.
  • Assessing string formatting loops (snprintf, swprintf, strncpy, wcsncpy, memcpy) writing to fixed stack or heap buffers.
  • Triaging potential buffer overflows in game networking, IoT firmware, embedded systems, and IPC mechanisms.
  • Analyzing HackerOne report patterns similar to #2551512 (nn::nex::StationURL::Format on Wii U, 3DS, and Nintendo Switch NEX clients).

Reference Case: HackerOne #2551512 (Nintendo NEX StationURL::Format)

In Nintendo's NEX network library, nn::nex::StationURL::Format serializes key-value connection parameters from a std::map<String, String> into a fixed 1024-character stack buffer (wchar_t url[1024]):

// Vulnerable implementation in NEX clients (HackerOne #2551512)
void nn::nex::StationURL::Format() {
    wchar_t url[1024];
    unsigned int offset = 0;
    unsigned int written = 0;
    bool writeDelimiter = false;

    for (auto param = normalParams.begin(); param != normalParams.end(); param++) {
        if (writeDelimiter) {
            // BUG: size is always 1024 regardless of offset!
            written = swprintf(url + offset, 1024, L";");
            offset += written;
        }
        // BUG: remaining buffer space is not (1024 - offset)
        written = swprintf(url + offset, 1024, L"%ls%ls%ls",
                           param->first.c_str(), L"=", param->second.c_str());
        offset += written;
        writeDelimiter = true;
    }
    SetURL(url);
}

Read the full file on GitHub · 174 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 174 lines · 98 tokens per session scan A 9d153da6259e

Subscribe to this mod's changes

stack-bounds-format-auditing is a skill published in the GitHub repository SecurityTalent/bugskill-ai (5 stars, last pushed 17d ago), licensed MIT. It adds 98 tokens to every session and 2,104 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

spanify-buffers

Find and fix unsafe buffer operations in a C++ file by removing UNSAFETODO markers and replacing unsafe raw pointers/C-style functions with base::span and standard safe containers. Use when the user asks to fix unsafe buffer warnings or -Wunsafe-buffer-usage errors. Don't use for other types of memory safety bugs like…

chromium/chromium · 86 tokens

jni-type-conversion

How to use @JniType annotations for ergonomic JNI. Relevant for Java files that use @NativeMethods or @CalledByNative.

chromium/chromium · 32 tokens

platform-port

Guide porting FastLED to new MCU platforms, including int.h types, clockless drivers, SPI implementations, and platform detection. Use when adding support for a new microcontroller family or board.

FastLED/FastLED · 42 tokens

qt-cpp-review

Invoke when the user asks to review, check, audit, or look over Qt6 C++ code — or suggest before committing. Runs deterministic linting (60+ rules) then six parallel deep- analysis agents covering model contracts, ownership, threading, API correctness, error handling, and performance. Reports only high-confidence…

mavlink/qgroundcontrol · 86 tokens

cpp-pro

Writes, optimizes, and debugs C++ applications using modern C++20/23 features, template metaprogramming, and high-performance systems techniques. Use when building or refactoring C++ code requiring concepts, ranges, coroutines, SIMD optimization, or careful memory management — or when addressing performance…

Jeffallan/claude-skills · 79 tokens

qt-cpp-docs

Generates standalone Markdown reference documentation for any Qt/C++ source files — Qt Widgets classes, Qt Quick backends, Qt/C++ modules, plain C++ utilities, structs, free-function headers, and entry points like main.cpp. Use this skill to document any .h or .cpp file: Qt classes, plain C++ code, utility helpers, or…

mavlink/qgroundcontrol · 155 tokens