Skip to main content
The scope:calls allows to match and analyze specific function calls in the binary, including tracking dataflow between parameters and return values.

Syntax

Reference

to

The to argument specifies the called function(s) to identify in the binary. It can be a string (function name), an AddressValue (function address), or a CallsToQuery with pattern matching options.

where

The where argument specifies a Lua expression that is used to filter function calls. The only allowed variable in the expression is caller, which exposes the following methods:
  • caller:named "name": returns true if the caller function name matches the provided name.
  • caller:has_call "name": returns true if the caller contains a call to the specified function.
  • caller:has_calls {"name1", "name2"}: returns true if the caller contains calls to all the specified functions.
  • caller:calls "name": returns the table of call-site addresses for the specified function.

using

The using argument accepts a Lua expression that specifies how parameters should be annotated for the dataflow engine.
  • callees: allows annotations to be assigned to parameters and the returned value for arbitrary function calls
  • parameters: allows annotations to be assigned to the analysed function parameters
The parameters attribute is used to annotate the parameters of the function being analyzed, while the callees attribute is used to annotate the parameters and outputs of functions that are called within the function being analyzed.
Do not use the same annotation several times.
Note: The function var:named "Name" creates a named annotation for tracking a specific variable in the dataflow.

with

The with argument specifies the Lua function to execute for each matching call site in the binary file.

Example

Let’s consider the following function:
The following rule will be able to identify the function call to FunctionC:
In this example, we track three different values in FunctionA:
  1. The first parameter of FunctionA (annotated as “VarB1”) is passed as the first parameter to FunctionC.
  2. The first parameter of FunctionB (annotated as “VarC1”) is passed as the second parameter to FunctionC.
  3. The return value of FunctionB (annotated as “Out”) is passed as the third parameter to FunctionC.
The _ placeholders in the annotations indicate parameters we don’t need to track.