Ysopwnableandgensokyo-dev e1b66df5bc feat(native): recover UniFFI library interfaces from exports (#17215)
* feat(native): describe the UniFFI library report and its read budgets

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(native): recover UniFFI interfaces from a library's exports

Group a library's UniFFI scaffolding exports by namespace: objects named
by their free and clone functions with their constructors and methods,
functions, callback interfaces and runtime helpers. The contract version
and each item's checksum are read from function bodies that return only
that constant (x86, x86-64 with or without endbr, arm64), and NAMESPACE
and UDL_FILE metadata buffers are decoded. Nothing is called; a method
that two object names could own is listed under the longer and counted.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(native): read UniFFI libraries through an identity-checked provider

The provider reads one bounded PE or ELF file, maps its export addresses
through the image's own declarations and decodes the UniFFI interface. A
refusal at max_entries, max_text_bytes or max_file_bytes names the budget
to raise.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(analysis): summarize retained UniFFI library reports

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* refactor(analysis): bound the UniFFI summary's namespaces with boundedList

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(native): add the inspect_uniffi_library tool

CLI inspect-uniffi-library and MCP inspect_uniffi_library recover a
UniFFI library's namespaces, objects, methods, functions, callback
interfaces, contract version and checksums from its exports without
loading it. Large reports return the retained per-namespace summary
within the agent budget.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(native): describe UniFFI interface recovery

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(skill): route UniFFI libraries to inspect_uniffi_library

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* ci: scope the UniFFI reader with the native formats

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* chore(schemas): record the advertised inspect_uniffi_library catalog summary

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(native): keep UniFFI grouping linear and its omissions visible

- Namespaces, metadata owners and object owners are found by looking up
  each underscore-delimited prefix of a name, instead of scanning every
  namespace or object for every export.
- A body or metadata buffer reads the longest mapped prefix, so a constant
  that ends at its mapping's end is still decoded.
- A metadata buffer that cannot be read or decoded is counted apart from
  kinds this reader does not decode, and makes coverage partial.
- A partial export table carries its reasons into the report.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(native): expose max_structure_bytes for UniFFI library inspection

The export reader's table-size limit is now a caller control, and its
refusal names it, as inspect_native_exports does.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(cli): honour delivery options for inspect-uniffi-library

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(native): list the UniFFI structure budget and record its schema

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(native): match UniFFI namespaces and owners with a prefix trie

Namespaces, metadata owners and object owners are now found by walking
the name once through a trie of the known words, from the positions where
UniFFI spells them. The cost per name grows with its length, not with its
underscore count squared or with the number of known words.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(native): index UniFFI prefixes by hash instead of a character trie

A character trie allocated a node and a map for every distinct prefix, so
long crafted export names could exhaust the heap before the report's text
checks. The prefix index now keeps one entry per known word, keyed by two
polynomial hashes, and walks each name once computing the hashes of its
underscore-ended prefixes; only the longest matches are compared.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(native): map UniFFI reads through one index and check namespace shapes

- Constant and metadata reads use one file-mapping index built with the
  image's zero-filled ranges, so each read is a lookup and an ambiguous
  address reads as unknown instead of as definite bytes.
- The ELF container read honours max_structure_bytes, as the export read
  already did.
- 32-bit x86 images, which the shared readers name 386, decode their
  constants.
- A scaffolding symbol belongs to the longest namespace whose remainder
  has a scaffolding shape, so a namespace ending in _fn cannot take
  another namespace's functions.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(native): carry the export reader's issues into a partial UniFFI report

A partial export table now reports its first issues by code and message,
counting the rest, before falling back to its limitations.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(native): consider every shaped namespace match for UniFFI symbols

The scaffolding shape after a namespace is now checked while the name is
walked, so every span followed by _fn_ or _checksum_ is a candidate, not
only the longest four matches; only the chosen word is compared.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

---------

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-06 06:30:31 +08:00

REA: Reverse Engineer Anything logo

REA: Reverse Engineer Anything

See a feature you like. Understand how it works, down to the binary level.

Ask your coding agent about an app, a game or a website. REA lets it look inside,
explain how a feature works, show the evidence, and build a version for your project.

GitHub stars Monthly npm downloads MIT license skills.sh

English · 简体中文 · 繁體中文 · 日本語 · 한국어 · Türkçe · Русский · Tiếng Việt · ไทย · Deutsch · Español · Français · Українська · Polski · Português (Brasil) · العربية · فارسی · Bahasa Indonesia · Italiano · Ελληνικά · മലയാളം · Roman Urdu · Română · Български · हिन्दी · Nederlands · বাংলা

Get started Join us on Discord Follow REA on X


Your coding agent asks REA what /usr/bin/true does. REA opens it in Hopper, finds the entry point at 0x100000368, and shows the two instructions: mov w0, #0x0 and ret. The program reports success and exits.

REA opening a real program in Hopper for an agent. The answer comes with the instructions behind it.

What REA does

See a feature in an app that you want in your own product? Ask your agent to investigate it with REA. It can inspect the app without its source code, explain how the feature works, show the evidence, and build a version for your project.

REA connects your agent to tools for inspecting native binaries, JavaScript and Electron apps, .NET assemblies, and websites. You can also use the same tools from your terminal. Analysis runs on your computer, and results include the evidence and limitations behind each conclusion.

Get started

Follow the setup guide at rea.tools. It walks through each step for your computer and agent, and gives you a prompt you can paste so your agent sets REA up for you.

Never used an AI agent? Start with the beginner's guide. New to the term? Read what reverse engineering is.

With Node.js installed, run this from a trusted folder outside the project you plan to analyze:

npx rea-agents setup

Choose your agent, approve the setup plan, then restart your agent. Setup backs up your existing configuration first. Native analysis can use Hopper, Ghidra, IDA or Kuna if you have one; setup can install Hopper for you after asking. Then try your first investigation.

To update later, run npx rea-agents@latest setup again, or ask your agent to update REA. Get REA only from this repository, rea.tools or the rea-agents npm package.

Setup works with the supported agents; other agents that support local MCP servers can use manual registration. The installation guide also covers updates and troubleshooting.

Showcases

Each example starts with one question to an agent. Read the case study to see the evidence REA returned and how the result was checked.

Dinosaur game: change how fast it runs

The rebuilt dinosaur game mid-jump with a speed slider, next to the agent's answer: the speed starts at 6 and grows by 0.001 each update while it is below 13.

Find the rule that makes the game speed up, then rebuild it with a speed slider. Play the rebuilt game

Notion: follow a copy from the page to the clipboard

The path of Notion's copy action, from the page through the preload and main process to Electron's clipboard, joined by the notion:clipboard:write channel.

Trace how Notion's desktop app copies text and HTML, step by step, with the code at each step. Read the case study

Aegis: rebuild an Android app's login codes

A demo that turns a clock time into a 30-second block and a six-digit code, next to the agent's answer: the app mixes the block number with the account key.

Find how the Aegis authenticator makes its six-digit login codes, then rebuild the calculation with a clock you can move. Read the case study

DX-Ball: recover a game's sound panning

The DX-Ball sound-pan calculation, from the function at 0x00406400 to maintained C code checked against 3,205 original cases.

Recover how a brick's position sets where you hear the hit, and check the rebuilt C against the original in 3,205 cases. Read the case study · Reconstruction repository

CTF: solve a flag checker

One of the flag checker's masks selecting a single position, next to the agent's answer: 26 masks give 26 equations, and solving them gives the flag.

Find the checks in DownUnderCTF's masked squares challenge, turn them into equations, and confirm the flag with the original program. Read the case study

TH04: recover a DOS game's bullet rings

Two 16-bullet rings, one fixed and one aimed at the player, spaced 16 angle units apart.

Find how the PC-98 game spaces a ring of bullets and aims it at the player. Read the case study · Reconstruction repository

See all case studies

Used REA on something interesting? Share it in an issue or a pull request with the target, your question, and what you found.

How REA works

  1. You ask your agent about an app, a game or a website on your computer.
  2. REA looks inside it for your agent, using tools such as Hopper, Ghidra or IDA, and finds the code behind the feature.
  3. Your agent reads the evidence: the code, where it is used, and what is still unknown. It can ask REA follow-up questions.
  4. Your agent uses what it learned to explain the feature, or to build and test a version for your project.

Agents connect to REA through MCP, and the command-line tool runs the same steps.

What you can analyze

REA covers native binaries, JavaScript and Electron apps, websites, .NET assemblies, Android apps, firmware, and recorded runtime and network activity. See supported targets and requirements and the guides.

For native decompilation, choose a provider that supports your target format and host OS. See choosing a deep analysis provider. Already use Ghidra or IDA? See use Ghidra or IDA with an AI agent.

Also in the box

  • A command-line tool. Run the same analysis from your terminal, for example npx -y rea-agents@latest analyze-javascript-application /path/to/app --json. See the CLI and Evidence guide.
  • Practice environments for agents. Build a local copy of a recorded web session or a Linux desktop app so an agent can practice a task and check its result. See Build an RL environment.

Questions

Wondering whether you need Hopper, whether your app gets uploaded, or what to do when something breaks? The FAQ has answers, and you're always welcome to ask on Discord.

Documentation

Start with the website's worked guides. For exact options, prerequisites and result contracts:

Report vulnerabilities through SECURITY.md.

Community

  • Discord: ask questions and share what you're investigating.
  • X (@reatools): releases and new showcases.
  • GitHub issues: report a bug or ask for a feature or file format.

Contributing

We'd love your help with REA! Open an issue to report a bug or suggest a feature, or send a pull request to improve the code or docs. See CONTRIBUTING.md for development setup and checks, and the testing guide for verification lanes.

Thanks to everyone using REA, reporting bugs, testing builds, and contributing fixes.

REA contributors REA GitHub star history

Disclaimer

See DISCLAIMER.md for responsible-use guidance.

The project's position on illegal or unauthorized use covers all REA versions, distribution channels, and platforms; each copy retains its applicable licenses.

REA is for lawful research, education, interoperability, software preservation, and analysis of software you own or are authorized to examine.

License

MIT

REA-authored code is licensed under MIT. Third-party material retains its own licenses and copyright notices; see Third-party notices for the dependency inventory, preserved license texts, and external-tool terms.

You must legally obtain and be authorized to use commercial tools, including IDA Pro / Hex-Rays decompilers, Hopper, and JEB, under their applicable licenses. REA grants no tool license, key, or activation entitlement. Trials and demos remain subject to vendor terms, including user, feature, automation, and output sharing restrictions. Cracked copies, stolen keys, unauthorized key sharing, and bypassing license restrictions are not authorized. This guidance does not amend MIT or third-party licenses.

Languages
TypeScript 91.4%
JavaScript 4.8%
HTML 1.2%
Python 1%
Java 1%
Other 0.3%