scope:calls object allows you to inspect function calls, including properties computed by the taint engine implemented in VulHunt.
This scope is used to write rules that analyze call sites in the binary.
The scope:calls expects four arguments:
to: the function to identify in the input binary. Can be astring(function name), anAddressValue(function address), or aCallsToQueryobject.where: a Lua expression to filter function calls. The expression can usecaller:named,caller:has_call,caller:has_calls, andcaller:calls.using: specifies parameter annotations for the dataflow engine.with: the check function, which takes aProjectHandleand aCallSiteTable.
CallSiteTable provides access to the caller’s information via CallSiteContext, as well as to function inputs and outputs through OperandInfo.
CallSiteContextexposes details such as the name and address of the caller function and the address of the call site.OperandInfodescribes the properties of the function’s arguments and return value, including taint annotations, operand origin, and, when available, its value.
Example
strcpy within a function named target_function, and how labels can be propagated by the dataflow engine.
The using argument specifies that the third parameter of target_function should be annotated with the label input.
The check function receives a CallSiteTable as its context, which provides access to the caller’s information via CallSiteContext, and to the function’s arguments and return value via OperandInfo.
By accessing the annotation field of an OperandInfo, you can verify whether the taint engine propagated the label specified in the using argument of scope:calls.
Other methods of OperandInfo allow retrieving the constant value of an operand, either as a string or as bytes, when available.