I’m running into an issue with the Sudo module of linux priv esc in HTB academy. I compiled the CVE-2021-3156 “Sudo Hax Me a Sandwhich” and successfully got it on the machine via scp. However, when I run it I get an error along the lines of HTB-Student not allowed to run sudoedit as root.
Hello. I am stuck also here. Found that I can use /bin/ncdu as root with “sudo -u#-1 /bin/ncdu” and than I was able to enumerate with dir command the root folder, but how I am supposed to read the flag.txt ? I read the manual for ncdu , and spot some commands for -f or -o but nothing. Any help ?
But as @Anass0X hints and as you will often hear it in the IT industry:
RTFM or Read The F… Manual…
There are more options that you may call with ncdu, but just like vi, it’s not only the flags you add when you start the application from the command line…
So, I spawn a shell, become root, try to read flag.txt but found a content with lists with nested dictionaries, which I guess is not the normal content of the flags. Do I miss something?
Am I missing something? I’m aware of how to use the sudo binary and get a shell, but it’s unclear how to proceed from that. It’s also seems to be a box from a previous exercise, so wondering if this is even the right environment.
Here is what I did to resolve this :
1-sudo -l (to see what I can do with the highest privileges)
2-Try to find the full path of ncdu on the system (you can use the command whereis)
3- sudo -u#-1 /u**/bin/ncdu /home/htb-student/
4-After running the above command, just type the “b” letter on your keybord. Because reading the manual page of ncdu command I found out the “b” will allow us to open a new shell terminal on the system. It was not very intuitive for me. And I spent lot of time on that.
lol4’s answer is 100% the best solution for the lab. but you can also compile cve-2021-3156 on a different machine with make / gcc. i use docker for this with an image matching the target lab system (i highly suggest people do the same thing and set up docker when they need to compile other exploits for other labs). then just transfer it to the system and itll work with the right option