Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

POST: purl2sym, extracting symbols from sources for fun and for profit

Đang mở
#8 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Tài liệu
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Lĩnh vực
content, documentation

Hướng nghiên cứu

Repository được mô tả là dựa trên Docusaurus/Markdown, nhưng không có tệp đích hoặc thư mục nội dung nào được nêu tên. Hãy bắt đầu bằng cách xác định cấu trúc bài viết hiện có của trang web và so sánh cấu trúc đó với các tài liệu tham khảo được liên kết là purl2sym và Symbols and Strings in PURLdb. Công việc được xem là hoàn tất khi bản nháp này được xuất bản ở vị trí phù hợp trên trang web, với các liên kết và nhận định kỹ thuật được giữ nguyên.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

0-high-priority blog ready-to-post

Lightweight reverse-engineering of open source binaries with purl2sym

TL;DR

  • Got binary code? Got source code?
  • Need to know what open source packages it came from?
  • Use purl2sym to extract and then index symbols, like function names, and strings.
  • Extract strings from the binary and match them back to actual source packages.

Context

As an open source developer, I further rely on open source every day. But what happens when that code is shipped as a binary, like when embedded in devices (a car, a phone, or a toaster) or in container images where the original corresponding source code is not present?

You get a blob. Maybe a stripped ELF file. How can you figure out what is inside, what is it made off, what is the source, and where is the "open" source?

This is where purl2sym comes in. It is one of the AboutCode https://aboutcode.org projects, funded by NLnet https://nlnet.nl/project/purl2sym and it extracts and indexes symbols from source code so you can match these back to binary symbols of open source packages, keyed by PURL https://github.com/package-url/purl-spec. It can help turn otherwise mostly obscure and opaque symbols and strings found in binaries into traceable references to specific open source code packages and specific versions.

Problems

If you have ever faced some of these use cases, then purl2sym could help:

  • Analyzed a binary firmware blob to find which open source packages it embeds
  • Tried to comply with FOSS license obligations post-compilation, to find what the actual code that is effectively compiled and shipped (as opposed to the 10x more code used in development and testing)
  • Hunted down the source code of a vulnerability found in a binary
  • Built SBOMs, working from compiled codebase

Solution

purl2sym extract symbols from source code and builds indexes of symbols and strings extracted from multiple tech stacks and programing languages, like C, C++, Java, Python JavaScript, packaged in Linux distros like Debian or Alpine, or application packages like PyPI, Maven and more. You can fetch the symbols by PURL (Package-URL) and cross-reference these with binary symbols to get back matches to potential packages and versions indexed in the PrulDB.

How it works

purl2sym is a combo of low level libraries, scripted pipelines and high level APIs. When you call the high level REST API, you request the symbols for a PURL, and the tool:

  • Downloads and extracts the source package
  • Extracts symbols and strings from the code using tools like gettext, treesitter, or pygments.
  • Stores those symbols keyed by PURL (e.g., pkg:deb/debian/[email protected]).
  • Returns a JSON doc with the symbols and metadata for further integration, alongside hashes and fingerprints.

With this, I can analyze unknown binary blobs by extracting their symbols and finding their original sources, using symbol matching. Or determine if the symbols of a code vulnerability may be present or used in a given source or binary. (Assuming we know which code segment is the trigger for a vulnerability, but this another thing, handled in another project)/

It is designed to work with and power binary analysis tools like BANG https://github.com/armijnhemel/binaryanalysis-ng/ that can then detect reused code chunks across binaries.

In practice

Let’s say you are working with the firmware blob of a commercial device. It includes a statically linked C executable, but it is not obvious what libraries are linked in the binary. You could pull a few function names using strings (or commoncode's string functions) , or maybe extract a specific ELF section.

You can feed that into a tool powered by purl2sym. Voila: it will suggests that OpenSSL 1.1.1d from Debian is linked in the exe, and you can further lookup in the PurlDB for complete licensing metadata and in Vulnerable for CVEs. You now have a clear path towards automating a security and license compliance.

Get Started

Ngôn ngữ chính
JavaScript
Star
9
Fork
17
Merge trung bình
7 giờ 55 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của aboutcode-org/www.aboutcode.org

Tất cả issue của aboutcode-org/www.aboutcode.org

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.