Edit: Still No answer works, the output is:
401bc0 3d2a323d 333a7b3d 3a3a =*2=3:{=::
I tried =*2=3:{=:: as password but it's wrong (note working with little endian)
I don't agree with the provided answer and most importantly don't get it why what I did is wrong, I am checking an executable file (from C) that's in ELF format.
Now, I know that the following array of chars of size 10 contains a secret password and I want to find it.
Plus, I know it's located at address 0x401bc0
.
char foor [10] = {0x??, 0x??, 0x??, 0x??, 0x??, 0x??, 0x??, 0x??, 0x??, 0x??, };
So, I opened the elf file, counted 0xbc0 bytes (which is equal to 4660) and started writing the first 10 I see (Why I counted only 0xbc0? because according to my second output using readelf command I saw that section Load starts at 0x400000 in memory and its offset is 0x0 in my file) , I got:
char foo[10] = {0xC3, 0x82, 0x66, 0xC6, 0x92, 0xC3, 0xB9, 0x03, 0x0F, 0xE2,};
But it's wrong, why is that?
How do I know, well when I convert this array of chars to a string and type it as an input to my program it says the password is wrong.
My ELF file (sorry if it's too long): https://justpaste.it/51sbe
plus I got this:
readelf -l prog.html
Elf file type is EXEC (Executable file)
Entry point 0x4004fc
There are 9 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
PHDR 0x0000000000000040 0x0000000000400040 0x0000000000400040
0x00000000000001f8 0x00000000000001f8 R E 0x8
INTERP 0x0000000000000238 0x0000000000400238 0x0000000000400238
0x000000000000001c 0x000000000000001c R 0x1
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000
0x0000000000001d14 0x0000000000001d14 R E 0x200000
LOAD 0x0000000000001e10 0x0000000000601e10 0x0000000000601e10
0x000000000000022c 0x0000000000000230 RW 0x200000
DYNAMIC 0x0000000000001e28 0x0000000000601e28 0x0000000000601e28
0x00000000000001d0 0x00000000000001d0 RW 0x8
NOTE 0x0000000000000254 0x0000000000400254 0x0000000000400254
0x0000000000000044 0x0000000000000044 R 0x4
GNU_EH_FRAME 0x0000000000001bcc 0x0000000000401bcc 0x0000000000401bcc
0x000000000000003c 0x000000000000003c R 0x4
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RWE 0x10
GNU_RELRO 0x0000000000001e10 0x0000000000601e10 0x0000000000601e10
0x00000000000001f0 0x00000000000001f0 R 0x1
Section to Segment mapping:
Segment Sections...
00
01 .interp
02 .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame
03 .init_array .fini_array .jcr .dynamic .got .got.plt .data .bss
04 .dynamic
05 .note.ABI-tag .note.gnu.build-id
06 .eh_frame_hdr
07
08 .init_array .fini_array .jcr .dynamic .got
student@ubuntu18:~/Desktop/HW3$