Skip to main content

No project description provided

Project description

reait

RevEng.AI Toolkit

Analyse compiled executable binaries using the RevEng.AI API. This tool allows you to search for similar components across different compiled executable programs, identify known vulnerabilities in stripped executables, and generate "YARA++" REAI signatures for entire binary files. More details about the API can be found at docs.reveng.ai.

NB: We are in Alpha. We support GNU/Linux ELF and Windows PE executables for x86_64, and focus our support for x86_64 Linux ELF executables.

Installation

Install the latest stable version using pip.

pip install reait

Latest development version

pip install -e .

or

python3 -m build .
pip install -U dist/reait-*.whl

Using reait

Analysing binaries

To submit a binary for analysis, run reait with the -a flag:

reait -b /usr/bin/true -a

This uploads the binary specified by -b to RevEng.AI servers for analysis. Depending on the size of the binary, it may take several hours. You may check an analysis jobs progress with the -l flag e.g. reait -b /usr/bin/true -l.

Extract symbol embeddings

Symbol embeddings are numerical vector representations of each component that capture their semantic understanding. Similar functions should be similar to each other in our embedded vector space. They can be thought of as advanced AI-based IDA FLIRT signatures or Radare2 Zignatures. Once an analysis is complete, you may access RevEng.AI's BinNet embeddings for all symbols extracted with the -x flag.

reait -b /usr/bin/true -x > embeddings.json

Extract embedding for symbol at vaddr 0x19f0

reait -b /usr/bin/true -x | jq ".[] | select(.vaddr==$((0x19f0))).embedding" > embedding.json

Search for similar symbols using an embedding

To query our database of similar symbols based on an embedding, use -n to search using Approximate Nearest Neighbours. The --nns allows you to specify the number of results returned. A list of symbols with their names, distance (similarity), RevEng.AI collection set, source code filename, source code line number, and file creation timestamp is returned.

reait -e embedding.json -n

The following command searches for the top 10 most similar symbols found in md5sum.gcc.og.dynamic to the symbol starting at 0x4037e0 in md5sum.clang.og.dynamic. You may need to pass --image-base to ensure virtual addresses are mapped correctly.

reait -b md5sum.gcc.og.dynamic -n --start-vaddr 0x33e6 --found-in md5sum.gcc.o2.dynamic --nns 10 --base-address 0x100000

Search NN by symbol name. reait -b md5sum.gcc.og.dynamic -n --symbol md5_buffer --found-in md5sum.gcc.o2.dynamic --nns 5

NB: A smaller distance indicates a higher degree of similarity.

Specific Search

To search for the most similar symbols found in a specific binary, use the --found-in option with a path to the executable to search from.

reait -n --embedding /tmp/sha256_init.json --found-in ~/malware.exe --nns 5

This downloads embeddings from malware.exe and computes the cosine similarity between all symbols and sha256_init.json. The returned results lists the most similar symbol locations by cosine similarity score (1.0 most similar, -1.0 dissimilar).

The --from-file option may also be used to limit the search to a custom file containing a JSON list of embeddings.

Limited Search

To search for most similar symbols from a set of RevEng.AI collections, use the --collections options with a RegEx to match collection names. For example:

reait -n --embedding my_func.json --collections "(libc.*|lib.*crypt.*)"

RevEng.AI collections are sets of pre-analysed executable objects. To create custom collection sets e.g., malware collections, please create a RevEng.AI account.

Unstripping binaries

Find common components between binaries, RevEng.AI collections, or global search, by using -M, --match.

Example usage:

reait -M -b 05ff897f430fec0ac17f14c89181c76961993506e5875f2987e9ead13bec58c2.exe --from-file 755a4b2ec15da6bb01248b2dfbad206c340ba937eae9c35f04f6cedfe5e99d63.embeddings.json --confidence high

RevEng.AI embedding models

To use specific RevEng.AI AI models, or for training custom models, use -m to specify the model. The default option is to use the latest development model. Available models are binnet-0.1 and dexter.

reait -b /usr/bin/true -m dexter -a

Software Composition Analysis

To identify known open source software components embedded inside a binary, use the -C flag.

Stripped Binary CVE Checker

To check for known vulnerabilities found with embedded software components, use -c or --cves.

REAI Signatures

To generate an AI functional description of an entire binary file, use the -s flag. This will return the REAI signature of the file.

REAI signatures can be used to compute the binary similarity between entire executables with the -S flag. For example:

reait -b d24ccf73aabca4192d33a07b4a238c8d40ac97a550c2e65b8074f03455a981ca.exe -S -t 00062cb01088cea245cd5f3eb03f65a0e6b11a8126ce00034d87935a451cf99c.exe,438d64bb831555caadaa92a32c9d62e255001bc8d524721c885f37d750ec3476.exe,755a4b2ec15da6bb01248b2dfbad206c340ba937eae9c35f04f6cedfe5e99d63.exe,05ff897f430fec0ac17f14c89181c76961993506e5875f2987e9ead13bec58c2.exe
Computing Binary Similarity... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:01
                      Binary Similarity to RedlineInfoStealer/d24ccf73aabca4192d33a07b4a238c8d40ac97a550c2e65b8074f03455a981ca.exe                      
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃                                                               Binary ┃ SHA3-256                                                         ┃ Similarity ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ 00062cb01088cea245cd5f3eb03f65a0e6b11a8126ce00034d87935a451cf99c.exe │ 00062cb01088cea245cd5f3eb03f65a0e6b11a8126ce00034d87935a451cf99c │ 0.99907    │
│ 438d64bb831555caadaa92a32c9d62e255001bc8d524721c885f37d750ec3476.exe │ 438d64bb831555caadaa92a32c9d62e255001bc8d524721c885f37d750ec3476 │ 1.00000    │
│ 755a4b2ec15da6bb01248b2dfbad206c340ba937eae9c35f04f6cedfe5e99d63.exe │ 755a4b2ec15da6bb01248b2dfbad206c340ba937eae9c35f04f6cedfe5e99d63 │ 0.80522    │
│ 05ff897f430fec0ac17f14c89181c76961993506e5875f2987e9ead13bec58c2.exe │ 05ff897f430fec0ac17f14c89181c76961993506e5875f2987e9ead13bec58c2 │ 0.94701    │
└──────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────┴────────────┘

Binary ANN Search

To perform binary ANN search, pass in -n and -s flag at the same time. For example:

reait -b /usr/bin/true -s -n
Found /usr/bin/true:elf-x86_64
[
  {
    "distance": 0.0,
    "sha_256_hash": "1d20d8b1bbc861a2e9e0216efb7945fba664a5e6ba5f6a93febd6612a92551a8"
  },
  {
    "distance": 0.04410748228394201,
    "sha_256_hash": "265cb456cf5a09ad82380cb98118fb9255a9c9407085677d597abd828a5f4b11"
  },
  {
    "distance": 0.04710724400903421,
    "sha_256_hash": "1de9c70e46b17a96ee15e88e52da260de4f2d70e167c5172c29416d16f907482"
  },
  {
    "distance": 0.047961843853272956,
    "sha_256_hash": "01bf5e0f03dfaf6324f7e00942fed88ca52845c190a7392b0d0eb5c3a91091df"
  },
  {
    "distance": 0.05086539098571474,
    "sha_256_hash": "62dd31307316ee0e910eb845f35bf548b7fd79dc9f407ef917efdf14d143842e"
  }
]

Configuration

reait reads the config file stored at ~/.reait.toml. An example config file looks like:

apikey = "l1br3"
host = "https://api.reveng.ai"
model = "binnet-0.1"

Contact

Connect with us by filling out the contact form at RevEng.AI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reait-0.0.18.tar.gz (52.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

reait-0.0.18-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

reait-0.0.18-1-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

Details for the file reait-0.0.18.tar.gz.

File metadata

  • Download URL: reait-0.0.18.tar.gz
  • Upload date:
  • Size: 52.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for reait-0.0.18.tar.gz
Algorithm Hash digest
SHA256 05bf84f3299a626891310f5bdf8a5b568f2279d43192b3f97f0b3eacc5284c55
MD5 b0953c51f6da5d1ab860a235c7859172
BLAKE2b-256 bbcc0b252e53ed170908e7473de2907ceb22474c5a541e8705cd58621defbcbd

See more details on using hashes here.

File details

Details for the file reait-0.0.18-py3-none-any.whl.

File metadata

  • Download URL: reait-0.0.18-py3-none-any.whl
  • Upload date:
  • Size: 38.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for reait-0.0.18-py3-none-any.whl
Algorithm Hash digest
SHA256 ecea0583602f26c2a6df6c6f6d66ce67b030e565b8e0c9bef0154dcb5489991f
MD5 ace549fda7f33892989b93a550878d5a
BLAKE2b-256 352171376a54e75364b6dfc6f1cb0a85e7e20d7ced1c8e4d9f5ca5cbebbbdb1c

See more details on using hashes here.

File details

Details for the file reait-0.0.18-1-py3-none-any.whl.

File metadata

  • Download URL: reait-0.0.18-1-py3-none-any.whl
  • Upload date:
  • Size: 38.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for reait-0.0.18-1-py3-none-any.whl
Algorithm Hash digest
SHA256 2b5dadac34f2e70630dffbd13ee6cb4e616e208516db316fef5271444ce0b491
MD5 35e623f453719d965d7f2464bc148de8
BLAKE2b-256 f07254c5cabeee397e94d371f42837b7bd70ea1bf37c34f77cf846c046785e63

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page