10 Practical Examples using readelf Command

readelf command is used to analyze binaries based on Linux. This is most common tool used by security professionals to dig into binary files.

How to create ELF files

To create an ELF file, just write a small code of Hello World. I have used nano editor to write a code on test.c

nano test.c
#include <stdio.h>
int main() {
   printf("Hello, World!");
   return 0;
}

Use Ctrl + X to save the file test.c

Further, run the command by using the GCC compiler. You can check the format using Linux utility file.

#compile 
gcc test.c -o test
#run
./test
#check format
file test

10 Practical Examples using readelf Command

(1) To display the ELF file header of binary

readelf -h <binary-file>

(2) To display the program headers of binary

readelf -l <binary-file>

(3) To display the sections header of binary

readelf -S <binary-file>

readelf -a <binary-file>

(5) To display the symbol table of binary

readelf -s <binary-file>

(6) To display the histogram of bucket list lengths

readelf -I <binary-file>

(7) To display the version number of readelf

readelf -v

(8) To display notes of binary file

readelf -n <binary-file>

(9) To display the relocations of binary file

readelf -r <binary-file>

(10) To display the unwind information of binary file

readelf -u <binary-file>

Subscribe us to receive more such articles updates in your email.

If you have any questions, feel free to ask in the comments section below. Nothing gives me greater joy than helping my readers!

Disclaimer: This tutorial is for educational purpose only. Individual is solely responsible for any illegal act.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

10 Blockchain Security Vulnerabilities OWASP API Top 10 - 2023 7 Facts You Should Know About WormGPT OWASP Top 10 for Large Language Models (LLMs) Applications Top 10 Blockchain Security Issues