{"id":13796869,"url":"https://github.com/b2r2-org/b2r2","last_synced_at":"2025-05-15T16:04:20.302Z","repository":{"id":34420025,"uuid":"168692440","full_name":"B2R2-org/B2R2","owner":"B2R2-org","description":"B2R2 is a collection of useful algorithms, functions, and tools for binary analysis.","archived":false,"fork":false,"pushed_at":"2025-05-08T01:31:05.000Z","size":15224,"stargazers_count":428,"open_issues_count":7,"forks_count":64,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-05-08T02:29:53.041Z","etag":null,"topics":["aarch64","avr","binary","binary-analysis","cfg","disassembler","disassembly","dotnet","elf-parser","evm","fsharp","mach-o","mips","pe-binaries","reverse-engineering","risc-v","x86","x86-64"],"latest_commit_sha":null,"homepage":"https://b2r2.org","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/B2R2-org.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-02-01T12:12:00.000Z","updated_at":"2025-05-03T22:02:37.000Z","dependencies_parsed_at":"2024-10-30T11:03:07.980Z","dependency_job_id":"381a4d3d-4794-4290-b398-3e0a08205631","html_url":"https://github.com/B2R2-org/B2R2","commit_stats":{"total_commits":1458,"total_committers":30,"mean_commits":48.6,"dds":0.5233196159122084,"last_synced_commit":"6253b310f5fc1fc3349caa1a11697e2bdbfce40d"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/B2R2-org%2FB2R2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/B2R2-org%2FB2R2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/B2R2-org%2FB2R2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/B2R2-org%2FB2R2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/B2R2-org","download_url":"https://codeload.github.com/B2R2-org/B2R2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254374405,"owners_count":22060609,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aarch64","avr","binary","binary-analysis","cfg","disassembler","disassembly","dotnet","elf-parser","evm","fsharp","mach-o","mips","pe-binaries","reverse-engineering","risc-v","x86","x86-64"],"created_at":"2024-08-03T23:01:17.184Z","updated_at":"2025-05-15T16:04:20.296Z","avatar_url":"https://github.com/B2R2-org.png","language":"F#","funding_links":[],"categories":["\u003ca id=\"8c5a692b5d26527ef346687e047c5c21\"\u003e\u003c/a\u003e收集"],"sub_categories":[],"readme":"![alt text](https://b2r2.org//images/b2r2-2d-white.png)\n\n![B2R2](https://github.com/B2R2-org/B2R2/actions/workflows/debug.yml/badge.svg)\n![B2R2](https://github.com/B2R2-org/B2R2/actions/workflows/release.yml/badge.svg)\n![](https://img.shields.io/github/license/B2R2-org/B2R2.svg?style=flat)\n[![](https://img.shields.io/nuget/v/B2R2.RearEnd.Launcher)](https://www.nuget.org/packages/B2R2.RearEnd.Launcher/)\n\nB2R2\n====\n\nB2R2 is a collection of useful algorithms, functions, and tools for **binary\nanalysis**, written purely in F# (in .NET lingo, it is purely managed code).\nB2R2 has been named after [R2-D2](https://en.wikipedia.org/wiki/R2-D2), a famous\nfictional robot appeared in the Star Wars. In fact, B2R2's original name was\n*B2-R2*, but we decided to use the name *B2R2* instead, because .NET does not\nallow dash (-) characters in identifiers (or namespaces). The name essentially\nrepresents \"binary\" or \"two\": \"binary\" itself means \"two\" states anyways. \"B\"\nand \"2\" mean \"binary\", and \"R\" indicates *reversing*.\n\nB2R2?\n-----\n\n1. B2R2 is *analysis-friendly*: it is written in F#, which provides all the\n   syntactic goodies for writing program analyzers, such as pattern matching,\n   algebraic data types, and etc.\n\n1. B2R2 is *fast*: it has a fast and efficient front-end engine for binary\n   analysis, which is written in a\n   [functional-first](https://en.wikipedia.org/wiki/F_Sharp_(programming_language))\n   way. Therefore, it naturally supports *pure parallelism* for various binary\n   analysis tasks, such as instruction lifting, CFG recovery, and etc.\n\n1. B2R2 is *easy* to play with: there is absolutely no dependency hell for B2R2\n   because it is a fully-managed library.  All you need to do is to install\n   [.NET SDK](https://dotnet.microsoft.com/download), and you are ready to\n   go! Native\n   [IntelliSense](https://docs.microsoft.com/en-us/visualstudio/ide/using-intellisense)\n   support is another plus!\n\n1. B2R2 is *OS-Independent*: it works on Linux, Mac, Windows, and etc. as long\n   as .NET core supports it.\n\n1. B2R2 is *interoperable*: it is not bound to a specific\n   language. Theoretically, you can use B2R2 APIs with any [CLI supported\n   languages](https://en.wikipedia.org/wiki/List_of_CLI_languages).\n\nFeatures?\n---------\n\nB2R2 supports instruction parsing, binary disassembly, assembly, control-flow\nrecovery, and many more. B2R2 also comes with several user-level command-line\ntools that are similar to readelf and objdump, although our tools are\nplatform-agnostic. B2R2 currently supports four binary file formats: ELF, PE,\nMach-O, and WebAssembly.\n\nBelow is a list of features that we currently support. Some of them are work in\nprogress, but we look forward to your contributions! Feel free to write a PR\n(Pull Request) while making sure that you have read our [contribution\nguideline](CONTRIBUTING.md).\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth width=\"178px\"\u003eFeature\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003ex86\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003ex86-64\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003eARMv7\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003eARMv8\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003eMIPS32\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003eMIPS64\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003eEVM\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eInstruction Parsing\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eDisassembly\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eLifting\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eCFG Recovery\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:first_quarter_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:first_quarter_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:first_quarter_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:first_quarter_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eInstruction Emulation\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eAssembly\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth width=\"178px\"\u003eFeature\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003eTMS320\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003eAVR\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003ePA-RISC\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003ePPC\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003eSPARC\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003eSH4\u003c/th\u003e\n    \u003cth width=\"96px\" class=\"text-center\"\u003eRISC-V\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eInstruction Parsing\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:waxing_gibbous_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eDisassembly\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:waxing_gibbous_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eLifting\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eCFG Recovery\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:first_quarter_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:first_quarter_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:first_quarter_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:first_quarter_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eInstruction Emulation\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:full_moon:\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eAssembly\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e:new_moon:\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\nDependencies?\n-------------\n\nB2R2 relies on a tiny set of external .NET libraries, and our design principle\nis to use a minimum number of libraries. Below is a list of libraries that we\nleverage.\n\n- [System.Reflection.Metadata](https://www.nuget.org/packages/System.Reflection.Metadata)\n- [System.IO.Hashing](https://www.nuget.org/packages/System.IO.Hashing)\n- [Microsoft.FSharpLu.Json](https://www.nuget.org/packages/Microsoft.FSharpLu.Json)\n- [FSharp.Compiler.Service](https://www.nuget.org/packages/FSharp.Compiler.Service)\n- [FParsec](https://www.nuget.org/packages/FParsec)\n- [BenchmarkDotNet](https://www.nuget.org/packages/BenchmarkDotNet/)\n\nAPI Documentation\n-----------------\n\nWe currently use [fsdocs](https://github.com/fsprojects/FSharp.Formatting/) to\ngenerate our documentation: https://b2r2.org/B2R2/.\n\nExample\n-------\n\nLet's try to use B2R2 APIs.\n\n1. First we create an empty directory `DIRNAME`:\n\n    ```\n    mkdir DIRNAME\n    cd DIRNAME\n    ```\n\n1. We then create an empty console project with `dotnet` command line:\n\n    ```\n    $ dotnet new console -lang F#\n    ```\n\n1. Add our nuget package *B2R2.FrontEnd* to the project:\n\n    ```\n    $ dotnet add package B2R2.FrontEnd.API\n    ```\n\n1. Modify the `Program.fs` file with your favorite editor as follows:\n\n    ```fsharp\n    open B2R2\n    open B2R2.FrontEnd\n\n    [\u003cEntryPoint\u003e]\n    let main argv =\n      let isa = ISA.OfString \"amd64\"\n      let bytes = [| 0x65uy; 0xffuy; 0x15uy; 0x10uy; 0x00uy; 0x00uy; 0x00uy |]\n      let hdl = BinHandle (bytes, isa)\n      let lifter = hdl.NewLiftingUnit ()\n      let ins = lifter.ParseInstruction 0UL // parse the instruction at offset 0\n      lifter.LiftInstruction ins |\u003e printfn \"%A\"\n      0\n    ```\n\n1. We then just run it by typing: `dotnet run`. You will be able see lifted IR\n   statements from your console. That's it! You just lifted an Intel instruction\n   with only few lines of F# code!\n\nBuild\n-----\n\nBuilding B2R2 is fun and easy. All you need to do is to install .NET 9 SDK or\nabove. Yea, that's it!\n\n- To build B2R2 in release mode, type ```dotnet build -c Release``` in the\n  source root.\n\n- To build B2R2 in debug mode, type ```dotnet build``` in the source root.\n\nFor your information, please visit the official web site of F# to get more tips\nabout installing the development environment for F#: http://fsharp.org/.\n\nCredits\n-------\n\nMembers in [SoftSec Lab](https://softsec.kaist.ac.kr/). @ KAIST developed B2R2\nin collaboration with [Cyber Security Research Center](http://csrc.kaist.ac.kr/)\n(CSRC) at KAIST. See [Authors](AUTHORS.md) for the full list.\n\nCitation\n--------\n\nIf you plan to use B2R2 in your own research. Please consider citing our\n[paper](https://softsec.kaist.ac.kr/~sangkilc/papers/jung-bar19.pdf):\n\n```bibtex\n@INPROCEEDINGS{jung:bar:2019,\n  author = {Minkyu Jung and Soomin Kim and HyungSeok Han and Jaeseung Choi and Sang Kil Cha},\n  title = {{B2R2}: Building an Efficient Front-End for Binary Analysis},\n  booktitle = {Proceedings of the NDSS Workshop on Binary Analysis Research},\n  year = 2019\n}\n```\n\nPublications\n------------\n\nHere are papers using our work. Please create a PR if you want to add yours.\n\n- Towards Sound Reassembly of Modern x86-64 Binaries, ASPLOS 2025 [(PDF)](https://softsec.kaist.ac.kr/~sangkilc/papers/kim-asplos25.pdf)\n- PoE: A Domain-Specific Language for Exploitation, SVCC 2024 [(PDF)](https://softsec.kaist.ac.kr/~sangkilc/papers/kim-svcc24.pdf)\n- FunProbe: Probing Functions from Binary Code through Probabilistic Analysis, FSE 2023 [(PDF)](https://softsec.kaist.ac.kr/~sangkilc/papers/kim-fse23.pdf)\n- How'd Security Benefit Reverse Engineers? The Implication of Intel CET on Function Identification, DSN 2022 [(PDF)](https://softsec.kaist.ac.kr/~sangkilc/papers/kim-dsn2022.pdf)\n- Smartian: Enhancing Smart Contract Fuzzing with Static and Dynamic Data-Flow Analyses, ASE 2021 [(PDF)](https://softsec.kaist.ac.kr/~jschoi/data/ase2021.pdf)\n- NTFuzz: Enabling Type-Aware Kernel Fuzzing on Windows with Static Binary Analysis, Oakland 2021 [(PDF)](https://softsec.kaist.ac.kr/~jschoi/data/oakland2021.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb2r2-org%2Fb2r2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb2r2-org%2Fb2r2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb2r2-org%2Fb2r2/lists"}