Impelf
"ImpELF: A Python-based ELF hashing utility that generates unique fingerprints for ELF binaries using their imported functions and libraries, aiding in malware analysis and similarity detection."
Install / Use
/learn @signalblur/ImpelfREADME
ImpELF
Archived - I did not realize an implementation of this had already been created and was more widely used. Please refer to telfhash - https://github.com/trendmicro/telfhash
As someone that primarily does linux detection, I was frustrated that there wasn't an equivalent of an imphash for linux ELF binaries. So, I decided to make one myself. Introducing ImpELF. ImpELF is a Python-based ELF hashing utility that generates unique fingerprints for ELF binaries using their imported functions and libraries, aiding in malware analysis and similarity detection.
Installation
First, ensure that you have Python 3.x installed on your system. You can download the latest version of Python from the official website.
Next, install the pyelftools library using pip:
pip install pyelftools
Usage
Save the ImpELF script from the previous response as a file, e.g., impelf.py.
Run the ImpELF script on an ELF binary:
python impelf.py /path/to/your/elf_file
The script will output the ImpELF hash for the given ELF binary.
Implementation and Example
By analyzing an ELF binaries dynamic symbols (imported functions) and libraries, we can create a hash similar to the PE file's imphash. Suppose we have an ELF binary with the following imported symbols and libraries:
Imported symbols:
printfmallocstrcpystrcmp
Libraries:
libc.so.6libm.so.6
Using impelf.py, the get_imported_symbols_and_libraries function extracts the imported symbols and libraries from the ELF binary. The imported symbols and libraries are then returned as two separate lists.
After obtaining the lists of imported symbols and libraries, the create_hash function is called with these two lists as arguments. In this function, the symbols and libraries are first sorted:
Sorted imported symbols:
mallocprintfstrcmpstrcpy
Sorted libraries:
libc.so.6libm.so.6
Then, the sorted imported symbols list is concatenated with the sorted libraries list to create a single string:
Example Concatenated string: mallocprintfstrcmpstrcpylibc.so.6libm.so.6
Finally, the concatenated string is hashed using the MD5 hashing algorithm (or another algorithm of your choice) to create the final ELF hash:
ELF hash: 4e4d4d4e8f8a96d30b9dab9d6deac8b3
Keep in mind that the specific example provided here might not match the actual output you would get when running the script, as the output will depend on the specific ELF binary being analyzed. The example is meant to illustrate the process of sorting and concatenating the symbols and libraries before hashing.
License
This project is licensed under the Mozilla Public License 2.0 (MPL-2.0). By using or contributing to this project, you agree to the terms of the license.
Contributing
Contributions are welcome! If you have a bug report, feature request, or would like to contribute code, please open an issue or create a pull request on the GitHub repository.
- Fork the repository on GitHub.
- Create a new branch for your changes.
- Commit your changes and push them to your fork.
- Create a pull request with a description of your changes.
We appreciate your help in improving ImpELF!
Related Skills
node-connect
351.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
