I want to reverse engineer a program. I managed to find the entry point but every time I want to launch the application I get the same error `During startup program exited with code 126.

Here is what I did:

└─$ gdb guessy\?token=eyJ1c2VyX2lkIjoxNDM4LCJ0ZWFtX2lkIjpudWxsLCJmaWxlX2lkIjoxNjd9.YIyJZA.QQbX2E3vChspI95coiZvSzAwDOo
GNU gdb (Debian 10.1-1.7)
Copyright (C) 2021 Free Software Foundation, Inc.                                                                                                                                                                                            
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from guessy?token=eyJ1c2VyX2lkIjoxNDM4LCJ0ZWFtX2lkIjpudWxsLCJmaWxlX2lkIjoxNjd9.YIyJZA.QQbX2E3vChspI95coiZvSzAwDOo...
(No debugging symbols found in guessy?token=eyJ1c2VyX2lkIjoxNDM4LCJ0ZWFtX2lkIjpudWxsLCJmaWxlX2lkIjoxNjd9.YIyJZA.QQbX2E3vChspI95coiZvSzAwDOo)
(gdb) break 1
No symbol table is loaded.  Use the "file" command.
(gdb) break 0x0000000000006160
Function "0x0000000000006160" not defined.
Make breakpoint pending on future shared library load? (y or [n]) 
(gdb) run
Starting program: /home/kali/Documents/Guessy/guessy?token=eyJ1c2VyX2lkIjoxNDM4LCJ0ZWFtX2lkIjpudWxsLCJmaWxlX2lkIjoxNjd9.YIyJZA.QQbX2E3vChspI95coiZvSzAwDOo 
zsh:1: permission denied: /home/kali/Documents/Guessy/guessy?token=eyJ1c2VyX2lkIjoxNDM4LCJ0ZWFtX2lkIjpudWxsLCJmaWxlX2lkIjoxNjd9.YIyJZA.QQbX2E3vChspI95coiZvSzAwDOo
During startup program exited with code 126.

I found the entrypoint with this:

└─$ objdump -f /bin/ls                                                                                                                                                                                                                 130 ⨯

/bin/ls:     file format elf64-x86-64
architecture: i386:x86-64, flags 0x00000150:
start address 0x0000000000006160
  • Did you see the error permission denied? Did you make sure permissions are correct? – multithr3at3d May 11 at 3:28

The program exiting with code 126 in GDB occurs when the current user does not have execute permissions for the binary being debugged:

$ ls -l test
-rw-r--r-- 1 user01 user01 110080 May  1 22:18 test

$ gdb -q test
gef➤  run
Starting program: /home/user01/test 
/bin/bash: /home/user01/test: Permission denied
/bin/bash: line 0: exec: /home/user01/test: cannot execute: Permission denied
During startup program exited with code 126.

Please note that when setting a break point to a specific address like 0x0000000000006160, an asterisk must be used:

  1. break * 0x0000000000006160 or break *0x0000000000006160

The following will result in an error:

  1. break 0x0000000000006160

In (2), GDB interprets the memory address as a function name. Since there is no function named 0x0000000000006160, it prints the error message

Function "0x0000000000006160" not defined.

For more information on GDB syntax see the GDB Command Reference:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.