Your first memory scan
Understand values, byte patterns and incremental rescans instead of treating a scanner as magic.
What you will learn
A scanner is a search over a process’s address space. After this tutorial you will know what it searches, why results shrink when you rescan, and what the operation mode changes.
Before you start
Have Muramasa running and attach it to a program you own. A small test program with a number that changes when you press a key is ideal — you control the input, so you control the answer.
Values and byte patterns
There are two common ways to describe what you are looking for:
- A value — “find the integer 60”. The scanner interprets bytes as a type (integer, float, ASCII) and compares them.
- A byte pattern — “find
DE AD ?? EF”, where??is a wildcard. This matches raw bytes regardless of how a program interprets them.
A value search answers what the program thinks. A pattern search answers what is physically there. Both are useful.
Regions matter
A process does not own one flat block of memory. It has mapped regions with permissions: readable, writable, executable. A scanner walks those regions, skips ones it cannot read, and shows you where matches live. Narrowing the search to writable regions often removes most of the noise, because values that change at runtime usually live there.
Why rescanning works
One scan can return thousands of matches. Change the value in the program, then ask the scanner to rescan the previous results for the new value. Each round discards addresses that did not follow the change. After a few rounds you are usually left with a handful of candidates — that is incremental scanning, and it is the core idea behind the ms sub-crate in black_box.
External or internal mode
By default reads go through the operating system’s process APIs (External mode). That is simple and safe to reason about. In Internal mode black_box injects a small payload into the target and reads through a shared-memory channel. This can reach regions the OS reader misses and can keep scanning while the target runs, but it changes how you should think about the target. Start in External mode; switch only when you have a reason.
Try it
- Attach to your test program.
- Search for a value you know it holds.
- Change the value through the program’s own UI.
- Rescan for the new value.
- Open one remaining address in the hex view and interpret it as several formats. Ask yourself which interpretation makes sense.
Next
- Breakpoints and watchpoints — find the instruction that wrote the value.
- Read the scanner implementation in black_box.