Technique:Library function recognition
Appearance
| On this wiki | Facts · Code · Notes · Topics |
|---|
Statically linked runtime and third-party library code makes up most functions of many binaries; matching it against known signatures (FLIRT, Ghidra Function ID, BSim, capa) lets you skip it and name it.
Why
A typical C/C++ executable contains hundreds to thousands of functions from the C runtime, STL, ATL/MFC, zlib and so on. Naming them first leaves only the program's own code to analyse. Methods differ in what they store:
| Method | Stores | Survives | Weak against |
|---|---|---|---|
| Format:FLIRT signature files (.pat, .sig) | first 32 bytes with relocations masked, CRC16 of the next bytes, length | different load address | other compiler options, inlining, LTO |
| Tool:Ghidra Function ID (.fidb) | FNV-1a 64-bit hash of the masked instruction stream of a function, plus a second hash that includes small constants, and call relations | register-allocation-neutral changes only; operands are masked | different compiler or optimisation flags |
| Tool:Ghidra BSim | feature vectors from decompiler output in a database, locality-sensitive hashing | compiler and architecture changes, small source edits | very small functions |
| String and constant identification (see Technique:Identifying compression libraries in binaries) | magic constants, error strings, version strings | everything except stripping of strings | custom forks |
Workflow
- Identify the compiler and runtime first (PE rich header, linker version, strings such as
Microsoft Visual C++ Runtime Library); pick signatures for exactly that toolchain. - Apply signatures (IDA: File > Load file > FLIRT signature file; Ghidra: analysis option Function ID plus attached .fidb files).
- Check a few hits by hand; treat renames of tiny functions with suspicion (Ghidra refuses to return hits for tiny functions unless flagged auto-pass).
- Make your own signatures from a library you have the object code for: FLAIR tools (
pcf,sigmake) for FLIRT, or Tools > Function ID > Populate FidDb from programs for Ghidra. - Consider symbol maps published on this wiki (export_symbols) for the same library build.
Related
Technique:Function hooking (hooks often hit library functions found this way), Library:Microsoft Detours, Library:MinHook.
Code & repositories
- https://github.com/williballenthin/lancelot @
03b72e3105ec255380c4755f4d7d3b0bab6192c2· license: Apache-2.0
lancelot-flirt: Rust parser/matcher for FLIRT .pat and .sig files (flirt/src/sig, flirt/src/pat) with a 010 Editor template sig.bt; python-flirt bindings.
Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2026-07-25 - https://github.com/mandiant/capa @
7a235c46965ea0965c65be3b9ee1e21dca686f3d· license: Apache-2.0
capa: its sigs/ directory holds three Apache-2.0 FLIRT .sig files (MSVC runtime, ATL/MFC, common libraries) built with FLAIR, not derived from IDA's.
Tested on: source read, not run: sigs header bytes read, not run · checked 2026-10-18; last activity 2026-10-16; Note: the latest release ships binaries; the wiki links only the source, never the binaries