Vector35 / Vector35/binaryninja-api

Support `.callers` and other `Function` methods for extern functions

Open
#6,722 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: API Effort: Low Impact: Low
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

What is the feature you'd like to have?
I'd like extern (imported) functions to be fully represented as Function objects (or at least to have a wrapper/interface that behaves similarly), so that I can use standard API methods and properties like .callers, .caller_sites, etc. For example, I'd expect bv.get_functions_by_name("strcpy") to return the extern function if it's present in the binary.

Is your feature request related to a problem?
Yes. Currently, extern functions (such as those from standard libraries) are represented differently in the MLIL (e.g., as MediumLevelILExternPtr in the dest field of MediumLevelILCall). Because of this, I cannot interact with them using the same APIs available for regular functions. As a result, methods like .callers and .caller_sites do not work for them. There also seems to be no straightforward way to get call sites to extern functions without iterating through all IL instructions in all functions manually.

Are any alternative solutions acceptable?
If exposing extern functions as regular Function objects is not feasible, I would appreciate an alternative API that allows querying for call sites to extern functions by name or address, without needing to manually walk through every function's IL.

Additional Information:
This feature would improve the developer experience when writing plugins or analyses that rely on detecting uses of unsafe or critical extern functions like strcpy, malloc, or system.

This might be related to or similar to issue #2663.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing issue #2663 and the existing Function APIs around bv.get_functions_by_name, then trace how extern calls are represented by MediumLevelILExternPtr in MediumLevelILCall. Done means extern functions expose the requested Function-style queries, or a documented query for their call sites without manually walking every function's IL.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design, reverse-engineering
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.