FindFunc is an IDA Pro plugin to find code functions that contain a certain assembly or byte pattern, reference a certain name or string, or conform to various other constraints. This is not a competitor to tools like Diaphora or BinNavi, but it is ideal to find a known function in a new binary for cases where classical bindiffing fails.
The main functionality of FindFunc is letting the user specify a set of “Rules” or constraints that a code function in IDA Pro has to satisfy. FF will then find and list all functions that satisfy ALL rules (so currently all Rules are in an AND-conjunction). Exception: Rules can be “inverted” to be negative matches. Such rules thus conform to “AND NOT”.
FF will schedule the rules in a smart order to minimize processing time. Feature overview:
Button “Search Functions” clears existing results and starts a fresh search, “Refine Results” considers only results of the previous search.
A secondary feature of FF is the option to copy binary representation of instructions with the following options:
See “advanced copying” section below for details. This feature nicely complements the Byte Pattern rule!
FindFunc is an IDA Pro python plugin without external package dependencies. It can be installed by downloading the repository and copying file findfuncmain.py and folder findfunc to your IDA Pro plugin directory. No building is required.
Requirements: IDA Pro 7.x (7.6+) with python3 environment. FindFunc is designed for x86/x64 architecture only. It has been tested with IDA 7.6/7.7, python 3.9 and IDAPython 7.4.0 on Windows 10.
Currently the following six rules are available. They are sorted here from heavy to light with regard to performance impact. With large databases it is a good idea to first cut down the candidate-functions with a cheap rule, before doing heavy matching via e.g. Code Rules. FF will automatically schedule rules in a smart way.
Rule for filtering function based on them containing a given assembly code snippet. This is NOT a text-search for IDAs textual disassembly representation, but rather performs advanced matching of the underlying instruction. The snippet may contain many consecutive instructions, one per line. Function chunks are supported. Supports special wildcard matching, in addition to literal assembly:
more examples:
mov r64, [r32 * 8 + 0x100]
mov r, [r * 8 – 0x100]
mov r64, [r32 * 8 + imm]
pass
mov r, word [eax + r32 * 8 – 0x100]
any r64, r64
push imm
push any
Gotchas: Be careful when copying over assembly from IDA. IDA mingles local variable names and other information into the instruction which leads to matching failure. Also, labels are not supported (“call sub_123456”).
Note that Code Patterns is the most expensive Rule, and if only Code Rules are present FF has no option but to disassemble the entire database. This can take up to several minutes for very large binaries. See notes on performance below.
The function must contain the given immediate at least once in any position. An immediate value is a value fixed in the binary representation of the instruction. Examples for instructions matching immediate value 0x100:
mov eax, 0x100
mov eax, [0x100]
and al, [eax + ebx*8 + 0x100]
push 0x100
Note: IDA performs extensive matching of any size and any position of the immediate. If you know it to be of a specific width of 4 or 8 bytes, a byte pattern can be a little faster.
The function must contain the given byte pattern at least once. The pattern is of the same format as IDAs binary search, and thus supports wildcards – the perfect match for the advanced-copy feature!
Examples:
11 22 33 44 aa bb cc
11 22 33 ?? ?? bb cc -> ?? can be any byte
The function must reference the given string at least once. The string is matched according to pythons ‘fnmatch’ module, and thus supports wildcard-like matching. Matching is performed case-insensitive. Strings of the following formats are considered: [idaapi.STRTYPE_C, idaapi.STRTYPE_C_16] (this can be changed in the Config class).
Examples:
Note: String matching is fast and a good choice to cut down candidates quickly!
The function must reference the given name/label at least once. The name/label is matched according to pythons ‘fnmatch’ module, and thus supports wildcard-like matching. Matching is performed case-insensitive.
Examples:
Note: Name matching is very fast and ideal to cut down candidates quickly!
The size of the function must be within the given limit: “min <= functionsize <= max”. Data is entered as a string of the form “min,max”. The size of a function includes all of its chunks.
Note: Function size matching is very fast and ideal to cut down candidates quickly!
For ease of use FF can be used via the following keyboard shortcuts:
Further GUI usage
Frequently we want to search for binary patterns of assembly, but without hardcoded addresses and values (immediates), or even only the actual opcodes of the instruction. FindFunc makes this easy by adding three copy options to the disassembly-popupmenu:
Copies all instruction bytes as hex-string to clipboard, for use in a Byte-Pattern-Rule (or IDAs binary search).
B8 44332211 mov eax,11223344
68 00000001 push 1000000
66:894424 70 mov word ptr ss:[esp+70],ax
Copies instruction bytes for given instruction, masking out any immediate values. Example:
B8 44332211 mov eax,11223344
68 00000001 push 1000000
66:894424 70 mov word ptr ss:[esp+70],ax
shadow-rs is a Windows kernel rootkit written in Rust, demonstrating advanced techniques for kernel manipulation…
Extract and execute a PE embedded within a PNG file using an LNK file. The…
Embark on the journey of becoming a certified Red Team professional with our definitive guide.…
This repository contains proof of concept exploits for CVE-2024-5836 and CVE-2024-6778, which are vulnerabilities within…
This took me like 4 days (+2 days for an update), but I got it…
MaLDAPtive is a framework for LDAP SearchFilter parsing, obfuscation, deobfuscation and detection. Its foundation is…