Logo de Diffing Binary Patches

Diffing Binary Patches

Comunidade
trilwu
diffing-binary-patches

Localize a vulnerabilidade corrigida por um patch de segurança comparando os binários anteriores e posteriores ao patch — usando BinDiff, Diaphora ou ghidriff para encontrar as funções alteradas, lendo as verificações adicionadas para identificar a classe da falha e deduzindo um gatilho alcançável na versão anterior ao patch para análise de vulnerabilidades 1-day. Use ao comparar duas versões de uma DLL/ELF, extrair um patch da Microsoft de um MSU/MSP para comparação de diferenças ou transformar um aviso vago no código exato que foi alterado.

Add to TypingMind

Visão geral

Publicado portrilwu
Repositóriosecskills
Nome da habilidadediffing-binary-patches
Estrelas
144
Forks
15
Arquivos incluídos
Somente instruções
LicençaMIT
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Sem arquivos extras

    Tudo de que o modelo precisa está nas instruções — sem arquivos extras para sincronizar.

  • Código aberto

    Publicada por trilwu no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Diffing Binary Patches no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/trilwu/secskills/tree/main/secskills-core/skills/diffing-binary-patches
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/trilwu/secskills.git /tmp/secskills
mkdir -p .claude/skills
cp -r /tmp/secskills/secskills-core/skills/diffing-binary-patches .claude/skills/diffing-binary-patches
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Diffing Binary Patches em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Diffing Binary Patches automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Diffing Binary Patches não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

Diffing Binary Patches

A security patch is a description of a vulnerability written in the vendor's own code. Diffing the binary before and after the fix turns a one-line advisory into the exact function, the exact check that was added, and — reasoning backward — the input that reached the bug before the patch. This is the core of 1-day analysis: the fix tells you where to look, the diff tells you what, and the pre-patch reachability tells you how.

When to Use

  • Comparing two versions of the same binary (DLL, ELF, driver) to find what a security update changed
  • Turning a CVE advisory or Patch-Tuesday bulletin into the specific vulnerable code
  • Extracting a Microsoft patch (MSU/MSP/cab, delta-compressed) into a full binary you can diff
  • Assessing whether a "silent" fix in a new release closed a security bug

When NOT to Use

  • Understanding a single binary with no patched counterpart — that is analyzing-binaries.
  • Building the working exploit once the bug and trigger are understood — that is exploiting-memory-corruption (native) or the relevant web skill.
  • Source-level diffs (a GitHub commit, a changelog) — read the source with reviewing-code-changes; binary diffing is for when you only have compiled artifacts.
  • Unpacking a protected binary before it can be diffed — use unpacking-protected-binaries first.

Get Two Comparable Binaries

The diff is only as clean as the inputs. You need the same binary at two versions, same architecture and ideally the same compiler, so the noise is small enough that the security change stands out.

For Microsoft patches this is a step in itself. Since Windows 10, updates ship as forward/reverse delta patches, not whole files — the MSU contains compressed deltas, not the finished DLL. Extract the update (expand the MSU/cab) and apply the delta to your baseline binary to reconstruct the full patched file (the PatchExtract / delta_patch.py approach, driving the msdelta API). Diffing the raw delta or a mismatched baseline produces garbage. For most other software, two release builds or two package versions are directly comparable.

Find the Changed Functions

Run a binary differ and read its results by similarity, not top to bottom:

  • BinDiff (open-source, via BinExport from IDA or Ghidra) matches functions across the two binaries and scores similarity; the interesting functions are the ones that changed slightly — a similarity just below 1.0 — not the ones that are entirely new or gone.
  • Diaphora (IDA) does the same with strong heuristics and a good pseudocode diff view, which matters because you will read decompiler output to understand the change.
  • ghidriff gives a scriptable, Ghidra-based diff when you want headless or CI-style runs.

Expect noise. A compiler change, function reordering, or an unrelated feature inflates the diff; ASLR and address shifts are not real changes. Filter to functions whose logic changed and ignore pure address churn.

Read the Fix, Recover the Bug

The added code is the tell. Most security fixes look like one of a small set of shapes, and each names the bug class:

  • A new bounds or length check before a copy or index → the pre-patch code had an overflow or OOB access on that path.
  • A signedness or integer change (size_t for int, an added overflow check) → an integer bug feeding an allocation or copy.
  • A new null / state check → a use-after-free, a race, or an uninitialized use the check now prevents.
  • A validation of a field, type tag, or length from parsed input → the parser trusted attacker-controlled data.
  • A reordered free / set-to-null after free → a UAF or double-free.

Read the post-patch function to see what is now enforced, then the pre-patch function to confirm the enforcement was absent. That pair is the vulnerability.

Reason Back to a Trigger

A changed function is a lead, not a finding, until you can reach it. Trace how attacker-controlled input arrives at the pre-patch code: which API, message, file field, or packet reaches the unguarded path, and under what state. If you cannot construct a path from an untrusted input to the changed code, the change may be hardening rather than a reachable bug — say so rather than overclaiming. When the path is real, that reachable trigger is the handoff to exploit development.

Reading External Sources

Fetch public advisories, specifications, and vendor reports as Markdown:

bash
curl -sL "https://defuddle.md/<url>"      # scheme in the path is optional

This strips page boilerplate — roughly 78% fewer tokens on a prose page — and returns the full text rather than a summary, so you can grep it and trust a negative result.

Three things it is not for. Fetch JSON and API responses raw, because readability extraction mangles structured data. Fetch authenticated or JavaScript-rendered pages directly, because it retrieves them anonymously. And never route adversary infrastructure (phishing links, C2, malware hosting), client-owned hosts, or engagement URLs through it — the request leaves your machine to a third party, and for live adversary infrastructure it also tips off the operator.

Some sites block the extractor and return an error blob rather than the page — {"error":"Failed to fetch: 418 I'm a teapot"} from freedesktop.org, for instance. That is the fetch being refused, not the source saying the thing does not exist. Re-fetch the URL directly before drawing any conclusion from it.

Rationalizations to Reject

  • "There are 200 changed functions, this patch is undiffable." Most are compiler and layout noise. Sort by similarity and filter to logic changes; the security fix is usually one to a handful of functions.
  • "I diffed the MSU directly and got nonsense." Windows ships deltas, not whole files. Reconstruct the full patched binary from the delta and your baseline before diffing.
  • "The function changed, so it's the vulnerability." A change is a lead. Without a reachable path from untrusted input to the pre-patch code, you may be looking at hardening. Prove reachability before you claim a bug.
  • "The advisory says RCE, so this is the RCE." Advisories are vague on purpose. Confirm the bug class from the added check, not from the marketing words in the bulletin.
  • "Same bug, so the old exploit works." A fix can change adjacent code, offsets, and object layout. Re-confirm the primitive against the pre-patch build you actually have.

References

  • analyzing-binaries — understanding either binary on its own
  • exploiting-memory-corruption — building the exploit from the recovered bug
  • reviewing-code-changes — when you have source diffs rather than binaries
  • unpacking-protected-binaries — when a binary must be unpacked before diffing

Perguntas frequentes

O que a habilidade de IA Diffing Binary Patches faz?

Localize a vulnerabilidade corrigida por um patch de segurança comparando os binários anteriores e posteriores ao patch — usando BinDiff, Diaphora ou ghidriff para encontrar as funções alteradas, lendo as verificações adicionadas para identificar a classe da falha e deduzindo um gatilho alcançável na versão anterior ao patch para análise de vulnerabilidades 1-day. Use ao comparar duas versões de uma DLL/ELF, extrair um patch da Microsoft de um MSU/MSP para comparação de diferenças ou transformar um aviso vago no código exato que foi alterado.

Por que usar Diffing Binary Patches no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Diffing Binary Patches é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Diffing Binary Patches no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/trilwu/secskills/tree/main/secskills-core/skills/diffing-binary-patches. O TypingMind lê o arquivo SKILL.md e instala a habilidade para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Diffing Binary Patches?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Diffing Binary Patches?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Diffing Binary Patches com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Diffing Binary Patches é gratuita?

Sim. A habilidade é publicada no GitHub por trilwu sob a licença MIT. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇