Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I saw this problem in an online hacking competition. The question asked us to print the contents of the file "secret"

bruce@ip-10-144-4-86:/home/hacker-weekly$ ll
total 20
drwxr-xr-x   2 hacker-weekly hacker-weekly  4096 Nov 12 19:19 ./
drwxr-xr-x 222 root          root          12288 Dec 27 06:27 ../
-r--r-----   1 root          secret          373 Nov 12 19:19 secret

bruce@ip-10-144-4-86:/home/hacker-weekly$ stat secret
  File: `secret'
  Size: 373             Blocks: 8          IO Block: 4096   regular file
Device: ca01h/51713d    Inode: 141569      Links: 1
Access: (0440/-r--r-----)  Uid: (    0/    root)   Gid: ( 1004/  secret)
Access: 2012-11-24 13:14:40.942961879 +0000
Modify: 2012-11-12 19:19:51.079654457 +0000
Change: 2012-11-12 19:19:51.079654344 +0000
 Birth: -

bruce@ip-10-144-4-86:/home/hacker-weekly$ getent group secret

bruce@ip-10-144-4-86:/home/hacker-weekly$ cat /etc/issue
Ubuntu 12.04.1 LTS \n \l

bruce@ip-10-144-4-86:/home/hacker-weekly$ groups

bruce@ip-10-144-4-86:/home$ netstat -tulen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode
tcp        0      0    *               LISTEN      0          7287
tcp6       0      0 :::22                   :::*                    LISTEN      0          7289
udp        0      0    *                           0          6522

PS - I can gather other information also if you tell me what command to run on shell

share|improve this question

There is no official way to access a file if its permissions do not allow you to do so. Any such possibility would be a (severe) bug in the OS. So there's no magic command which reads such files or, say, a magic switch for some command:

cat --ignore-permissions /home/hacker-weekly/secret

That's why it is called a competition - you need to work around the OS security machinery or find a mis-configuration of the machine which would allow you to access the file.

In this case, I think, the give-away is the guest user which is in the secret group - I think you need somehow to become guest.

If you had physical access to the machine, you could also reboot into a single-user mode or unplug the hard drive and put it into another machine.

share|improve this answer
I have been racking my brains on this problem for days. I can't take it anymore. I don't have physical access to the machine. If I do su -c "cat secret" guest it asks for a password which I don't have. – Bruce Dec 28 '12 at 0:12
@Bruce: That's the whole point of such competitions - you won't find a solution in a manual. It's like a brainteaser :) One (rather naive) option to try is to search for SUID/SGID scripts in the system which might give you access to the file... – Sergey Dec 28 '12 at 0:25
Tried find / -xdev -type f -perm +g=s -print and find / -xdev -type f -perm +u=s -print. Got no files/scripts. – Bruce Dec 28 '12 at 0:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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