blint 3.1.2__tar.gz → 3.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. blint-3.2.2/PKG-INFO +306 -0
  2. blint-3.2.2/README.md +259 -0
  3. blint-3.2.2/blint/cli.py +593 -0
  4. {blint-3.1.2 → blint-3.2.2}/blint/config.py +192 -191
  5. {blint-3.1.2 → blint-3.2.2}/blint/cyclonedx/spec.py +332 -119
  6. blint-3.2.2/blint/data/android-services.json +1008 -0
  7. blint-3.2.2/blint/data/annotations/review_apple_local_privesc_mie.yml +97 -0
  8. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_functions_generic.yml +109 -0
  9. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_imports_pe.yml +52 -0
  10. blint-3.2.2/blint/data/annotations/review_methods_android.yml +284 -0
  11. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_methods_generic.yml +61 -0
  12. blint-3.2.2/blint/data/annotations/review_methods_pe.yml +88 -0
  13. blint-3.2.2/blint/data/annotations/review_rpc_win.yml +79 -0
  14. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_symbols_macho.yml +224 -0
  15. blint-3.2.2/blint/data/trackers.json +6328 -0
  16. blint-3.2.2/blint/db.py +755 -0
  17. {blint-3.1.2 → blint-3.2.2}/blint/lib/analysis.py +427 -39
  18. blint-3.2.2/blint/lib/android.py +873 -0
  19. blint-3.2.2/blint/lib/android_services.py +187 -0
  20. {blint-3.1.2 → blint-3.2.2}/blint/lib/binary.py +915 -138
  21. blint-3.2.2/blint/lib/callgraph/__init__.py +40 -0
  22. blint-3.2.2/blint/lib/callgraph/algorithms.py +114 -0
  23. blint-3.2.2/blint/lib/callgraph/api.py +129 -0
  24. blint-3.2.2/blint/lib/callgraph/canon.py +269 -0
  25. blint-3.2.2/blint/lib/callgraph/command.py +220 -0
  26. blint-3.2.2/blint/lib/callgraph/fingerprint.py +108 -0
  27. blint-3.2.2/blint/lib/callgraph/match.py +510 -0
  28. blint-3.2.2/blint/lib/callgraph/model.py +296 -0
  29. blint-3.2.2/blint/lib/callgraph/rusi.py +113 -0
  30. blint-3.2.2/blint/lib/callgraph_kpi.py +176 -0
  31. {blint-3.1.2 → blint-3.2.2}/blint/lib/checks.py +1 -0
  32. blint-3.2.2/blint/lib/dalvik.py +763 -0
  33. blint-3.2.2/blint/lib/dalvik_callgraph.py +180 -0
  34. blint-3.2.2/blint/lib/dalvik_cfg.py +194 -0
  35. blint-3.2.2/blint/lib/dalvik_dataflow.py +253 -0
  36. blint-3.2.2/blint/lib/dalvik_review.py +218 -0
  37. blint-3.2.2/blint/lib/dalvik_semantics.py +271 -0
  38. blint-3.2.2/blint/lib/disassembler.py +2269 -0
  39. blint-3.2.2/blint/lib/function_reviews.py +560 -0
  40. blint-3.2.2/blint/lib/indicators.py +447 -0
  41. blint-3.2.2/blint/lib/ios.py +169 -0
  42. blint-3.2.2/blint/lib/macho_objc.py +272 -0
  43. blint-3.2.2/blint/lib/review_runner.py +201 -0
  44. blint-3.2.2/blint/lib/review_utils.py +118 -0
  45. blint-3.2.2/blint/lib/runners.py +242 -0
  46. {blint-3.1.2 → blint-3.2.2}/blint/lib/sbom.py +150 -87
  47. {blint-3.1.2 → blint-3.2.2}/blint/lib/utils.py +96 -28
  48. {blint-3.1.2 → blint-3.2.2}/blint/logger.py +1 -3
  49. {blint-3.1.2 → blint-3.2.2}/pyproject.toml +14 -7
  50. blint-3.1.2/PKG-INFO +0 -242
  51. blint-3.1.2/README.md +0 -197
  52. blint-3.1.2/blint/cli.py +0 -290
  53. blint-3.1.2/blint/db.py +0 -150
  54. blint-3.1.2/blint/lib/android.py +0 -427
  55. blint-3.1.2/blint/lib/disassembler.py +0 -1425
  56. blint-3.1.2/blint/lib/runners.py +0 -521
  57. {blint-3.1.2 → blint-3.2.2}/LICENSE +0 -0
  58. {blint-3.1.2 → blint-3.2.2}/blint/__init__.py +0 -0
  59. {blint-3.1.2 → blint-3.2.2}/blint/cyclonedx/README.md +0 -0
  60. {blint-3.1.2 → blint-3.2.2}/blint/cyclonedx/__init__.py +0 -0
  61. {blint-3.1.2 → blint-3.2.2}/blint/cyclonedx/spdx.py +0 -0
  62. {blint-3.1.2 → blint-3.2.2}/blint/data/__init__.py +0 -0
  63. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/__init__.py +0 -0
  64. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_entries_generic.yml +0 -0
  65. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_entries_pe.yml +0 -0
  66. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_exe_go.yml +0 -0
  67. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_methods_mips.yml +0 -0
  68. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_monero_generic.yml +0 -0
  69. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_monero_go.yml +0 -0
  70. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_monero_rust.yml +0 -0
  71. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_rootkits_win.yml +0 -0
  72. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_symbols_antiforensic.yml +0 -0
  73. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_symbols_generic.yml +0 -0
  74. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_symbols_hooka.yml +0 -0
  75. {blint-3.1.2 → blint-3.2.2}/blint/data/annotations/review_symbols_rust.yml +0 -0
  76. {blint-3.1.2 → blint-3.2.2}/blint/data/rules.yml +0 -0
  77. {blint-3.1.2 → blint-3.2.2}/blint/lib/__init__.py +0 -0
blint-3.2.2/PKG-INFO ADDED
@@ -0,0 +1,306 @@
1
+ Metadata-Version: 2.4
2
+ Name: blint
3
+ Version: 3.2.2
4
+ Summary: Linter and SBOM generator for binary files.
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Keywords: linter,binary,security,sast
8
+ Author: Team AppThreat
9
+ Author-email: cloud@appthreat.com
10
+ Requires-Python: >=3.10,<3.15
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: Topic :: Utilities
15
+ Classifier: Topic :: Security
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Operating System :: OS Independent
22
+ Provides-Extra: dev
23
+ Requires-Dist: PyYAML (>=6.0.3)
24
+ Requires-Dist: apkInspector (>=1.3.6)
25
+ Requires-Dist: appdirs (>=1.4.4)
26
+ Requires-Dist: apsw (>=3.53.0.0)
27
+ Requires-Dist: ar (>=1.0.1)
28
+ Requires-Dist: custom-json-diff (>=2.1.6)
29
+ Requires-Dist: defusedxml (>=0.7.1)
30
+ Requires-Dist: flake8 (>=7.3.0) ; extra == "dev"
31
+ Requires-Dist: lief (>=0.17.4)
32
+ Requires-Dist: multi-demangle (>=1.0.3)
33
+ Requires-Dist: oras (>=0.2.41)
34
+ Requires-Dist: orjson (>=3.11.7)
35
+ Requires-Dist: packageurl-python (>=0.17.6)
36
+ Requires-Dist: pydantic[email] (>=2.13.3)
37
+ Requires-Dist: pyinstaller (>=6.20.0) ; extra == "dev"
38
+ Requires-Dist: pylint (>=4.0.5) ; extra == "dev"
39
+ Requires-Dist: pytest (>=9.0.3) ; extra == "dev"
40
+ Requires-Dist: pytest-cov (>=7.1.0) ; extra == "dev"
41
+ Requires-Dist: rich (>=15.0.0)
42
+ Requires-Dist: ruff (>=0.14.0) ; extra == "dev"
43
+ Requires-Dist: wasm-tools (>=1.0.3)
44
+ Project-URL: CI, https://github.com/owasp-dep-scan/blint/actions
45
+ Description-Content-Type: text/markdown
46
+
47
+ # blint
48
+
49
+ <img src="./blint.png" width="200" height="auto" />
50
+
51
+ [![AI-DECLARATION: pair](https://img.shields.io/badge/䷼%20AI--DECLARATION-pair-ffedd5?labelColor=ffedd5)](./AI-DECLARATION.md)
52
+
53
+ `blint` is a Binary Linter that checks the security properties and capabilities of your executables. It is powered by [lief](https://github.com/lief-project/LIEF) and can generate a Software Bill-of-Materials (SBOM) for supported binaries.
54
+
55
+ ## What is blint?
56
+
57
+ blint is a tool for reverse engineers, security analysts, and developers to quickly assess the security posture and composition of a binary file. In an age of statically-linked Golang, Rust, and .NET applications, understanding what's inside a binary is more important than ever. blint automates this initial triage process.
58
+
59
+ **Supported Binary Formats:**
60
+
61
+ - ELF (for GNU and musl libc)
62
+ - PE (Windows executables and DLLs)
63
+ - Mach-O (macOS and iOS, x64 and arm64), including Objective-C and Swift metadata
64
+ - iOS/macOS apps (`.ipa`): the main executable, embedded frameworks, dylibs, and app extensions are all analyzed
65
+ - WASM (WebAssembly modules)
66
+ - Android (APK, APKM, AAB, including DEX files in deep mode)
67
+ - Disassembler: AArch64, x86/x86-64, ARM, Mips, MicroMips (native), and Dalvik (DEX).
68
+
69
+ ## Key Features & Use Cases
70
+
71
+ - **Comprehensive Security Audits:** Automatically checks for common security mitigations like PIE, ASLR, NX, Stack Canaries, and RELRO. Ideal for ensuring your CI/CD pipeline produces hardened binaries.
72
+ - **Software Bill-of-Materials (SBOM) Generation:** Creates CycloneDX SBOMs for binaries built with Go, Rust, .NET, and Android toolchains, providing a clear inventory of third-party components for vulnerability management.
73
+ - **Deep Binary Inspection:** Disassembles, extracts, and analyzes a wealth of information including symbols, functions, dependencies, and build toolchains. This raw data is saved as a detailed JSON file.
74
+ - For a complete guide to all attributes in this file, see the [Technical Metadata Documentation](./docs/METADATA.md).
75
+ - For the custom CycloneDX properties blint adds to the BOM, see the [Custom Properties Documentation](./docs/CUSTOM_PROPERTIES.md).
76
+ - Navigate to the [disassembly guide](./docs/DISASSEMBLE.md).
77
+ - For callgraph internals and analyst-facing interpretation, see the [callgraph guide](./docs/CALLGRAPH.md).
78
+ - **Android Deep Analysis:** In deep mode blint parses the dex classes, detects bundled service and tracker SDKs, and runs a Dalvik behavioural review that decodes the bytecode and flags risky behaviours such as dynamic code loading, reflection, native command execution, weak cryptography, and cleartext networking. The findings are attached to the BOM as custom properties. When disassembly is enabled, blint also writes a Dalvik callgraph sidecar next to the BOM.
79
+ - **iOS/macOS App Analysis:** Point blint at an `.ipa` and it unpacks the app bundle, reads the `Info.plist` context (bundle id, version, minimum OS, FairPlay encryption status), and analyzes the main executable along with every embedded framework, dylib, and app extension. For Mach-O binaries, blint recovers Objective-C metadata (classes, superclasses, methods, protocols, and referenced selectors) and demangles Swift symbols, then surfaces iOS privacy capabilities such as location, camera, microphone, contacts, photos, telephony, motion, biometrics, and device fingerprinting.
80
+ - **Capability Analysis:** Identifies potentially sensitive capabilities by reviewing imported functions and symbols, such as network access, filesystem operations, or cryptographic API usage.
81
+ - Includes cluster-style behavioral reviews for low-level networking patterns (for example eBPF sock_ops usage, TUN interception stacks, raw packet injection primitives, and local DoH redirection indicators).
82
+ - **CI/CD Integration:** Can be added to build pipelines to enforce security policies, such as requiring code signing on all release artifacts.
83
+ - **Fuzzing Target Identification:** Suggests interesting functions to target for fuzzing based on common patterns in function names (e.g., `parse`, `decode`, `copy`).
84
+ - **Extensible with Custom Rules:** Define your own capabilities and checks using simple [YAML rule files](./docs/RULES.md).
85
+
86
+ ## Installation
87
+
88
+ `blint` requires Python >= 3.10.
89
+
90
+ ```shell
91
+ pip install blint
92
+ ```
93
+
94
+ For **disassembly support**, which enables instruction-level analysis of functions, install the `extended` version. This includes the [nyxstone](https://github.com/emproof-com/nyxstone) disassembler.
95
+
96
+ ```shell
97
+ pip install blint[extended]
98
+ ```
99
+
100
+ ### Via Container Image
101
+
102
+ You can also run blint using the official container image available on GitHub Container Registry. This is a convenient way to run blint without installing Python or any dependencies on your host machine.
103
+
104
+ ```
105
+ docker run --rm -it -v $(pwd):/app -w /app ghcr.io/owasp-dep-scan/blint:latest -i /path/to/your/binary
106
+ ```
107
+
108
+ ## Quick Start
109
+
110
+ Analyze a binary and save the reports to the `/tmp/blint` directory:
111
+
112
+ ```shell
113
+ blint -i /bin/netstat -o /tmp/blint
114
+ ```
115
+
116
+ ```shell
117
+ docker run --rm -it -v /tmp:/tmp -v /bin:/app/bin -w /app ghcr.io/owasp-dep-scan/blint:latest -i /app/bin/netstat -o /tmp/blint
118
+ ```
119
+
120
+ Analyze a Go or Rust binary and get suggestions for fuzzing targets:
121
+
122
+ ```shell
123
+ blint -i /path/to/my-binary --suggest-fuzzable
124
+ ```
125
+
126
+ Analyze an iOS/macOS app (`.ipa`). blint unpacks the bundle and writes a separate
127
+ `*-metadata.json` for the main executable and each embedded framework, dylib, and
128
+ app extension. Add `--disassemble` for instruction-level analysis (Objective-C and
129
+ Swift call sites are resolved to imported APIs):
130
+
131
+ ```shell
132
+ blint -i /path/to/app.ipa -o /tmp/blint --disassemble
133
+ ```
134
+
135
+ Generate a CycloneDX SBOM for an Android application:
136
+
137
+ ```shell
138
+ blint sbom -i /path/to/app.apk -o sbom.cdx.json
139
+ ```
140
+
141
+ ```shell
142
+ docker run --rm -it -v /path/to:/app -w /app ghcr.io/owasp-dep-scan/blint:latest sbom -i /app/app.apk -o sbom.cdx.json
143
+ ```
144
+
145
+ For Android deep analysis, enable deep mode so the dex classes are parsed. This is what makes service and tracker detection and the Dalvik behavioural review possible. Add `--disassembly` to also write the Dalvik callgraph sidecar next to the BOM. Both `.apk` single files and `.apkm` split bundles are supported.
146
+
147
+ ```shell
148
+ blint sbom -i /path/to/app.apkm -o sbom.cdx.json --deep --disassembly
149
+ ```
150
+
151
+ ## Understanding the Output
152
+
153
+ blint produces several JSON artifacts in the specified reports directory.
154
+
155
+ | Filename | Purpose | Details |
156
+ | --------------------------- | ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
157
+ | `exename-metadata.json` | **Raw, detailed metadata** extracted from the binary. This is the source for all other reports. | Contains everything: headers, symbols, functions, dependencies, signature info, and more. See the **[Technical Metadata Documentation](./docs/METADATA.md)** for a full breakdown. |
158
+ | `exename-wasm-report.json` | **Raw WASM parser report** for WebAssembly inputs. | Generated for `.wasm` files and contains the full `wasm_tools` parser output, including section/function/instruction detail. |
159
+ | `findings.json` | A summary of the **security properties audit**. Designed for CI/CD integration. | Lists security mitigations like PIE, NX, and Stack Canaries and whether they are present. |
160
+ | `reviews.json` | A summary of the **capability review**. | Lists detected capabilities (e.g., "networking", "file-read", "crypto") based on the symbols and functions found. |
161
+ | `fuzzables.json` | A list of **suggested functions to fuzz**, generated when using the `--suggest-fuzzable` flag. | Identifies functions with names that suggest data parsing or manipulation, which are often good candidates for fuzzing. |
162
+ | `exename-callgraph.mmd` | Mermaid callgraph export generated with `--export-callgraph-mermaid`. | Includes internal and unresolved edges; also embedded into `blint-output.html`. |
163
+ | `exename-callgraph.graphml` | GraphML callgraph export generated with `--export-callgraph-graphml`. | Useful for Gephi, Cytoscape, and NetworkX workflows. |
164
+ | `exename-callgraph.gexf` | GEXF callgraph export generated with `--export-callgraph-gexf`. | Useful for Gephi-centric large graph exploration. |
165
+ | `sbom-*.cdx.json` | The **Software Bill-of-Materials (SBOM)**, generated by the `sbom` sub-command. | A CycloneDX-formatted JSON file detailing the binary's components and dependencies. |
166
+
167
+ ## Advanced Usage: SBOM Generation with blintdb
168
+
169
+ For C and C++ binaries, identifying components from symbols alone can be imprecise. `blint` can use **blintdb v2**, a pre-compiled database built from real project outputs, to improve component identification with:
170
+
171
+ - project-level symbol matching
172
+ - binary-name hints
173
+ - optional disassembly hash matching when deep mode is enabled
174
+
175
+ The workflow is a two-step process:
176
+
177
+ 1. **Download the blintdb database:**
178
+
179
+ ```shell
180
+ blint db --download
181
+ ```
182
+
183
+ This downloads the database to the directory specified by the `BLINTDB_HOME` environment variable.
184
+
185
+ 2. **Generate the SBOM with blintdb enabled:**
186
+
187
+ ```shell
188
+ blint sbom -i /path/to/binary -o sbom.cdx.json --use-blintdb
189
+ ```
190
+
191
+ 3. **For higher-confidence native matching, enable deep mode:**
192
+
193
+ ```shell
194
+ blint sbom -i /path/to/binary -o sbom.cdx.json --use-blintdb --deep
195
+ ```
196
+
197
+ When `--use-blintdb` and `--deep` are set together, `blint` enables disassembly automatically and searches the database with function hashes before falling back to symbol evidence.
198
+
199
+ The generated SBOM keeps the inferred package purl and also records `internal:blintdb_*` evidence properties on matched components so you can review why a component was selected.
200
+
201
+ For repeatable end-to-end validation of local `blint-db` changes, use the integration script in `tests/scripts/validate_blintdb_small_corpus.py`. It builds and validates a versioned 15-case corpus split across Meson, vcpkg, and Homebrew, using the manifest stored in `tests/data/blintdb-small-corpus.json`.
202
+
203
+ The generated `summary.json` includes per-ecosystem provenance copied from the linked `blint-db` run metadata under `ecosystems.<name>.provenance`. That block mirrors `projects.selected_count`, `attempted_count`, `success_count`, `failure_count`, `status_counts`, and `build_failures`. Each `projects.build_failures[]` entry is a flattened per-project failure record with stable keys such as `selector`, `project_name`, `ecosystem`, `build_system`, `status`, `stage`, and `message`, plus optional details like `returncode` or `exception_type` when they are available.
204
+
205
+ ## Environment Variables
206
+
207
+ - `BLINTDB_HOME`, `BLINTDB_IMAGE_URL`, `BLINTDB_REFRESH`: Control blintdb download location, source image, and refresh behavior.
208
+ - `BLINT_MAX_HEX_BYTES`: Maximum number of raw bytes converted to hex when metadata contains undecodable byte sequences. Default is `4096`.
209
+ - `0` disables truncation.
210
+ - When truncation happens, blint appends `...<truncated:N_bytes>` to preserve context without producing huge JSON fields.
211
+
212
+ ## Command-Line Reference
213
+
214
+ <details>
215
+ <summary><strong>Main Command Help</strong></summary>
216
+
217
+ ```shell
218
+ usage: blint [-h] [-i SRC_DIR_IMAGE [SRC_DIR_IMAGE ...]] [-o REPORTS_DIR] [--no-error] [--no-banner] [--no-reviews] [--suggest-fuzzable] [--use-blintdb] {sbom} ...
219
+
220
+ Binary linter and SBOM generator.
221
+
222
+ options:
223
+ -h, --help show this help message and exit
224
+ -i, --src SRC_DIR_IMAGE [SRC_DIR_IMAGE ...]
225
+ Source directories, container images or binary files. Defaults to current directory.
226
+ -o, --reports REPORTS_DIR
227
+ Reports directory. Defaults to reports.
228
+ --no-error Continue on error to prevent build from breaking.
229
+ --no-banner Do not display banner.
230
+ --no-reviews Do not perform method reviews.
231
+ --suggest-fuzzable Suggest functions and symbols for fuzzing based on a dictionary.
232
+ --use-blintdb Use blintdb v2 for symbol resolution. Use environment variables: BLINTDB_IMAGE_URL, BLINTDB_HOME, and BLINTDB_REFRESH for customization.
233
+ --disassemble Disassemble functions and store the instructions in the metadata. Requires blint extended group to be installed.
234
+ --export-callgraph-mermaid
235
+ Export callgraph as Mermaid (.mmd) files and embed diagrams into blint-output.html. Effective when --disassemble is enabled.
236
+ --export-callgraph-graphml
237
+ Export callgraph as GraphML for external graph analysis tools. Effective when --disassemble is enabled.
238
+ --export-callgraph-gexf
239
+ Export callgraph as GEXF for Gephi and other graph tooling. Effective when --disassemble is enabled.
240
+ --callgraph-min-confidence {low,medium,high}
241
+ Filter exported callgraph edges/external links by confidence. Defaults to low (no filtering).
242
+ --custom-rules-dir CUSTOM_RULES_DIR
243
+ Path to a directory containing custom YAML rule files (.yml or .yaml). These will be loaded in addition to default rules.
244
+ -q, --quiet Disable logging and progress bars.
245
+
246
+ sub-commands:
247
+ Additional sub-commands
248
+
249
+ {sbom}
250
+ sbom Command to generate SBOM for supported binaries.
251
+ db Command to manage the pre-compiled database.
252
+ ```
253
+
254
+ </details>
255
+
256
+ <details>
257
+ <summary><strong>SBOM Sub-command Help</strong></summary>
258
+
259
+ ```shell
260
+ usage: blint sbom [-h] [-i SRC_DIR_IMAGE [SRC_DIR_IMAGE ...]] [-o SBOM_OUTPUT] [--deep] [--stdout] [-q]
261
+ [--exports-prefix EXPORTS_PREFIX [EXPORTS_PREFIX ...]] [--bom-src SRC_DIR_BOMS [SRC_DIR_BOMS ...]] [--use-blintdb]
262
+
263
+ options:
264
+ -h, --help show this help message and exit
265
+ -i SRC_DIR_IMAGE [SRC_DIR_IMAGE ...], --src SRC_DIR_IMAGE [SRC_DIR_IMAGE ...]
266
+ Source directories, container images or binary files. Defaults to current directory.
267
+ -o SBOM_OUTPUT, --output-file SBOM_OUTPUT
268
+ SBOM output file. Defaults to sbom-binary-postbuild.cdx.json in current directory.
269
+ --deep Enable deep mode to collect more used symbols and modules aggressively. Slow operation. When combined with --use-blintdb, disassembly is enabled automatically to use function-hash lookup.
270
+ --stdout Print the SBOM to stdout instead of a file.
271
+ -q, --quiet Disable logging and progress bars.
272
+ --exports-prefix EXPORTS_PREFIX [EXPORTS_PREFIX ...]
273
+ prefixes for the exports to be included in the SBOM.
274
+ --bom-src SRC_DIR_BOMS [SRC_DIR_BOMS ...]
275
+ Directories containing pre-build and build BOMs. Use to improve the precision.
276
+ --use-blintdb Use blintdb v2 for symbol and disassembly-hash resolution. Defaults to true if the local database file exists.
277
+ ```
278
+
279
+ </details>
280
+
281
+ <details>
282
+ <summary><strong>DB Sub-command Help</strong></summary>
283
+
284
+ ```shell
285
+ usage: blint db [-h] [--download] [--image-url IMAGE_URL]
286
+
287
+ options:
288
+ -h, --help show this help message and exit
289
+ --download Download the pre-compiled database to the /Volumes/Work/blintdb/ directory. Use the environment variable `BLINTDB_HOME` to override.
290
+ --image-url IMAGE_URL
291
+ blintdb image url. Defaults to ghcr.io/appthreat/blintdb-vcpkg-arm64:v2. The environment variable `BLINTDB_IMAGE_URL` is an alternative way to set this value.
292
+ ```
293
+
294
+ </details>
295
+
296
+ ## References
297
+
298
+ - [lief examples](https://github.com/lief-project/LIEF/tree/master/examples)
299
+ - [checksec.py](https://github.com/slimm609/checksec.py)
300
+
301
+ ## Sponsorship
302
+
303
+ If you love `blint`, please consider [donating to our project](https://owasp.org/donate?reponame=www-project-dep-scan&title=OWASP+dep-scan). In addition, `blint` is made possible by the incredible work of the LIEF project. Please consider sponsoring them as well.
304
+
305
+ - [LIEF Project](https://github.com/sponsors/lief-project/)
306
+
blint-3.2.2/README.md ADDED
@@ -0,0 +1,259 @@
1
+ # blint
2
+
3
+ <img src="./blint.png" width="200" height="auto" />
4
+
5
+ [![AI-DECLARATION: pair](https://img.shields.io/badge/䷼%20AI--DECLARATION-pair-ffedd5?labelColor=ffedd5)](./AI-DECLARATION.md)
6
+
7
+ `blint` is a Binary Linter that checks the security properties and capabilities of your executables. It is powered by [lief](https://github.com/lief-project/LIEF) and can generate a Software Bill-of-Materials (SBOM) for supported binaries.
8
+
9
+ ## What is blint?
10
+
11
+ blint is a tool for reverse engineers, security analysts, and developers to quickly assess the security posture and composition of a binary file. In an age of statically-linked Golang, Rust, and .NET applications, understanding what's inside a binary is more important than ever. blint automates this initial triage process.
12
+
13
+ **Supported Binary Formats:**
14
+
15
+ - ELF (for GNU and musl libc)
16
+ - PE (Windows executables and DLLs)
17
+ - Mach-O (macOS and iOS, x64 and arm64), including Objective-C and Swift metadata
18
+ - iOS/macOS apps (`.ipa`): the main executable, embedded frameworks, dylibs, and app extensions are all analyzed
19
+ - WASM (WebAssembly modules)
20
+ - Android (APK, APKM, AAB, including DEX files in deep mode)
21
+ - Disassembler: AArch64, x86/x86-64, ARM, Mips, MicroMips (native), and Dalvik (DEX).
22
+
23
+ ## Key Features & Use Cases
24
+
25
+ - **Comprehensive Security Audits:** Automatically checks for common security mitigations like PIE, ASLR, NX, Stack Canaries, and RELRO. Ideal for ensuring your CI/CD pipeline produces hardened binaries.
26
+ - **Software Bill-of-Materials (SBOM) Generation:** Creates CycloneDX SBOMs for binaries built with Go, Rust, .NET, and Android toolchains, providing a clear inventory of third-party components for vulnerability management.
27
+ - **Deep Binary Inspection:** Disassembles, extracts, and analyzes a wealth of information including symbols, functions, dependencies, and build toolchains. This raw data is saved as a detailed JSON file.
28
+ - For a complete guide to all attributes in this file, see the [Technical Metadata Documentation](./docs/METADATA.md).
29
+ - For the custom CycloneDX properties blint adds to the BOM, see the [Custom Properties Documentation](./docs/CUSTOM_PROPERTIES.md).
30
+ - Navigate to the [disassembly guide](./docs/DISASSEMBLE.md).
31
+ - For callgraph internals and analyst-facing interpretation, see the [callgraph guide](./docs/CALLGRAPH.md).
32
+ - **Android Deep Analysis:** In deep mode blint parses the dex classes, detects bundled service and tracker SDKs, and runs a Dalvik behavioural review that decodes the bytecode and flags risky behaviours such as dynamic code loading, reflection, native command execution, weak cryptography, and cleartext networking. The findings are attached to the BOM as custom properties. When disassembly is enabled, blint also writes a Dalvik callgraph sidecar next to the BOM.
33
+ - **iOS/macOS App Analysis:** Point blint at an `.ipa` and it unpacks the app bundle, reads the `Info.plist` context (bundle id, version, minimum OS, FairPlay encryption status), and analyzes the main executable along with every embedded framework, dylib, and app extension. For Mach-O binaries, blint recovers Objective-C metadata (classes, superclasses, methods, protocols, and referenced selectors) and demangles Swift symbols, then surfaces iOS privacy capabilities such as location, camera, microphone, contacts, photos, telephony, motion, biometrics, and device fingerprinting.
34
+ - **Capability Analysis:** Identifies potentially sensitive capabilities by reviewing imported functions and symbols, such as network access, filesystem operations, or cryptographic API usage.
35
+ - Includes cluster-style behavioral reviews for low-level networking patterns (for example eBPF sock_ops usage, TUN interception stacks, raw packet injection primitives, and local DoH redirection indicators).
36
+ - **CI/CD Integration:** Can be added to build pipelines to enforce security policies, such as requiring code signing on all release artifacts.
37
+ - **Fuzzing Target Identification:** Suggests interesting functions to target for fuzzing based on common patterns in function names (e.g., `parse`, `decode`, `copy`).
38
+ - **Extensible with Custom Rules:** Define your own capabilities and checks using simple [YAML rule files](./docs/RULES.md).
39
+
40
+ ## Installation
41
+
42
+ `blint` requires Python >= 3.10.
43
+
44
+ ```shell
45
+ pip install blint
46
+ ```
47
+
48
+ For **disassembly support**, which enables instruction-level analysis of functions, install the `extended` version. This includes the [nyxstone](https://github.com/emproof-com/nyxstone) disassembler.
49
+
50
+ ```shell
51
+ pip install blint[extended]
52
+ ```
53
+
54
+ ### Via Container Image
55
+
56
+ You can also run blint using the official container image available on GitHub Container Registry. This is a convenient way to run blint without installing Python or any dependencies on your host machine.
57
+
58
+ ```
59
+ docker run --rm -it -v $(pwd):/app -w /app ghcr.io/owasp-dep-scan/blint:latest -i /path/to/your/binary
60
+ ```
61
+
62
+ ## Quick Start
63
+
64
+ Analyze a binary and save the reports to the `/tmp/blint` directory:
65
+
66
+ ```shell
67
+ blint -i /bin/netstat -o /tmp/blint
68
+ ```
69
+
70
+ ```shell
71
+ docker run --rm -it -v /tmp:/tmp -v /bin:/app/bin -w /app ghcr.io/owasp-dep-scan/blint:latest -i /app/bin/netstat -o /tmp/blint
72
+ ```
73
+
74
+ Analyze a Go or Rust binary and get suggestions for fuzzing targets:
75
+
76
+ ```shell
77
+ blint -i /path/to/my-binary --suggest-fuzzable
78
+ ```
79
+
80
+ Analyze an iOS/macOS app (`.ipa`). blint unpacks the bundle and writes a separate
81
+ `*-metadata.json` for the main executable and each embedded framework, dylib, and
82
+ app extension. Add `--disassemble` for instruction-level analysis (Objective-C and
83
+ Swift call sites are resolved to imported APIs):
84
+
85
+ ```shell
86
+ blint -i /path/to/app.ipa -o /tmp/blint --disassemble
87
+ ```
88
+
89
+ Generate a CycloneDX SBOM for an Android application:
90
+
91
+ ```shell
92
+ blint sbom -i /path/to/app.apk -o sbom.cdx.json
93
+ ```
94
+
95
+ ```shell
96
+ docker run --rm -it -v /path/to:/app -w /app ghcr.io/owasp-dep-scan/blint:latest sbom -i /app/app.apk -o sbom.cdx.json
97
+ ```
98
+
99
+ For Android deep analysis, enable deep mode so the dex classes are parsed. This is what makes service and tracker detection and the Dalvik behavioural review possible. Add `--disassembly` to also write the Dalvik callgraph sidecar next to the BOM. Both `.apk` single files and `.apkm` split bundles are supported.
100
+
101
+ ```shell
102
+ blint sbom -i /path/to/app.apkm -o sbom.cdx.json --deep --disassembly
103
+ ```
104
+
105
+ ## Understanding the Output
106
+
107
+ blint produces several JSON artifacts in the specified reports directory.
108
+
109
+ | Filename | Purpose | Details |
110
+ | --------------------------- | ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
111
+ | `exename-metadata.json` | **Raw, detailed metadata** extracted from the binary. This is the source for all other reports. | Contains everything: headers, symbols, functions, dependencies, signature info, and more. See the **[Technical Metadata Documentation](./docs/METADATA.md)** for a full breakdown. |
112
+ | `exename-wasm-report.json` | **Raw WASM parser report** for WebAssembly inputs. | Generated for `.wasm` files and contains the full `wasm_tools` parser output, including section/function/instruction detail. |
113
+ | `findings.json` | A summary of the **security properties audit**. Designed for CI/CD integration. | Lists security mitigations like PIE, NX, and Stack Canaries and whether they are present. |
114
+ | `reviews.json` | A summary of the **capability review**. | Lists detected capabilities (e.g., "networking", "file-read", "crypto") based on the symbols and functions found. |
115
+ | `fuzzables.json` | A list of **suggested functions to fuzz**, generated when using the `--suggest-fuzzable` flag. | Identifies functions with names that suggest data parsing or manipulation, which are often good candidates for fuzzing. |
116
+ | `exename-callgraph.mmd` | Mermaid callgraph export generated with `--export-callgraph-mermaid`. | Includes internal and unresolved edges; also embedded into `blint-output.html`. |
117
+ | `exename-callgraph.graphml` | GraphML callgraph export generated with `--export-callgraph-graphml`. | Useful for Gephi, Cytoscape, and NetworkX workflows. |
118
+ | `exename-callgraph.gexf` | GEXF callgraph export generated with `--export-callgraph-gexf`. | Useful for Gephi-centric large graph exploration. |
119
+ | `sbom-*.cdx.json` | The **Software Bill-of-Materials (SBOM)**, generated by the `sbom` sub-command. | A CycloneDX-formatted JSON file detailing the binary's components and dependencies. |
120
+
121
+ ## Advanced Usage: SBOM Generation with blintdb
122
+
123
+ For C and C++ binaries, identifying components from symbols alone can be imprecise. `blint` can use **blintdb v2**, a pre-compiled database built from real project outputs, to improve component identification with:
124
+
125
+ - project-level symbol matching
126
+ - binary-name hints
127
+ - optional disassembly hash matching when deep mode is enabled
128
+
129
+ The workflow is a two-step process:
130
+
131
+ 1. **Download the blintdb database:**
132
+
133
+ ```shell
134
+ blint db --download
135
+ ```
136
+
137
+ This downloads the database to the directory specified by the `BLINTDB_HOME` environment variable.
138
+
139
+ 2. **Generate the SBOM with blintdb enabled:**
140
+
141
+ ```shell
142
+ blint sbom -i /path/to/binary -o sbom.cdx.json --use-blintdb
143
+ ```
144
+
145
+ 3. **For higher-confidence native matching, enable deep mode:**
146
+
147
+ ```shell
148
+ blint sbom -i /path/to/binary -o sbom.cdx.json --use-blintdb --deep
149
+ ```
150
+
151
+ When `--use-blintdb` and `--deep` are set together, `blint` enables disassembly automatically and searches the database with function hashes before falling back to symbol evidence.
152
+
153
+ The generated SBOM keeps the inferred package purl and also records `internal:blintdb_*` evidence properties on matched components so you can review why a component was selected.
154
+
155
+ For repeatable end-to-end validation of local `blint-db` changes, use the integration script in `tests/scripts/validate_blintdb_small_corpus.py`. It builds and validates a versioned 15-case corpus split across Meson, vcpkg, and Homebrew, using the manifest stored in `tests/data/blintdb-small-corpus.json`.
156
+
157
+ The generated `summary.json` includes per-ecosystem provenance copied from the linked `blint-db` run metadata under `ecosystems.<name>.provenance`. That block mirrors `projects.selected_count`, `attempted_count`, `success_count`, `failure_count`, `status_counts`, and `build_failures`. Each `projects.build_failures[]` entry is a flattened per-project failure record with stable keys such as `selector`, `project_name`, `ecosystem`, `build_system`, `status`, `stage`, and `message`, plus optional details like `returncode` or `exception_type` when they are available.
158
+
159
+ ## Environment Variables
160
+
161
+ - `BLINTDB_HOME`, `BLINTDB_IMAGE_URL`, `BLINTDB_REFRESH`: Control blintdb download location, source image, and refresh behavior.
162
+ - `BLINT_MAX_HEX_BYTES`: Maximum number of raw bytes converted to hex when metadata contains undecodable byte sequences. Default is `4096`.
163
+ - `0` disables truncation.
164
+ - When truncation happens, blint appends `...<truncated:N_bytes>` to preserve context without producing huge JSON fields.
165
+
166
+ ## Command-Line Reference
167
+
168
+ <details>
169
+ <summary><strong>Main Command Help</strong></summary>
170
+
171
+ ```shell
172
+ usage: blint [-h] [-i SRC_DIR_IMAGE [SRC_DIR_IMAGE ...]] [-o REPORTS_DIR] [--no-error] [--no-banner] [--no-reviews] [--suggest-fuzzable] [--use-blintdb] {sbom} ...
173
+
174
+ Binary linter and SBOM generator.
175
+
176
+ options:
177
+ -h, --help show this help message and exit
178
+ -i, --src SRC_DIR_IMAGE [SRC_DIR_IMAGE ...]
179
+ Source directories, container images or binary files. Defaults to current directory.
180
+ -o, --reports REPORTS_DIR
181
+ Reports directory. Defaults to reports.
182
+ --no-error Continue on error to prevent build from breaking.
183
+ --no-banner Do not display banner.
184
+ --no-reviews Do not perform method reviews.
185
+ --suggest-fuzzable Suggest functions and symbols for fuzzing based on a dictionary.
186
+ --use-blintdb Use blintdb v2 for symbol resolution. Use environment variables: BLINTDB_IMAGE_URL, BLINTDB_HOME, and BLINTDB_REFRESH for customization.
187
+ --disassemble Disassemble functions and store the instructions in the metadata. Requires blint extended group to be installed.
188
+ --export-callgraph-mermaid
189
+ Export callgraph as Mermaid (.mmd) files and embed diagrams into blint-output.html. Effective when --disassemble is enabled.
190
+ --export-callgraph-graphml
191
+ Export callgraph as GraphML for external graph analysis tools. Effective when --disassemble is enabled.
192
+ --export-callgraph-gexf
193
+ Export callgraph as GEXF for Gephi and other graph tooling. Effective when --disassemble is enabled.
194
+ --callgraph-min-confidence {low,medium,high}
195
+ Filter exported callgraph edges/external links by confidence. Defaults to low (no filtering).
196
+ --custom-rules-dir CUSTOM_RULES_DIR
197
+ Path to a directory containing custom YAML rule files (.yml or .yaml). These will be loaded in addition to default rules.
198
+ -q, --quiet Disable logging and progress bars.
199
+
200
+ sub-commands:
201
+ Additional sub-commands
202
+
203
+ {sbom}
204
+ sbom Command to generate SBOM for supported binaries.
205
+ db Command to manage the pre-compiled database.
206
+ ```
207
+
208
+ </details>
209
+
210
+ <details>
211
+ <summary><strong>SBOM Sub-command Help</strong></summary>
212
+
213
+ ```shell
214
+ usage: blint sbom [-h] [-i SRC_DIR_IMAGE [SRC_DIR_IMAGE ...]] [-o SBOM_OUTPUT] [--deep] [--stdout] [-q]
215
+ [--exports-prefix EXPORTS_PREFIX [EXPORTS_PREFIX ...]] [--bom-src SRC_DIR_BOMS [SRC_DIR_BOMS ...]] [--use-blintdb]
216
+
217
+ options:
218
+ -h, --help show this help message and exit
219
+ -i SRC_DIR_IMAGE [SRC_DIR_IMAGE ...], --src SRC_DIR_IMAGE [SRC_DIR_IMAGE ...]
220
+ Source directories, container images or binary files. Defaults to current directory.
221
+ -o SBOM_OUTPUT, --output-file SBOM_OUTPUT
222
+ SBOM output file. Defaults to sbom-binary-postbuild.cdx.json in current directory.
223
+ --deep Enable deep mode to collect more used symbols and modules aggressively. Slow operation. When combined with --use-blintdb, disassembly is enabled automatically to use function-hash lookup.
224
+ --stdout Print the SBOM to stdout instead of a file.
225
+ -q, --quiet Disable logging and progress bars.
226
+ --exports-prefix EXPORTS_PREFIX [EXPORTS_PREFIX ...]
227
+ prefixes for the exports to be included in the SBOM.
228
+ --bom-src SRC_DIR_BOMS [SRC_DIR_BOMS ...]
229
+ Directories containing pre-build and build BOMs. Use to improve the precision.
230
+ --use-blintdb Use blintdb v2 for symbol and disassembly-hash resolution. Defaults to true if the local database file exists.
231
+ ```
232
+
233
+ </details>
234
+
235
+ <details>
236
+ <summary><strong>DB Sub-command Help</strong></summary>
237
+
238
+ ```shell
239
+ usage: blint db [-h] [--download] [--image-url IMAGE_URL]
240
+
241
+ options:
242
+ -h, --help show this help message and exit
243
+ --download Download the pre-compiled database to the /Volumes/Work/blintdb/ directory. Use the environment variable `BLINTDB_HOME` to override.
244
+ --image-url IMAGE_URL
245
+ blintdb image url. Defaults to ghcr.io/appthreat/blintdb-vcpkg-arm64:v2. The environment variable `BLINTDB_IMAGE_URL` is an alternative way to set this value.
246
+ ```
247
+
248
+ </details>
249
+
250
+ ## References
251
+
252
+ - [lief examples](https://github.com/lief-project/LIEF/tree/master/examples)
253
+ - [checksec.py](https://github.com/slimm609/checksec.py)
254
+
255
+ ## Sponsorship
256
+
257
+ If you love `blint`, please consider [donating to our project](https://owasp.org/donate?reponame=www-project-dep-scan&title=OWASP+dep-scan). In addition, `blint` is made possible by the incredible work of the LIEF project. Please consider sponsoring them as well.
258
+
259
+ - [LIEF Project](https://github.com/sponsors/lief-project/)