You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
He does have `dev` privileges allowing him to access `/opt/.messenger`. Let's take a look at what `puck` has on the box.
658
+
659
+
```
660
+
$ cd /home/puck
661
+
$ ls -la
662
+
total 12
663
+
drwxrwx--- 2 reynard dev 4096 Jun 17 22:11 .
664
+
drwxr-xr-x 3 root root 4096 May 19 23:35 ..
665
+
-rw-r--r-- 1 reynard reynard 21 Jun 17 22:11 key.txt
666
+
$ cat key.txt
667
+
9H37B81HZYY8912HBU93
668
+
```
669
+
670
+
Are there other keys on the box?
671
+
672
+
```
673
+
$ find / -name key* 2>/dev/null
674
+
/nt/usb/key.txt
675
+
$ cat /mnt/usb/key.txt
676
+
9H37B81HZYY8912HBU93
677
+
```
678
+
679
+
Not sure what these keys are for. Looking at the `netstat` we see another service is active:
680
+
681
+
```
682
+
$ netstat -antop | grep LIST
683
+
(Not all processes could be identified, non-owned process info
684
+
will not be shown, you would have to be root to see it all.)
685
+
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN - off (0.00/0/0)
686
+
tcp 0 0 0.0.0.0:1337 0.0.0.0:* LISTEN - off (0.00/0/0)
687
+
tcp 0 0 127.0.0.1:7075 0.0.0.0:* LISTEN - off (0.00/0/0)
688
+
```
689
+
690
+
Connecting to it
691
+
692
+
```
693
+
$ nc localhost 7075
694
+
Incorrect key
695
+
```
696
+
697
+
Not having any idea what service this is coming from, let's perform a system wide `strings` to try and find the binary responsible for this.
698
+
699
+
```
700
+
$ find / -executable > exes
701
+
$ for f in $(cat exes); do echo $f >> output; strings $f | grep "Incorrect key" >> output; done
702
+
$ grep Incorrect output -B1
703
+
/usr/local/sbin/trixd
704
+
Incorrect key
705
+
```
706
+
707
+
And to confirm
708
+
709
+
```
710
+
$ strings /usr/local/sbin/trixd | grep Incorrect
711
+
Incorrect key
712
+
```
713
+
714
+
Loading `trixd` into IDA we see that the binary is checking to see if `/mnt/usb/key.txt` is a symlink, and if so, exits immediately. From here, it opens both `/mnt/usb/key.txt` and `/home/puck/key.txt` and checks if they are both the same. If they are the same, we are given a `/bin/sh` shell. Otherwise, we see the `Incorrect key` message.
715
+
716
+
The idea to beat this is to connect, delete `/mnt/usb/key.txt`, then symlink `/home/puck/key.txt` to `/mnt/usb/key.txt`. If timed correctly, we will catch the symlink after the check, bypassing it.
717
+
718
+
I couldn't get `binjitsu` on the Brainpan3 box (or didn't try hard enough), so we can use standard library functions to do the connections.
719
+
720
+
Again, in order to make this work via one script, we will write a script to disk and execute it in order to get our shell with `puck`.
0 commit comments