All products

Open source C++ library, Open source

Bytebinder iconBytebinder

Low-level memory work, with one clean C++ API.

Bytebinder is a C++20 library for reading, scanning, patching, hooking, and debugging process memory. The same API drives the calling process or another one, on Windows, Linux, and macOS, so low-level tools can be written without a separate code path for each case.

attach.cpp

auto target = bb::process::attach(target_pid);
        for (auto& loaded : target.modules()) {
        std::printf("%s\n", loaded.name.c_str());
        }
        bb::mem hit = target.scan("DE AD BE EF ?? ?? CA FE");
        if (hit.valid()) {
        const uint32_t marker = hit.read<uint32_t>(16);
        }

Adapted from the examples in the project README.

Signature: DE AD BE EF ?? ?? CA FE

48

8B

DE

AD

BE

EF

4C

1A

CA

FE

00

90

55

48

89

E5

DE

AD

00

41

Illustrative match: darker cells are the two wildcard bytes.

Language
C++20, CMake
License
BSD 3-Clause
Runs on
Windows, Linux, macOS
Built on
PolyHook 2.0, Zydis, and AsmJit

One API, whichever process you are looking at

Low-level tooling tends to fork early. Code that inspects the current process looks nothing like code that inspects another one, and neither looks the same on Windows and Linux. Before long, the logic you care about is buried under platform handling.

Bytebinder puts one model in front of all of that. A process handle owns a memory accessor, which is either local or remote. An address is a fluent, typed object bound to that accessor. So the same read, write, scan, and disassemble calls work on your own process or on any process ID you attach to, and the operating system primitives behind them stay out of your way.

Where something genuinely cannot cross the process boundary, the library says so instead of pretending. Function detours and code generation are local operations, and calling one through a remote address raises a clear, typed error.

Where it runs

Windows

MSVC, x64

Exercised in CI

x86_64

Exercised in CI, with sanitizers

aarch64, 32-bit ARM

Compile-checked in CI

macOS

x86_64

CI job, with Mach VM and dyld

Find what you are looking for

Pattern scanning uses IDA-style signatures, with chunked reads for remote targets, cancellation, and a progress callback, so a long scan can drive a progress bar and be abandoned cleanly. Typed scans look for exact values, ranges, or bitmasks, and a scan session narrows candidates progressively as a value changes, with one level of undo.

For code, the library lists the functions in a module, finds cross-references, and locates vtables and string tables. On an x64 PE module, function listing reads the exception directory and adds direct call and tail jump targets to find leaf functions. Other modules fall back to a prologue heuristic, and the documentation is upfront that a heuristic can both miss functions and flag code that only looks like a start.

Addresses that move between runs are handled by pointer chains. You can resolve a chain with diagnostics that report the exact step where it broke, watch one as its target reallocates, or use the reverse pointer scanner to discover static-based paths in the first place.

Change what it does

Function detours are backed by PolyHook 2.0, with declarative registration that binds a hook to a signature and installs it at startup. Vtable patching, NOP, return, jump, and call primitives are all available, and each one hands back a handle that restores the original when you are finished. A dry-run mode skips the writes, so call sites can be unit-tested without changing real code.

Writing into another process on Linux requires changing page protections that the kernel will not let you change from outside. Bytebinder does this by freezing every thread with ptrace, injecting a single mprotect system call on the leader thread, then restoring the bytes and registers exactly. The flow is implemented for x86_64, aarch64, and 32-bit ARM, including Thumb mode, and it takes care to handle threads created during the freeze itself. On macOS it uses mach_vm_protect.

Changing page protection from outside a process on Linux

01

1. Freeze

Attach to every thread with ptrace, and retry until no new threads appear.

02

2. Inject

Overlay one system call instruction on the leader thread and step it once.

03

3. Restore

Put the bytes and registers back exactly, then detach from every thread.

Understand what you found

Disassembly is backed by Zydis and reads through the bound accessor, so it works the same on a local pointer and a remote address. Symbol resolution parses ELF tables directly from disk on Linux without a libelf dependency, uses DbgHelp on Windows, and reads Mach-O symbol tables on macOS, including images in the dyld shared cache.

The debugger primitives cover thread suspend and resume, register access, up to four hardware watchpoints, and an exception-wait loop that reports hits with the faulting instruction. Together, those are the core of the question of what writes to a given address. Memory dumps write readable regions to disk with a manifest, so a process can be studied after it has gone.

What it is for

Bytebinder is meant for legitimate work: security researchers conducting vulnerability assessments, educators teaching low-level programming and security, and developers creating debugging and testing tools. It must not be used for unauthorized access to systems or for distributing malicious software, and everyone who uses it remains responsible for complying with the law.

It is also the foundation we use ourselves. Foundry, our desktop reverse engineering suite, runs its engine on Bytebinder, so the library is shaped by the demands of a full debugging product rather than only by small examples.

What is included

Everything is available through a single include, with typed exceptions and RAII handles throughout.

In and out of process

A single API over the current process or a remote one, chosen when you create the handle.

Typed memory access

Fluent offsets, RIP-relative arithmetic, typed reads and writes, and C and UTF-16 strings across page boundaries.

Pattern and value scanning

IDA-style signatures, typed scans, and progressive scan sessions with cancellation and progress.

Pointer tools

Chain resolution with diagnostics, watchers, reverse pointer scanning, and a search for who points at an address.

Hooks and patches

PolyHook detours, static registrations, vtable patching, and reversible handles.

Code analysis

Function listing, cross-references, vtable and string table discovery.

Disassembly

Zydis-decoded instructions, on local and remote memory alike.

Symbols

ELF, DbgHelp, and Mach-O resolution, plus address-to-name lookup with caching.

Debugger primitives

Thread control, registers, hardware watchpoints, and an event loop.

Diagnostics

Typed error codes, a pluggable log sink, memory snapshots, and a version and ABI check.

How it is built

A small set of concepts that stack, each usable on its own.

01

bb::process

Process handle The current process or a remote process ID, with its modules, regions, scanners, and symbols.

02

bb::mem

Address A fluent wrapper over an address and an accessor, for offsets, reads, writes, disassembly, and local patches.

03

bb::memory_accessor

Abstraction The local or remote implementation of reads, writes, protection changes, and region listing.

04

Platform backends

Windows, Linux, macOS ReadProcessMemory and VirtualQueryEx, process_vm_readv and /proc, or Mach VM and dyld.

Who it is for

Tool authors

Build debuggers, profilers, and analysis tools on tested primitives rather than writing platform code again.

Security researchers

Script assessments of software you are authorized to test, in a language close to the machine.

Educators and students

Teach and learn how processes, memory, and calling conventions work using readable, typed code.

Good to know

The README is specific about where the edges are, and so are we.

  • Hooks, code generation, and allocation are local to the calling process and raise an error if used through a remote handle.
  • Detours need enough bytes to overwrite the function prologue safely, typically 14 or more on x64, so very small leaf functions may fail to hook.
  • Attaching to a process may need elevated rights. On Linux, ptrace scope and capabilities apply. On macOS, it takes root or a debugger entitlement.
  • On macOS, Apple Silicon is supported only through Rosetta 2, because PolyHook is x86-only. Aarch64 and 32-bit ARM Linux paths are compile-checked in CI rather than run there.

Questions

How do I add it to my project?

Clone the repository with its submodules, build with CMake 3.28 or newer and a C++20 compiler, then link either the static or the shared target. The README has the commands and a catalog of worked examples.

Can I use it in a commercial product?

Bytebinder is licensed under BSD 3-Clause, a permissive license that allows commercial use as long as its terms and notices are kept. Please read the license itself for the details.

Is it the same thing as Foundry?

No. Bytebinder is the open source library, and Foundry is a separate desktop application built on top of it. If you want to write your own tool, start with Bytebinder. If you want a finished workspace, look at Foundry.

How can I contribute?

Issues and pull requests are welcome on GitHub, and the repository includes contribution guidelines and a code of conduct.

Want to talk about Bytebinder?

Tell us what you are working on. We are happy to walk through it with you and answer honestly whether it fits.

Contact

Talk to Rymote.

About a product, a project, or something you have not decided on yet. Tell us what you are working on, and a person will write back.