Ayedaemon

An Information Security Engineer from India who is interested in DevOps culture and Security that isn’t based on Excel.

Elf Chronicles: PLT/GOT (7/?)

Intro In earlier articles, we talked about various parts of an ELF file and the many steps needed to create an executable ELF file that can run on your computer. (Note: The steps are shown visually below; For the source code, check out the symbol table article in this series.) ┌────────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │ │ │ │ │ │ libarithmatic.c │ │ libarithmatic.h ├───────► │ main.c │ │ │ │ │ │ │ └─────────┬──────────┘ └─────────────────┘ └────────┬────────┘ │ │ │ │ │ /* Compile + assemble */ │ /* Compile + assemble */ │ │ │ │ ▼ ▼ ┌─────────────────────┐ ┌────────────────────┐ │ │ │ │ │ libarithmatic....

April 3, 2024 · 7 min · 1475 words · ayedaemon

Elf Chronicles: Relocations (6/?)

In previous article about Symbol Tables, we talked about the below diagram …. ┌────────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │ │ │ │ │ │ libarithmatic.c │ │ libarithmatic.h ├───────► │ main.c │ │ │ │ │ │ │ └─────────┬──────────┘ └─────────────────┘ └────────┬────────┘ │ │ │ │ │ /* Compile + assemble */ │ /* Compile + assemble */ │ │ │ │ ▼ ▼ ┌─────────────────────┐ ┌────────────────────┐ │ │ │ │ │ libarithmatic.o │ │ main....

December 8, 2023 · 23 min · 4801 words · ayedaemon

Elf Chronicles: Symbol Tables (5/?)

… prologue At this point I hope you have a general idea of how a C program goes through multiple stages/passes and finally an ELF file is generated. Below is a diagram to jog your memory on this ┌──────────────────┐ │ │ │ hello.c │ // C source │ │ └────────┬─────────┘ │ │ │ /* Compile */ │ │ │ ▼ ┌──────────────────┐ │ │ │ hello.s │ // assembler source │ │ └────────┬─────────┘ │ │ │ /* assemble */ │ │ ▼ ┌──────────────────┐ │ │ │ hello....

October 29, 2023 · 25 min · 5129 words · ayedaemon

Elf Chronicles: String Tables (4/?)

In the article about section headers, you got an introduction to string tables. In this article, we will delve deeper into the topic. …prologue We’ll start with the same program we used in the previous article about section headers. /* file: hello_world.c */ #include <stdio.h> // A macro #define HELLO_MSG1 "Hello World1" // A global variable char HELLO_MSG2[] = "Hello World2"; // main function int main() { // local variable for main char HELLO_MSG3[] = "Hello World3"; // Print messages printf("%s\n", HELLO_MSG1); printf("%s\n", HELLO_MSG2); printf("%s\n", HELLO_MSG3); return 0; } Compile this and then analyze the ELF executable file using readelf (Not everytime we’ll go with xxd)....

October 29, 2023 · 17 min · 3423 words · ayedaemon

ELF Chronicles: Program Headers (3/?)

In preceding articles, we’ve delved into the details of ELF file headers and section headers. Section headers provide insight into how data and instructions are organized based on their characteristics and grouped into distinct sections. These sections remain distinct due to variations in their types and permissions (… and few other things). Up to this point, our focus has been on the aspects of the ELF file as it resides on-disk....

October 20, 2023 · 10 min · 2040 words · ayedaemon