explaingit

zakipedio/gadgetsniper

Analysis updated 2026-05-18

19C#Audience · researcherComplexity · 2/5Setup · easy

TLDR

A command line tool that scans 64-bit Windows DLLs to find call-stack spoofing gadgets using real instruction decoding instead of byte matching.

Mindmap

mindmap
  root((GadgetSniper))
    What it does
      Finds call jmp gadgets
      Call stack spoofing research
      Scans PE32 DLLs
    Tech stack
      C sharp
      dotnet 8
      Iced disassembler
    Use cases
      Red team tooling
      Defense validation
      Bulk DLL scanning
    Output
      Text report
      Per file gadget counts
    Audience
      Security researchers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Scan a folder of Windows DLLs for call-stack spoofing gadgets used in red-team tooling.

USE CASE 2

Validate candidate gadgets with a real x64 disassembler to avoid false positives from byte matching.

USE CASE 3

Generate a text report of gadget locations across an entire System32 directory.

What is it built with?

C#.NET 8Iced

How does it compare?

zakipedio/gadgetsniperbio-canse/fh6-miaomiao-toolsepotseluevskaya/regsecretscs
Stars191919
LanguageC#C#C#
Setup difficultyeasymoderatemoderate
Complexity2/53/54/5
Audienceresearchergeneralresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Requires the .NET 8 SDK, runs only against Windows PE32+ DLLs.

In plain English

GadgetSniper is a command line tool that scans 64-bit Windows DLL files to find a specific type of instruction pattern used in a technique called call-stack spoofing. That technique lets malicious or red-team software make its call stack look like it came from a trusted, signed program, and doing it convincingly requires finding tiny snippets of existing code, called gadgets, inside real system DLLs that can be reused for this purpose. Rather than searching for byte patterns directly, which can easily produce false matches because x64 instructions are variable length and can overlap in confusing ways, GadgetSniper uses a real instruction decoder called Iced to check every candidate. It only keeps a result if the bytes actually decode as a valid call instruction followed by a jump through one of the eight registers that survive across function calls, such as RBX or R14. This removes phantom matches that a simple byte search would report. The tool is written in C# and targets .NET 8. It scans every executable section of a DLL, not just the main code section, and can recurse through an entire folder of DLLs while skipping files it cannot access and avoiding symlink loops. Each file is scanned independently so one bad or corrupted DLL does not stop the whole run. Results are written to a text report that lists total counts by gadget type followed by details for each file and address where a gadget was found. To use it, someone installs the .NET 8 SDK, clones the repository, and runs a build or publish command to produce either a normal binary or a single self-contained executable that does not need the .NET runtime installed on the target machine. The tool is then run from the command line against a directory, with optional flags for recursive scanning and a custom output file path. The project credits an earlier tool called GadgetHunter as the inspiration for this approach.

Copy-paste prompts

Prompt 1
Explain how GadgetSniper finds call-stack spoofing gadgets in DLLs.
Prompt 2
Walk me through building GadgetSniper with the .NET 8 SDK.
Prompt 3
Show me how to run a recursive scan across a directory with a custom output file.
Prompt 4
Help me understand why byte pattern matching produces false positives on x64 instructions.

Frequently asked questions

What is gadgetsniper?

A command line tool that scans 64-bit Windows DLLs to find call-stack spoofing gadgets using real instruction decoding instead of byte matching.

What language is gadgetsniper written in?

Mainly C#. The stack also includes C#, .NET 8, Iced.

How hard is gadgetsniper to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is gadgetsniper for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.