ARM: add support for arm architecture #1796
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The suggested enhancement involves adding support for ARM architecture in the CAPA tool and improving its capabilities on ELF files.
Here are the steps involved:
Changes to
capa/features/common.py
andcapa/main.py
: Simple changes have been made to add ARM architecture to the list of supported architectures in CAPA.Changes to
capa/features/extractors/viv/
: More complex changes have been made to this directory to enable disassembly of ARM binaries.Specifically, a new file,
capa/features/extractors/viv/insn_arm.py
, has been added.This file replicates the logic of
capa/features/extractors/viv/insn.py
, but adapts its functions to ARM mnemonics and patterns specific to ARM binaries.Testing: Each feature has been tested using binaries written in assembler or compiled with GCC (version 9.4.0), and the final result of the modifications has been evaluated over Linux Arm Malware samples, mostly Mirai.
Improving capabilities on ELF files: The modifications also aim to improve CAPA's capabilities on ELF files. Specifically, the following changes have been made:
capa/features/extractors/elf.py
.capa/features/extractors/viv/syscall.py
.Note:
While adding support for ARM architecture in CAPA, it was found that some ARM samples produce a lot of warnings in the provenance of the vivesct disassembler. However, these warnings do not seem to interfere with the final result of CAPA's analysis.
As for x86/x84 binaries, it was observed that the statement of some features is dependent on specific patterns, which may be related to the type and version of the compiler used. This dependency could potentially limit CAPA's abilities when analyzing these binaries.
Checklist
Are you ok to add this features in a future version? We haven't looked yet how to add tests. Do we need to write them?