capa

mandiantApache-2.0活跃维护

FLARE 团队开源的恶意软件分析工具,能自动识别可执行文件中的能力特征,帮逆向工程师快速判断样本干了什么。

The FLARE team's open-source tool to identify capabilities in executable files.

v10.0.0发布于 2026-10-16 14:03 UTC6,319star +15 / 7 天750fork同步于 2026-11-10 11:34 UTC

怎么上手

README 里没有找到可直接复制的安装命令

README 里没有找到可直接复制的安装命令,请到 README 或官方文档查看安装方式。

硬件要求

README 没有说明硬件要求。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

这个项目的说明还在生成中,先参考下面「最近发版」和 README。

最近发版

5 个版本v10.0.0
  1. v10.0.0最新正式版2026-10-16 · 2026-10-16 14:03 UTC

    This release fixes a security issue in how capa loads vivisect workspaces, a large batch of bug fixes, a new --reproducible flag for freeze, dependency updates, and 12 new rules. We'd like to thank the following contributors: Ange Albertini (@corkamig), @aryanyk, Luca Schrott (@1337Name), @eversinc33, Matt Williams (@mwilliams31), Rizky Mirzaviandy Priambodo (@Xavrir), Sukesh Kumar (@SkxOverKill), lakshit verma (@vee1e), @w3lld1, and others!

    Security

    Crafted .viv files could execute code when capa analyzed a sample: either the sample itself named *.viv, or a <sample>.viv next to it. capa now always parses samples as PE or ELF and only loads an existing <sample>.viv when CAPA_LOAD_VIV_WORKSPACE=1 is set. Only enable this for .viv files you trust.

    Affected: v9.4.0 and earlier.

    New Features

    • freeze: add --reproducible flag that zeros dynamic header metadata

    Breaking Changes

    • Remove redundant os_ parameter from capa.loader.collect_metadata(). External scripts calling this function must be updated to remove this argument. OS metadata now relies solely on the extractor yielding it via extract_global_features(). @mike-hunhoff #3076
    • Existing <sample>.viv vivisect workspace files are no longer loaded by default because loading them uses pickle deserialization. Set CAPA_LOAD_VIV_WORKSPACE=1 to opt in. @mr-tz #3191

    New Rules (12)

    Bug Fixes

    • fix: loader: inline vivisect workspace loading and gate .viv pickle deserialization behind CAPA_LOAD_VIV_WORKSPACE @mr-tz #3191
    • fix: freeze: omit null description fields from freeze JSON @SkxOverKill #3100
    • fix lots of linter errors identified by pyright @williballenthin #3052
    • fix: render_default always returns empty string @williballenthin #3012
    • fix: elf.py vdso_guess exception handler clobbers symtab_guess @williballenthin #3013
    • fix: _NoAddress.eq unconditionally returns True @williballenthin #3014
    • fix: capabilities/common.py: if va: drops address 0x0 @williballenthin #3015
    • fix: vverbose.py: render_call variable assigned but never used @williballenthin #3016
    • fix: extract_os yields duplicate/contradictory OS values @williballenthin #3017
    • fix: load_one_jsonl_from_path: finally block runs on unrelated exceptions @williballenthin #3018
    • fix: find_dynamic_limitations_from_cli overwrites instead of OR-ing @williballenthin #3019
    • fix: optimizer doesn't recurse into And/Or/Some children @williballenthin #3020
    • fix: address classes eq and lt assert on type @williballenthin #3021
    • fix: DNTokenOffsetAddress.eq lacks type guard @williballenthin #3022
    • fix: elffile.py: get_base_address returns None instead of NO_ADDRESS @williballenthin #3023
    • fix: base_extractor.py: metaclass is Python 2 syntax, ignored in Py3 @williballenthin #3024
    • fix: freeze/init.py: NO_ADDRESS < NO_ADDRESS returns True @williballenthin #3025
    • fix: dotnetfile.py: missing import for capa.features.extractors.common @williballenthin #3026
    • fix: rules/init.py: duplicate bytes_features line @williballenthin #3027
    • fix: EXTENSIONS_DYNAMIC has inconsistent leading dots @williballenthin #30
  2. v9.4.02026-04-01 · 2026-04-01 09:30 UTC
    查看更新说明

    This release includes Ghidra PyGhidra support, performance improvements, dependency updates, and 26 new rules. We'd like to thank the following contributors: @devs6186, Daniel Adeboye (@adeboyedn), Aditya Pandey (@EclipseAditya), aryanyk, Ben Knutson (@blenbot), @cosmoworker, kamran ul haq (@kami922), @Maijin, @res2500, and others!

    New Features

    • ghidra: support PyGhidra @mike-hunhoff #2788
    • vmray: extract number features from whitelisted void_ptr parameters (hKey, hKeyRoot) @adeboyedn #2835

    Breaking Changes

    New Rules (26)

    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
    • rules: handle empty or invalid YAML documents gracefully in Rule.from_yaml and get_rules @devs6186 #2900
    • Fixed insecure deserialization vulnerability in YAML loading @0x1622 (#2770)
    • loader: gracefully handle ELF files with unsupported architectures [email protected] #2800
    • loader: handle SegmentationViolation for malformed ELF files @kami922 #2799
    • lint: disable rule caching during linting @Maijin #2817
    • vmray: skip processes with invalid PID or missing filename @EclipseAditya #2807
    • features: fix Regex.get_value_str() returning escaped pattern instead of raw regex @EclipseAditya #1909
    • render: use default styling for dynamic -vv API/call details so they are easier to see @devs6186 #1865
    • loader: handle struct.error from dnfile and show clear CorruptFile message @devs6186 #2442
    • address: fix TypeError when sorting locations containing mixed address types @devs6186 #2195
    • loader: skip PE files with unrealistically large section virtual sizes to prevent resource exhaustion @devs6186 #1989
    • engine/render: fix unbounded range sentinel precedence so count(...): N or more uses explicit ((1 << 64) - 1) @blenbot #2936
    • cache: support *BSD @williballenthin @res2500 #2949

    capa Explorer Web

    • webui: fix 404 for "View rule in capa-rules" by using encodeURIComponent for rule name in URL @devs6186 #2482
    • webui: show e
  3. v9.3.12025-11-20 · 2025-11-20 17:02 UTC
    查看更新说明

    v9.3.1

    This patch release fixes a missing import for the capa explorer plugin for IDA Pro.

    Bug Fixes

    • add missing ida-netnode dependency to project.toml @mike-hunhoff #2765

    Development

    • ci: bump binja min version @mike-hunhoff #2763

    Raw diffs

  4. v9.3.02025-11-12 · 2025-11-12 16:31 UTC
    查看更新说明

    capa v9.3.0 comes with over 20 new and/or impoved rules. For IDA users the capa explorer plugin is now available via the IDA Pro plugin repository and contains Qt compatibility layer for PyQt5 and PySide6 support. Additionally a Binary Ninja bug has been fixed. Released binaries now include ARM64 binaries (Linux and macOS).

    New Features

    • ci: add support for arm64 binary releases

    Breaking Changes

    New Rules (24)

    Bug Fixes

    • binja: fix a crash during feature extraction when the MLIL is unavailable @xusheng6 #2714

    capa Explorer Web

    capa Explorer IDA Pro plugin

    • add ida-plugin.json for inclusion in the IDA Pro plugin repository @williballenthin
    • ida plugin: add Qt compatibility layer for PyQt5 and PySide6 support @williballenthin #2707
    • delay import to not load Qt* when running under idalib @mr-tz #2752

    Development

    • ci: remove redundant "test_run" action from build workflow @mike-hunhoff #2692
    • dev: add bumpmyversion to bump and sync versions across the project @mr-tz

    Raw diffs

  5. v9.2.12025-06-06 · 2025-06-06 20:55 UTC
    查看更新说明

    This point release fixes bugs including removing an unnecessary PyInstaller warning message and enabling the standalone binary to execute on systems running older versions of glibc.

    Bug Fixes

    • ci: exclude pkg_resources from PyInstaller build @mike-hunhoff #2684
    • ci: downgrade Ubuntu version to accommodate older glibc versions @mike-hunhoff #2684

    Development

    • ci: upgrade Windows version to avoid deprecation @mike-hunhoff #2684
    • ci: check if build runs without warnings or errors @mike-hunhoff #2684

    Raw diffs

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    PyPI - Python Version Last release Number of rules CI status Downloads License


    capa detects capabilities in executable files. You run it against a PE, ELF, .NET module, shellcode file, or a sandbox report and it tells you what it thinks the program can do. For example, it might suggest that the file is a backdoor, is capable of installing services, or relies on HTTP to communicate.

    To interactively inspect capa results in your browser use the capa Explorer Web.

    If you want to inspect or write capa rules, head on over to the capa-rules repository. Otherwise, keep reading.

    Below you find a list of our capa blog posts with more details.

    example capa output

    $ capa.exe suspicious.exe
    
    +--------------------+------------------------------------------------------------------------+
    | ATT&CK Tactic      | ATT&CK Technique                                                       |
    |--------------------+------------------------------------------------------------------------|
    | DEFENSE EVASION    | Obfuscated Files or Information [T1027]                                |
    | DISCOVERY          | Query Registry [T1012]                                                 |
    |                    | System Information Discovery [T1082]                                   |
    | EXECUTION          | Command and Scripting Interpreter::Windows Command Shell [T1059.003]   |
    |                    | Shared Modules [T1129]                                                 |
    | EXFILTRATION       | Exfiltration Over C2 Channel [T1041]                                   |
    | PERSISTENCE        | Create or Modify System Process::Windows Service [T1543.003]           |
    +--------------------+------------------------------------------------------------------------+
    
    +-------------------------------------------+-------------------------------------------------+
    | CAPABILITY                                | NAMESPACE                                       |
    |-------------------------------------------+-------------------------------------------------|
    | read and send data from client to server  | c2/file-transfer                               |
    | execute shell command and capture output  | c2/shell                                       |
    | receive data (2 matches)                  | communication                                   |
    | send data (6 matches)                     | communication                                   |
    | connect to HTTP server (3 matches)        | communication/http/client                       |
    | send HTTP request (3 matches)             | communication/http/client                       |
    | create pipe                               | communication/named-pipe/create                 |
    | get socket status (2 matches)             | communication/socket                            |
    | receive data on socket (2 matches)        | communication/socket/receive                    |
    | send data on socket (3 matches)           | communication/socket/send                       |
    | connect TCP socket                        | communication/socket/tcp                        |
    | encode data using Base64                  | data-manipulation/encoding/base64               |
    | encode data using XOR (6 matches)         | data-manipulation/encoding/xor                  |
    | run as a service                          | executable/pe                                   |
    | get common file path (3 matches)          | host-interaction/file-system                    |
    | read file                                 | host-interaction/file-system/read               |
    | write file (2 matches)                    | host-interaction/file-system/write              |
    | print debug messages (2 matches)          | host-interaction/log/debug/write-event          |
    | resolve DNS                               | host-interaction/network/dns/resolve            |
    | get hostname                              | host-interaction/os/hostname                    |
    | create process                            | host-interaction/process/create                 |
    | create registry key                       | host-interaction/registry/create                |
    | create service                            | host-interaction/service/create                 |
    | create thread                             | host-interaction/thread/create                  |
    | persist via Windows service               | persistence/service                             |
    +-------------------------------------------+-------------------------------------------------+
    

    download and usage

    Download stable releases of the standalone capa binaries here. You can run the standalone binaries without installation. capa is a command line tool that should be run from the terminal.

    To use capa as a library or integrate with another tool, see doc/installation.md for further setup instructions.

    Documentation: Usage and tips · Installation · Limitations · FAQ

    capa Explorer Web

    The capa Explorer Web enables you to interactively explore capa results in your web browser. Besides the online version you can download a standalone HTML file for local offline usage.

    capa Explorer Web screenshot

    More details on the web UI is available in the capa Explorer Web README.

    example

    In the above sample output, we run capa against an unknown binary (suspicious.exe), and the tool reports that the program can send HTTP requests, decode data via XOR and Base64, install services, and spawn new processes. Taken together, this makes us think that suspicious.exe could be a persistent backdoor. Therefore, our next analysis step might be to run suspicious.exe in a sandbox and try to recover the command and control server.

    detailed results

    By passing the -vv flag (for very verbose), capa reports exactly where it found evidence of these capabilities. This is useful for at least two reasons:

    • it helps explain why we should trust the results, and enables us to verify the conclusions, and
    • it shows where within the binary an experienced analyst might study with IDA Pro
    $ capa.exe suspicious.exe -vv
    ...
    execute shell command and capture output
    namespace   c2/shell
    author      [email protected]
    scope       function
    att&ck      Execution::Command and Scripting Interpreter::Windows Command Shell [T1059.003]
    references  https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa
    function @ 0x4011C0
      and:
        match: create a process with modified I/O handles and window @ 0x4011C0
          and:
            number: 257 = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW @ 0x4012B8
            or:
              number: 68 = StartupInfo.cb (size) @ 0x401282
            or: = API functions that accept a pointer to a STARTUPINFO structure
              api: kernel32.CreateProcess @ 0x401343
        match: create pipe @ 0x4011C0
          or:
            api: kernel32.CreatePipe @ 0x40126F, 0x401280
        optional:
          match: create thread @ 0x40136A, 0x4013BA
            or:
              and:
                os: windows
                or:
                  api: kernel32.CreateThread @ 0x4013D7
            or:
              and:
                os: windows
                or:
                  api: kernel32.CreateThread @ 0x401395
        or:
          string: "cmd.exe" @ 0x4012FD
    ...
    

    dynamic capa

    capa also supports dynamic capabilities detection for multiple sandboxes including:

    • CAPE (supported report formats: .json, .json_, .json.gz)
    • DRAKVUF (supported report formats: .log, .log.gz)
    • VMRay (supported report formats: analysis archive .zip)

    To use this feature, submit your file to a supported sandbox and then download and run capa against the generated report file. This feature enables capa to match capabilities against dynamic and static features that the sandbox captured during execution.

    Here's an example of running capa against a packed file, and then running capa against the CAPE report generated for the same packed file:

    $ capa 05be49819139a3fdcdbddbdefd298398779521f3d68daa25275cc77508e42310.exe
    WARNING:capa.capabilities.common:--------------------------------------------------------------------------------
    WARNING:capa.capabilities.common: This sample appears to be packed.
    WARNING:capa.capabilities.common: 
    WARNING:capa.capabilities.common: Packed samples have often been obfuscated to hide their logic.
    WARNING:capa.capabilities.common: capa cannot handle obfuscation well using static analysis. This means the results may be misleading or incomplete.
    WARNING:capa.capabilities.common: If possible, you should try to unpack this input file before analyzing it with capa.
    WARNING:capa.capabilities.common: Alternatively, run the sample in a supported sandbox and invoke capa against the report to obtain dynamic analysis results.
    WARNING:capa.capabilities.common: 
    WARNING:capa.capabilities.common: Identified via rule: (internal) packer file limitation
    WARNING:capa.capabilities.common: 
    WARNING:capa.capabilities.common: Use -v or -vv if you really want to see the capabilities identified by capa.
    WARNING:capa.capabilities.common:--------------------------------------------------------------------------------
    
    $ capa 05be49819139a3fdcdbddbdefd298398779521f3d68daa25275cc77508e42310.json
    
    ┍━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┑
    │ ATT&CK Tactic          │ ATT&CK Technique                                                                   │
    ┝━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┥
    │ CREDENTIAL ACCESS      │ Credentials from Password Stores T1555                                             │
    ├────────────────────────┼────────────────────────────────────────────────────────────────────────────────────┤
    │ DEFENSE EVASION        │ File and Directory Permissions Modification T1222                                  │
    │                        │ Modify Registry T1112                                                              │
    │                        │ Obfuscated Files or Information T1027                                              │
    │                        │ Virtualization/Sandbox Evasion::User Activity Based Checks T1497.002               │
    ├────────────────────────┼────────────────────────────────────────────────────────────────────────────────────┤
    │ DISCOVERY              │ Account Discovery T1087                                                            │
    │                        │ Application Window Discovery T1010                                                 │
    │                        │ File and Directory Discovery T1083                                                 │
    │                        │ Query Registry T1012                                                               │
    │                        │ System Information Discovery T1082                                                 │
    │                        │ System Location Discovery::System Language Discovery T1614.001                     │
    │                        │ System Owner/User Discovery T1033                                                  │
    ├────────────────────────┼────────────────────────────────────────────────────────────────────────────────────┤
    │ EXECUTION              │ System Services::Service Execution T1569.002                                       │
    ├────────────────────────┼────────────────────────────────────────────────────────────────────────────────────┤
    │ PERSISTENCE            │ Boot or Logon Autostart Execution::Registry Run Keys / Startup Folder T1547.001    │
    │                        │ Boot or Logon Autostart Execution::Winlogon Helper DLL T1547.004                   │
    │                        │ Create or Modify System Process::Windows Service T1543.003                         │
    ┕━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┙
    
    ┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┑
    │ Capability                                           │ Namespace                                            │
    ┝━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┥
    │ check for unmoving mouse cursor (3 matches)          │ anti-analysis/anti-vm/vm-detection                   │
    │ gather bitkinex information                          │ collection/file-managers                             │
    │ gather classicftp information                        │ collection/file-managers                             │
    │ gather filezilla information                         │ collection/file-managers                             │
    │ gather total-commander information                   │ collection/file-managers                             │
    │ gather ultrafxp information                          │ collection/file-managers                             │
    │ resolve DNS (23 matches)                             │ communication/dns                                    │
    │ initialize Winsock library (7 matches)               │ communication/socket                                 │
    │ act as TCP client (3 matches)                        │ communication/tcp/client                             │
    │ create new key via CryptAcquireContext               │ data-manipulation/encryption                         │
    │ encrypt or decrypt via WinCrypt                      │ data-manipulation/encryption                         │
    │ hash data via WinCrypt                               │ data-manipulation/hashing                            │
    │ initialize hashing via WinCrypt                      │ data-manipulation/hashing                            │
    │ hash data with MD5                                   │ data-manipulation/hashing/md5                        │
    │ generate random numbers via WinAPI                   │ data-manipulation/prng                               │
    │ extract resource via kernel32 functions (2 matches)  │ executable/resource                                  │
    │ interact with driver via control codes (2 matches)   │ host-interaction/driver                              │
    │ get Program Files directory (18 matches)             │ host-interaction/file-system                         │
    │ get common file path (575 matches)                   │ host-interaction/file-system                         │
    │ create directory (2 matches)                         │ host-interaction/file-system/create                  │
    │ delete file                                          │ host-interaction/file-system/delete                  │
    │ get file attributes (122 matches)                    │ host-interaction/file-system/meta                    │
    │ set file attributes (8 matches)                      │ host-interaction/file-system/meta                    │
    │ move file                                            │ host-interaction/file-system/move                    │
    │ find taskbar (3 matches)                             │ host-interaction/gui/taskbar/find                    │
    │ get keyboard layout (12 matches)                     │ host-interaction/hardware/keyboard                   │
    │ get disk size                                        │ host-interaction/hardware/storage                    │
    │ get hostname (4 matches)                             │ host-interaction/os/hostname                         │
    │ allocate or change RWX memory (3 matches)            │ host-interaction/process/inject                      │
    │ query or enumerate registry key (3 matches)          │ host-interaction/registry                            │
    │ query or enumerate registry value (8 matches)        │ host-interaction/registry                            │
    │ delete registry key                                  │ host-interaction/registry/delete                     │
    │ start service                                        │ host-interaction/service/start                       │
    │ get session user name                                │ host-interaction/session                             │
    │ persist via Run registry key                         │ persistence/registry/run                             │
    │ persist via Winlogon Helper DLL registry key         │ persistence/registry/winlogon-helper                 │
    │ persist via Windows service (2 matches)              │ persistence/service                                  │
    ┕━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┙
    

    capa rules

    capa uses a collection of rules to identify capabilities within a program. These rules are easy to write, even for those new to reverse engineering. By authoring rules, you can extend the capabilities that capa recognizes. In some regards, capa rules are a mixture of the OpenIOC, Yara, and YAML formats.

    Here's an example rule used by capa:

    rule:
      meta:
        name: create TCP socket
        namespace: communication/socket/tcp
        authors:
          - [email protected]
          - [email protected]
          - [email protected]
        scopes:
          static: basic block
          dynamic: call
        mbc:
          - Communication::Socket Communication::Create TCP Socket [C0001.011]
        examples:
          - Practical Malware Analysis Lab 01-01.dll_:0x10001010
      features:
        - or:
          - and:
            - number: 6 = IPPROTO_TCP
            - number: 1 = SOCK_STREAM
            - number: 2 = AF_INET
            - or:
              - api: ws2_32.socket
              - api: ws2_32.WSASocket
              - api: socket
          - property/read: System.Net.Sockets.TcpClient::Client
    

    The github.com/mandiant/capa-rules repository contains hundreds of standard rules that are distributed with capa. Please learn to write rules and contribute new entries as you find interesting techniques in malware.

    IDA Pro plugin: capa explorer

    If you use IDA Pro, then you can use the capa explorer plugin. capa explorer helps you identify interesting areas of a program and build new capa rules using features extracted directly from your IDA Pro database. It also uses your local changes to the .idb to extract better features, such as when you rename a global variable that contains a dynamically resolved API address.

    capa + IDA Pro integration

    Ghidra integration

    capa supports using Ghidra (via PyGhidra) as a feature extraction backend. This allows you to run capa against binaries using Ghidra's analysis engine.

    You can run and view capa results in the Ghidra UI using capa explorer for Ghidra.

    You can also run capa from the command line using the Ghidra backend.

    blog posts

    further information

    capa

    capa rules

    capa testfiles

    The capa-testfiles repository contains the data we use to test capa's code and rules

    mailing list

    Subscribe to the FLARE mailing list for community announcements! Email "subscribe" to [email protected].