⚠️ WARNING
This tool is for educational purposes and authorized security auditing only.
The author is not responsible for any misuse.
Precompiled binary (Linux x86_64) is available in the release:
Готовый бинарник (Linux x86_64) в релизе:
👉 Download / Скачать elfstrip v1.0.0 👈
Go to Assets → click elfstrip → make executable:
Перейдите в Assets → нажмите elfstrip → сделайте исполняемым:
chmod +x elfstrip
./elfstrip <your-elf-file>elfstrip — is an aggressive ELF binary stripper that removes all non‑critical metadata from Linux executables and shared objects. Unlike standard strip or even sstrip, it zeroes out section headers, compacts program headers, sanitizes dynamic tables, and produces a minimal ghost ELF that executes correctly but appears empty to standard analysis tools (readelf, objdump, gdb).
- Preserves only essential segments (
LOAD,DYNAMIC,INTERP,PHDR,GNU_*). - Compacts program headers and updates
PT_PHDR(fixesSIGFPEcrashes). - Zeros section header table and all ELF header fields that are not mandatory for execution.
- Sanitizes
PT_INTERP(truncates trailing garbage) andPT_DYNAMIC(removesDT_DEBUGand zero‑value entries, preservesDT_TEXTREL/DT_BIND_NOW). - Wipes all gaps between preserved regions with zeroes and truncates the file.
The result: an ELF with all necessary program headers intact but no section headers – a “sectionless” binary that runs exactly like the original.
| Feature | Description |
|---|---|
| 🗜️ Program Header Compaction | Removes non‑critical segments, packs surviving headers to the front |
| 🔄 PT_PHDR Synchronization | Automatically updates PT_PHDR segment size after compaction (fixes SIGFPE) |
| 🧹 Dynamic Table Sanitization | Filters PT_DYNAMIC: drops DT_DEBUG, zero‑value entries (preserves DT_TEXTREL, DT_BIND_NOW, DT_NULL) |
| 📉 Section Header Removal | Zeroes e_shoff, e_shnum, e_shentsize, e_shstrndx – makes ELF “sectionless” |
| 🕳️ Gap Wiping | Fills all unmapped areas between critical segments with zeroes |
| 📏 Physical Truncation | Shrinks the file to the last byte of the last preserved segment |
| 🏛️ Architecture‑Agnostic | Full support for x86 (32/64), ARM/AArch64, RISC‑V |
| 🔧 In‑Place Modification | Modifies target file directly (backup recommended) |
| ⚡ No Dependencies | Single C file, compiles with any standard C compiler |
# Download from https://github.com/vk-candpython/elfstrip/releases/tag/v1.0.0
wget https://github.com/vk-candpython/elfstrip/releases/download/v1.0.0/elfstrip
chmod +x elfstripgit clone https://github.com/vk-candpython/elfstrip.git
cd elfstrip
gcc -Os -s elfstrip.c -o elfstrip./elfstrip <elf-file>
⚠️ Caution: Modifies the target file in‑place – make a backup if needed.
Before stripping – a typical dynamically linked executable:
$ readelf -h main | grep "Number of section headers"
Number of section headers: 27
$ readelf -S main | wc -l
30
After running elfstrip main:
$ ./elfstrip main
$ readelf -h main | grep "Number of section headers"
Number of section headers: 0
$ readelf -S main
Section headers: NONE (0 sections)
$ readelf -l main # program headers remain unchanged
(same PHDR, INTERP, LOADx4, DYNAMIC, GNU_STACK, ...)
The binary executes exactly as before, but all section headers are gone.
| Requirement | Minimum | Notes |
|---|---|---|
| OS | Linux | any distribution |
| Architecture | x86, x86_64, ARM, AArch64, RISC‑V | 32/64‑bit |
| Compiler | GCC / Clang | only for source build |
| File Size | ≥ 1024 bytes | enforced by MIN_ELF_SZ |
| Issue | Solution |
|---|---|
file is small for striping ELF |
Input file < 1 KB; refuse to process. |
invalid ELF file |
File does not conform to ELF format (e.g., wrong e_phentsize). |
unsupported ELF type |
Only ET_EXEC and ET_DYN are supported. ET_REL (object files) are not. |
msync / ftruncate errors |
Cannot write changes; check disk space/permissions. |
| Binary crashes after stripping | Original relied on non‑standard segments; modify is_crit_seg() to preserve more types. |
elfstrip — это агрессивный стриппер ELF-бинарников, который удаляет все некритичные метаданные из исполняемых файлов и разделяемых библиотек Linux. В отличие от стандартного strip или даже sstrip, он зануляет заголовки секций, уплотняет заголовки программ, санирует динамические таблицы и создаёт минимальный «призрачный» ELF, который корректно выполняется, но выглядит пустым для стандартных анализаторов (readelf, objdump, gdb).
| Функция | Описание |
|---|---|
| 🗜️ Уплотнение заголовков программ | Удаляет некритичные сегменты, упаковывает оставшиеся в начало |
| 🔄 Синхронизация PT_PHDR | Автоматически обновляет размер PT_PHDR после уплотнения (исправляет SIGFPE) |
| 🧹 Очистка динамической таблицы | Удаляет DT_DEBUG и записи с нулевыми значениями (сохраняет DT_TEXTREL, DT_BIND_NOW, DT_NULL) |
| 📉 Удаление заголовков секций | Обнуляет e_shoff, e_shnum, e_shentsize, e_shstrndx — ELF становится «бессекционным» |
| 🕳️ Затирка промежутков | Заполняет нулями все области между критическими сегментами |
| 📏 Физическое урезание | Уменьшает файл до последнего байта последнего сохранённого сегмента |
| 🏛️ Независимость от архитектуры | Полная поддержка x86 (32/64), ARM/AArch64, RISC‑V |
| 🔧 Изменение на месте | Изменяет файл напрямую (рекомендуется бэкап) |
| ⚡ Нет зависимостей | Один C-файл, компилируется любым компилятором C |
# Скачать с https://github.com/vk-candpython/elfstrip/releases/tag/v1.0.0
wget https://github.com/vk-candpython/elfstrip/releases/download/v1.0.0/elfstrip
chmod +x elfstripgit clone https://github.com/vk-candpython/elfstrip.git
cd elfstrip
gcc -Os -s elfstrip.c -o elfstrip./elfstrip <elf-файл>
⚠️ Внимание: Изменяет файл на месте – сделайте бэкап при необходимости.
До обработки – обычный динамический исполняемый файл:
$ readelf -h main | grep "Number of section headers"
Number of section headers: 27
$ readelf -S main | wc -l
30
После ./elfstrip main:
$ ./elfstrip main
$ readelf -h main | grep "Number of section headers"
Number of section headers: 0
$ readelf -S main
Section headers: NONE (0 sections)
$ readelf -l main # заголовки программ остались неизменными
(те же PHDR, INTERP, LOADx4, DYNAMIC, GNU_STACK, ...)
Бинарник работает как раньше, но заголовки секций исчезли.
| Требование | Минимум | Примечания |
|---|---|---|
| ОС | Linux | любой дистрибутив |
| Архитектура | x86, x86_64, ARM, AArch64, RISC‑V | 32/64‑бит |
| Компилятор | GCC / Clang | только для сборки из исходников |
| Размер файла | ≥ 1024 байт | проверка MIN_ELF_SZ |
| Проблема | Решение |
|---|---|
file is small for striping ELF |
Входной файл < 1 КБ; обработка отклонена. |
invalid ELF file |
Файл не соответствует формату ELF (например, неверный e_phentsize). |
unsupported ELF type |
Поддерживаются только ET_EXEC и ET_DYN. ET_REL (объектные файлы) не поддерживаются. |
Ошибки msync / ftruncate |
Не удалось записать изменения; проверьте место на диске и права доступа. |
| Бинарник падает после обработки | Исходный файл использовал нестандартные сегменты; измените is_crit_seg() для сохранения дополнительных типов. |
Extreme ELF stripping for Linux