From f526357def5eadd7cee8183003891f520ffb6f91 Mon Sep 17 00:00:00 2001 From: devs6186 <144378426+devs6186@users.noreply.github.com> Date: Fri, 20 Feb 2026 18:58:43 +0530 Subject: [PATCH] main: suggest --os flag when ELF OS detection fails (#2869) * main: suggest --os flag when OS detection fails for ELF files When capa cannot detect the target OS of an ELF file, it exits with an error. Some ELF files lack the standard metadata capa uses for OS detection (GNU ABI tag, OSABI field, library dependencies, etc.) even though they do target a valid OS (e.g. a stripped Linux binary using only raw syscalls). Add a hint to the unsupported-OS error message telling users they can specify the OS explicitly with the --os flag, matching the workaround recommended in the issue. Fixes #2577 --- CHANGELOG.md | 1 + capa/helpers.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64e9fee5..f6addabd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - ### Bug Fixes +- main: suggest --os flag in unsupported OS error message to help users override ELF OS detection @devs6186 #2577 - render: escape sample-controlled strings before passing to Rich to prevent MarkupError @devs6186 #2699 - Fixed insecure deserialization vulnerability in YAML loading @0x1622 (#2770) - loader: gracefully handle ELF files with unsupported architectures kamranulhaq2002@gmail.com #2800 diff --git a/capa/helpers.py b/capa/helpers.py index 3b48df42..27c757dc 100644 --- a/capa/helpers.py +++ b/capa/helpers.py @@ -327,6 +327,9 @@ def log_unsupported_os_error(): logger.error(" ") logger.error(" capa currently only analyzes executables for some operating systems") logger.error(" (including Windows, Linux, and Android).") + logger.error(" ") + logger.error(" If you know the target OS, you can specify it explicitly, for example:") + logger.error(" capa --os linux ") logger.error("-" * 80)