Sample Header Ad - 728x90

Permission denied when opening a file in gdb

1 vote
1 answer
986 views
I'm implementing some CTF challenges. The flags are in some text files, that get read from the programs. To protect the flags I have changed the owner of the files, but have set the
to the executables to be able to read the files. It works when I run my programs outside gdb, and the flags are read, but inside gdb I get
denied
. I'm running the exercises inside a Linux virutal machine in VirtualBox. I have created a normal user that is not in the sudoers file, and the flags files belong to root.
-rwsr-xr-x 1 root user 15260 Mar 13 13:22  exercise6
-rw-r--r-- 1 user user  3270 Mar 13 06:10 'Exercise 6.c'
-rwsr-xr-x 1 root user 15700 Mar 14 03:28  exercise7
-rw-r--r-- 1 user user  4372 Mar 13 06:10 'Exercise 7.c'
-rwS------ 1 root root 28 Mar 13 06:10 admin_flag.txt
-rwS------ 1 root root 20 Mar 13 06:24 exercise1.txt
-rwS------ 1 root root 27 Mar 13 06:24 exercise2.txt
-rws------ 1 root user 18 Mar 13 10:34 exercise3.txt
-rwS------ 1 root root 22 Mar 13 06:24 exercise4.txt
-rwS------ 1 root root 19 Mar 13 06:10 user_flag.txt
Asked by r3k0j (15 rep)
Mar 14, 2024, 08:45 AM
Last activity: Mar 14, 2024, 10:39 AM