Skip to main content
added 37 characters in body
Source Link
julian
  • 7.2k
  • 3
  • 23
  • 56

Code and hardcoded strings are not intermingled in x86 or x86-64 ELF binaries. When the compiler toolchain generates a binary, hardcoded strings are placed in a separate area of the binary from the executable code and are referenced/accessed by their virtual memory address. Here is a diagramdiagram by Ange Albertini of the how different sections are laid out in ELF binaries:

ELF sections Ange Albertini ELF

Code and hardcoded strings are not intermingled in x86 or x86-64 ELF binaries. When the compiler toolchain generates a binary, hardcoded strings are placed in a separate area of the binary from the executable code and are referenced/accessed by their virtual memory address. Here is a diagram of the how different sections are laid out in ELF binaries:

ELF sections

Code and hardcoded strings are not intermingled in x86 or x86-64 ELF binaries. When the compiler toolchain generates a binary, hardcoded strings are placed in a separate area of the binary from the executable code and are referenced/accessed by their virtual memory address. Here is a diagram by Ange Albertini of the how different sections are laid out in ELF binaries: Ange Albertini ELF

added 111 characters in body
Source Link
julian
  • 7.2k
  • 3
  • 23
  • 56

As we can see from these visualizations, these binaries are organized in a similar fashion. Each binary has discrete areas, or sections, which contain different information. We can also see here that there are multiple areas (i.e. sections) containing ASCII string data, not just one.

As we can see from these visualizations, these binaries are organized in a similar fashion. Each binary has discrete areas, or sections, which contain different information.

As we can see from these visualizations, these binaries are organized in a similar fashion. Each binary has discrete areas, or sections, which contain different information. We can also see here that there are multiple areas (i.e. sections) containing ASCII string data, not just one.

added 13 characters in body
Source Link
julian
  • 7.2k
  • 3
  • 23
  • 56

To make this more clear, below are visualizations of the Linux utilities ls, cat, mkdir and mv (accomplished via binvis.io). The solid blue areas consist of ASCII string data (the .rodata section, for example), and the large blocks of blue, white, red and black mixed together are regions that consist of executable code (the .text section, for example).

In ELF binaries, the .text section holds the executable instructions of the program. The bytes the instructions are composed of are being treated as ASCII in this hexdump, so there are meaningless sequences of characters being printed.

To make this more clear, below are visualizations of the Linux utilities ls, cat, mkdir and mv (accomplished via binvis.io). The solid blue areas consist of ASCII string data (the .rodata section, for example), and the large blocks of blue, white, red and black mixed together are regions that consist of executable code (the .text section).

In ELF binaries, the .text section holds the executable instructions of the program. The bytes the instructions are composed of are treated as ASCII, so there are meaningless sequences of characters being printed.

To make this more clear, below are visualizations of the Linux utilities ls, cat, mkdir and mv (accomplished via binvis.io). The solid blue areas consist of ASCII string data (the .rodata section, for example), and the large blocks of blue, white, red and black mixed together are regions that consist of executable code (the .text section, for example).

In ELF binaries, the .text section holds the executable instructions of the program. The bytes the instructions are composed of are being treated as ASCII in this hexdump, so there are meaningless sequences of characters being printed.

added 50 characters in body
Source Link
julian
  • 7.2k
  • 3
  • 23
  • 56
Loading
added 1190 characters in body
Source Link
julian
  • 7.2k
  • 3
  • 23
  • 56
Loading
edited to explicitly address assumptions being made in the answer, again
Source Link
julian
  • 7.2k
  • 3
  • 23
  • 56
Loading
fixed grammar
Source Link
julian
  • 7.2k
  • 3
  • 23
  • 56
Loading
deleted 29 characters in body
Source Link
julian
  • 7.2k
  • 3
  • 23
  • 56
Loading
added 34 characters in body
Source Link
julian
  • 7.2k
  • 3
  • 23
  • 56
Loading
fixed grammar
Source Link
julian
  • 7.2k
  • 3
  • 23
  • 56
Loading
Source Link
julian
  • 7.2k
  • 3
  • 23
  • 56
Loading