TryHackMe! Abusing SETUID Binaries - Vulnversity

Поделиться
HTML-код
  • Опубликовано: 4 янв 2025

Комментарии • 247

  • @liuculiu8366
    @liuculiu8366 4 года назад +57

    18:00 Using python instead of the recommended tool reminds me those teachers really explains the answer to you rather than tell you that is the answer.

  • @AliTaqi
    @AliTaqi 4 года назад +80

    I had been struggling to escalate my privileges and you taught me how to do that in such an easy manner. You're amazing. Thank You!

    • @_JohnHammond
      @_JohnHammond  4 года назад +15

      There are a lot of other techniques, but I like this quick win if you have some vector to run a command as root. Thanks so much for watching!

    • @AliTaqi
      @AliTaqi 4 года назад +4

      @@_JohnHammond Yes. But is there any specific room in THM or any particular book/topic(s) that you'd recommend I study in order to learn more about linux privesc? I've already done commonprivesc on THM.

    • @vijaykishorea3987
      @vijaykishorea3987 4 года назад

      @@AliTaqi Did u get any input? , do share if u get any :)

    • @AliTaqi
      @AliTaqi 4 года назад

      @@vijaykishorea3987 would've been amazing, but sadly, no.

    • @vijaykishorea3987
      @vijaykishorea3987 4 года назад +1

      @@AliTaqi I think watching cybermentor's linux privesc course , can help us !!

  • @elstories0
    @elstories0 4 года назад +4

    Just finished Vulnversity. Your python script blew my mind! Got me wanting to ramp up my python skills. Thanks man!

  • @muaazahmad2601
    @muaazahmad2601 4 года назад +6

    Just did this box today, it was interesting to see the other ways we can use to address the challenges. Great Video!

    • @_JohnHammond
      @_JohnHammond  4 года назад +1

      Happy to hear that! Thanks for watching!

  • @HEADSPACEnTIMING
    @HEADSPACEnTIMING 4 года назад +3

    I just wanna say, your the only channel I have with notifications turned on. I'm part of a security group but upper management. Basically I get the reports. Iv grown a large interest in how my subordinates conduct their pen testing. Watching you has 1. Impressed me and 2. taught me how my subordinates conduct their pen testing. Kudos with the python script.

  • @sasakanjuh7660
    @sasakanjuh7660 4 года назад +11

    I got stuck on the last step, ran out of the ideas, find similar approach to what you used but I didn't know the trick with stty so input gave me a lot of pain, so I eventually gave up :/
    Now I can finally complete it! :D Great video, as always! :)

    • @_JohnHammond
      @_JohnHammond  4 года назад +2

      Happy to hear that! Thanks so much! And thanks for watching!

  • @enpassant7358
    @enpassant7358 4 года назад +1

    A half hour video and I will be spending hours taking notes. I really enjoy learning from you. Thanks.

  • @alexanderb6353
    @alexanderb6353 4 года назад +7

    John, thank you for such a comprehensive explanation and a fascinating adventure! It's a pleasure to watch your videos, I am really waiting for more your episodes of try hack me!

    • @_JohnHammond
      @_JohnHammond  4 года назад +1

      Appreciate all the kind words, thank you so much!

  • @martijnkooij-nl
    @martijnkooij-nl 4 года назад

    Thanks John! Been watching your videos for a month or so now and with a little help in that last bit (stabilizing the shell and actually running the service using systemctl) I just finished my first TryHackMe room. Sweet Victory!

  • @kenthn5396
    @kenthn5396 4 года назад +3

    I actually enjoyed these videos even though I'm just a newbie in this field. I look forward to seeing more of these!

    • @bitcode_
      @bitcode_ 4 года назад

      get on TryHackMe, there are a lot of free rooms :)

  • @bv.hd883
    @bv.hd883 4 года назад +8

    19:10 man did that shit escaladed quickly lolll good stuff!

  • @alexcondos9897
    @alexcondos9897 4 года назад +2

    It really helps when you have a solid understanding of networking, programming & basic linux fundamentals. I'm pretty sure a couple years ago i would of shat bricks and thought you were gandalf, even though you are basically gandalf, thank you

  • @markfuentes3666
    @markfuentes3666 2 года назад

    Loved the alternative ways you showed us. Thanks as always

  • @hadesregret7582
    @hadesregret7582 4 года назад +6

    Definitely liked watching you do some "dirty coding" in python. And the "bash -p" trick was super clever, I never would have thought of that.

    • @_JohnHammond
      @_JohnHammond  4 года назад +1

      Happy to hear that, thanks so much! And thanks for watching!

    • @alexcolley205
      @alexcolley205 Год назад

      What does bash -p do?

  • @sirw369
    @sirw369 4 года назад +1

    Bro, thank you very much for this detailed walk through. I just finished a homework with a privilege escalation exercise. This solidified everything I did and more. Keep the great content coming!

  • @TheNotoriousFonzy
    @TheNotoriousFonzy 4 года назад

    THANK YOU I WAS STUCK AND THIS HELPED ME SO MUCH!!!
    Your explanations and everything were clear, concise, and super helpful. A+
    Thank you!!!

  • @Ayahalom123
    @Ayahalom123 4 года назад

    dude you are so humble, I just love your videos and personallity!

    • @_JohnHammond
      @_JohnHammond  4 года назад

      Appreciate that, thank you so much! And thanks for watching!

  • @reda4632
    @reda4632 4 года назад +3

    Just did the box yesterday , glad to see other way to get the allowed extension

    • @_JohnHammond
      @_JohnHammond  4 года назад +1

      Just a quick little Python script -- saves us from dealing with BurpSuite a bit ahaha. Thanks so much for watching!

  • @SmashPhysical
    @SmashPhysical 3 года назад

    Thanks for this, I had waited to finish the room before I watched this, and find your approach very helpful and instructive, especially replacing burp with a python script!

  • @crazy338866
    @crazy338866 3 года назад

    Thank you so much for the walkthrough. I was struggling so much with the systemctl step. I didn't realize I needed to stabilize the shell to make the GTFO script to work.

  • @briantech85
    @briantech85 4 года назад +3

    John, you are doing amazing job by creating these handholding sessions for Cyber Security professionals !! Many thanks to you. Keep up the great work!!

  • @karangadhave9002
    @karangadhave9002 3 года назад +1

    Hey, man! Thanks for explaining that python script, I would rather use python as well as it also helps to keep touch with the language or else we tend to forget things. These niche things like slapping the python script and explaining it makes me wanna watch these videos... Keep it up.. learning a lot

  • @freeman1884
    @freeman1884 4 года назад

    It feels great to find that I can understand more of what you are doing lately!

    • @_JohnHammond
      @_JohnHammond  4 года назад

      Ahaha excellent! Thanks so much for watching!

  • @psp.youtube
    @psp.youtube 4 года назад +13

    This is the best YT channel, hands down.

    • @_JohnHammond
      @_JohnHammond  4 года назад +2

      Well I am very flattered, thank you so much! And thanks for watching!

  • @leesugden9555
    @leesugden9555 4 года назад

    Really hand trick i didn't know about stabilising the shell using Python will be sure to use that a lot more often. Completed the room before watching your video as i like to do them without help. Awesome content regardless, I learn a lot from the way you think thanks for sharing :)

  • @Jan_Seidel
    @Jan_Seidel 3 года назад +1

    I love it when you take some detours and present showcases in python :)

  • @franklinodom4259
    @franklinodom4259 3 года назад

    I was struggling with burp, got to learn python and it was so much easier. Of course with your code :P baby steps...baby steps.... thanks man im hooked on your vids.

  • @Vannelle1337
    @Vannelle1337 4 года назад

    Watching your video and actually understanding keeps me smiling. Thanks for the great explanation!

  • @jasonrobinson6620
    @jasonrobinson6620 3 года назад

    So I have absolutely no idea what you’re doing, but it’s presented in such a way that I feel like I do. Either way, thoroughly enjoyable!

  • @enpassant7358
    @enpassant7358 4 года назад

    Watching you code the Python script was super helpful. Thank you!

  • @neilthomas5026
    @neilthomas5026 4 года назад

    Thanks for your videos man !! They are actually educational and like it makes sense so like thanks man ♥️♥️

  • @LegacyInBlood
    @LegacyInBlood 4 года назад

    Love it! Please do more of these

  • @sayondutta3530
    @sayondutta3530 4 года назад +1

    After watching this video , I am a great fan of you and want to become like you .

  • @ricardobrito6868
    @ricardobrito6868 3 года назад

    So much knowledge in this video... Learnt a lot!

  • @wackyskullgaming6711
    @wackyskullgaming6711 4 года назад

    nice explanation, got here bcuz been stuck on that privesc part for several hours, got to learn something new, thanks

  • @ImpulseMarkets
    @ImpulseMarkets 4 года назад +1

    I loved the shoutout to Ippsec lol. Great channel man!

    • @_JohnHammond
      @_JohnHammond  4 года назад

      Thanks so much! And thanks for watching!

  • @ripmeep
    @ripmeep 4 года назад

    Did this box like an hour before watching this! Awesome video

  • @r82gf61ndp
    @r82gf61ndp 4 года назад

    Perfect Technique John, thanks for your sharing.
    Love your clear explanation
    I am new in OSCP. Those skill helps me a lot.

  • @aimsx
    @aimsx 4 года назад

    Loved the Python script instead of BurpSuite - thanks for showing us that little trick!

  • @graiglarsen3196
    @graiglarsen3196 4 года назад

    Thanks John, I really liked that method you showed to get a fully functioning reverse shell. I look forward to trying it out.

  • @nyleen
    @nyleen 4 года назад +63

    Doing the youtube algorithm thing. Tho I actually came for the video.

    • @_JohnHammond
      @_JohnHammond  4 года назад +6

      Thank you so much! And thanks for watching!

  • @mdgaziur001
    @mdgaziur001 4 года назад

    Tried at yesterday for the first time. Followed the same process untill I found systemctl. First tried to do prevesc using setuid but couldn't bcz I'm a massive noob. But then I exploited the vulnerability where systemctl can run process as any user to run bash as root and pipe it to my tun0. Then used netcat to reverse shell. But now I know where I did mistake while trying setuid stuff. THANK YOU.

  • @abbasleaders5214
    @abbasleaders5214 3 года назад

    wow, that was a beautiful walk through and a top $ explanation as I was having an issue understanding the last part about systmctl privesc part but you made it so much easy and the python script is top pro man, as burp didn't work as it showed all .php files as status 200 including the .phtml., where your script nailed it 100%.

  • @th3mant0th3g0d
    @th3mant0th3g0d 4 года назад +3

    Hey John! Thanks for the video. At around 19:29, you said "Ctrl Z to foreground that" but it looked more like you were sending the NC php shell to the background instead, especially since you sent it back to foreground after you did "stty raw -echo". Did you mean background and you said foreground by accident?

    • @fusca14tube
      @fusca14tube 4 года назад

      After CTRL-Z and "stty raw -echo" command, what keys brings the process in backgroud active? CTRL-C? Tks.

    • @fusca14tube
      @fusca14tube 4 года назад +1

      Ummm... I think this could help: blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/

    • @myinamei8884
      @myinamei8884 3 года назад

      He put the process in the background with CTRL+Z then 'stty raw -echo',
      then to pull the process back up he used 'fg (process id)'
      to see your process id for the command you put in the background
      type 'bg' that will give you a job list, then use 'fg (enter job list number)'
      to pull the process back up to the front. That is what I did, probably a better way but yeah.

  • @synack2165
    @synack2165 3 года назад +1

    Great videos as always. Only thing I could not get to work was the very last part. Copy & Pasting the code for systemctl. I did everything 3 times exactly as you did and every time I could not get it to get me root for whatever reason. I spent a couple hours banging my head and still couldn't get it to work. Lost for answers. Any ideas? I made sure that I had change to /home/bill dir before I copy&pasted. No idea. Thanks for making the videos!!

    • @jasonfmj5621
      @jasonfmj5621 3 года назад

      same issue here, were you able to resolve it?

  • @davidleitman
    @davidleitman 3 года назад

    many thanks to you John for the embedded python lesson

  • @thewolf-ps1qz
    @thewolf-ps1qz 4 года назад +1

    this is amazing to watch, even i don't understand any of this (actually a bit), but its interesting to watch, seriously i never skip the vid xD

  • @djzio
    @djzio 2 года назад

    John, the last 3 or 4 minutes of that video, I could swear you melted a few keys!

  • @snoozybara
    @snoozybara 2 года назад

    Awesome video John! There was one thing I didn't quite understand, what did changing the ExecStart line do at the end? How come keeping the line the way it was wouldn't work?

  • @karthibalaji3817
    @karthibalaji3817 4 года назад

    Congrats to hit 100k in very advance !.

  • @Klausi-uq4xq
    @Klausi-uq4xq 4 года назад

    Thank you for the bin/bash hint!!!

  • @jonahhex1295
    @jonahhex1295 4 года назад

    AWESOME, i loved the python script, very instructive as always , thanks pal !!!

    • @_JohnHammond
      @_JohnHammond  4 года назад +1

      Happy to hear that! Thanks so much for watching!

  • @scottym50
    @scottym50 3 года назад

    Great video, thank you.
    I learned a lot from you.

  • @Ms.Robot.
    @Ms.Robot. 4 года назад

    💗I like your hairstyle too 💗

  • @forhadhossain8913
    @forhadhossain8913 4 года назад

    You are amazing bro!

  • @enpassant7358
    @enpassant7358 4 года назад

    I've been using Linux in some capacity since 1998 and this is the first I've truly understood SUID.

  • @ocortesl
    @ocortesl 3 года назад

    Thanks for the video!

  • @TheDarkopsis
    @TheDarkopsis 4 года назад +4

    Hmm thank god the youtube algorirthm showed your channel, I'm a web dev and i wasn't that interested in cyber security but you got me hooked !
    Please continue on the TryHackMe site as it is very well made and really accessible, even to n00bs like me !

  • @IvarsRuza
    @IvarsRuza 4 года назад +10

    I would use command: lsof -nP | grep -i listen -> to check which user is running on port 3333

    • @_JohnHammond
      @_JohnHammond  4 года назад +1

      Ooooh, good call! Thanks for sharing -- and thanks for watching!

    • @HappyGick
      @HappyGick 4 года назад +2

      I decided to just check the /home/ directory. It shows all users, and pretty much anyone has access to that directory

    • @m8_981
      @m8_981 4 года назад

      @Peter Lustig why?

    • @ghosthookcc2050
      @ghosthookcc2050 4 года назад

      @Peter Lustig how is he a script kiddy? This is far from saying "i can hack your bank account" while sitting in cmd. He thinks in a logical way and even creates his own little python scripts to solve problems, not a script kiddy if you ask me.

  • @sunbin616
    @sunbin616 4 года назад

    Hi John - with regard to the part in 19:08/29:34 . How do know which url I should point to in order to trigger the phtml reverse shell.
    Im assuming if we do not know of the instruction - " :3333/internal/uploads/php-reverse-shell.phtml "

  • @aldiyark1593
    @aldiyark1593 4 года назад +1

    pressed Like button four times, this is how much i liked your video)

  • @henrythierry179
    @henrythierry179 4 года назад

    Your hair cut's great

  • @garrettblackard2288
    @garrettblackard2288 4 года назад +1

    Really enjoyed that python scripting I would love to see more challenges solved that way. Been wanting more coding projects and tasks, thanks m8!

    • @_JohnHammond
      @_JohnHammond  4 года назад

      Very happy to hear that! Thanks for watching!

    • @garrettblackard2288
      @garrettblackard2288 4 года назад

      @@_JohnHammond having an issue with the SUID priv esc it doesnt do anything just goes black but idk going to keep cracking away at it i guess

    • @garrettblackard2288
      @garrettblackard2288 4 года назад

      @@_JohnHammond haha ignore me i had to actually start the service created in tmp folder for some strange reason just got it hopefully as time goes on tryhackme will be less buggy i submitted a correct flag yesterday 5 times and did not get the correct flag indicator until number 5 after refreshing LULz

  • @faanross
    @faanross 2 года назад

    Hey John, thanks so much for this walk-through - awesome as always. I'm just wondering what was the though-process underpinning editing the standard script from GTFObins? I was able to do the whole machine blind until this part, and got stuck there for a good hour or so. very grateful for your insight but I feel like I cheated a bit by just copying your actions w/o understanding really what went into those edits. Thanks!

  • @stefandemerov8423
    @stefandemerov8423 4 года назад

    John, please explain what you did at 19:17, I was able to replicate it, but I don't get it.

  • @b4ldor243
    @b4ldor243 3 года назад

    Gracias bro!, aprendí mucho

  • @Creative.Ferments
    @Creative.Ferments 4 года назад

    Thank you for the content! I just got into cybersecurity. I can't wait to see more.
    -Cheers

  • @KaLata123456
    @KaLata123456 4 года назад

    Gotta love that python demo ...

  • @DavidWarrington
    @DavidWarrington 4 года назад

    I came for John's haircut... And was not disappointed.

    • @_JohnHammond
      @_JohnHammond  4 года назад

      Ha! Thanks! And thanks for watching!

  • @lucaszecat
    @lucaszecat 4 года назад

    Why did he -echo his own shell ?

  • @daanbreur
    @daanbreur 4 года назад

    I finnally learned how to do priv escalation, Im never able to pull it off but now you learned it me

    • @_JohnHammond
      @_JohnHammond  4 года назад

      That is good to hear! Thanks so much!

    • @daanbreur
      @daanbreur 4 года назад

      @@_JohnHammond your welcome

  • @gibraanjafar1669
    @gibraanjafar1669 4 года назад

    Didn't get what you said at 19:38 "Get around that by typing FG(something)" If anyone knows what that was, please let me know here.

    • @calvinalexander1540
      @calvinalexander1540 4 года назад +1

      He put the process in the background with CTRL+Z then 'stty raw -echo', then to pull the process back up he used 'fg (process id)' to see your process id for the command you put in the background type 'bg' that will give you a job list, then use 'fg (enter job list number)' to pull the process back up to the front. That is what I did, probably a better way but yeah.

  • @emilioastier
    @emilioastier 4 года назад

    thank you for the video, really interesting and valuable

  • @shreyastrcr7
    @shreyastrcr7 4 года назад

    @JohnHammond
    I ve been following you sir for a very long time.. thank you for all the amazing help ur content has done not only to me but to so many..!!!
    you are just amazing at what you do.. and i wish this channel reaches over a million soon.so more people can benefit from your knowledge...!!!
    and also can you tell me how can i learn python specifically for cybersec.. i have good basics of python..
    but cant script or understand exploits..can u help me where i can learn from.. thanks a lot..!!!!!!!

  • @johnwick1708
    @johnwick1708 2 года назад

    Hello John, it's been a while since that video but why does /bin/systemctl seems a little bit odd as you said?

  • @gaminggolfer1199
    @gaminggolfer1199 4 года назад

    So I have a question / comment. One thing you didn't show since you didn't use burpsuite is how you would find the /internal/uploads folder. It's nice that the THM site provided that for you in it's hints section, but if this were a blank box without that hint, using your python script how would you have been able to tell where the .phtml file uploaded to to be able to run it? What tool, other than burp, would you have used to find where your reverse shell landed?

  • @rake9462
    @rake9462 4 года назад +1

    awesome video 👍

    • @_JohnHammond
      @_JohnHammond  4 года назад

      Thank you! And thanks for watching!

  • @tomjackson9420
    @tomjackson9420 4 года назад

    Any resource out there that would explain 26:28 ( "chmod +s /bin/bash") more? This is an awesome work around that is a time saver!

    • @tomjackson9420
      @tomjackson9420 4 года назад

      Thanks @Señor ! But how do you even learn that this is even an option you can take? He completely re-did the script

    • @tomjackson9420
      @tomjackson9420 4 года назад

      Thanks @Señor !

  • @wardellcastles
    @wardellcastles 3 года назад

    After you entered "stty raw -echo" what was your next step? It sounded like "specify fg"

  • @Zabo44
    @Zabo44 4 года назад

    Hi, what you did 19:34 ?

  • @gscodeseeker
    @gscodeseeker 4 года назад

    Quick question, why did you check the body response rather than the HTTP response code in your python script? For example checking if the response was 200 or something else, I'd imagine it would return a 401 if it didn't allow the extension.

  • @Ziomekpionek
    @Ziomekpionek 4 года назад

    Great stuff! Appreciate that you are adding some extra hints which i did't get in writeups, same for python. I noticed you are not closing files stream in for loop where you are checking different extensions upload. During scripting very often I don’t bother also :P but as we know as good practice we can use context managers like with statement or, f.close(). This is not the case here - but I just wonder does such unclose files may be some kind of vulnerability? Did you came across on that during challenges?

  • @asdsasdergrg
    @asdsasdergrg 4 года назад

    For basic and amateurs . I like it

  • @simba7161
    @simba7161 2 года назад

    28:08 "...press the dislike button twice to let me know how much you hated it" lmao

  • @mikeship7331
    @mikeship7331 3 года назад

    Method question… when you find a file upload page is your first thought always a php reverse shell? And what drives the thought process? Thanks!

  • @rishabhsingh3610
    @rishabhsingh3610 4 года назад

    Lol I just did this room! I actually uploaded a . service file and used systemctl to start a reverse shell as root but your methods seem so much more efficient! Just one question: what were those commands you used to make the first shell more stable?

  • @bearly1395
    @bearly1395 4 года назад

    I tried to use the privilege escalation method that you did but the services don't seem to load

  • @trapenoone6904
    @trapenoone6904 4 года назад +1

    Can you make video about how to make python scripts to do penetration testing and web application, it's really cool to be able to code on the fly without relying on Burp Suite.

  • @rcs2749
    @rcs2749 3 года назад

    Could not catch what you did to get your curser back once you used stty raw -echo

  • @pedrofontes8441
    @pedrofontes8441 4 года назад

    i didnt quite get what u did to stabilize the shell. can u explain the ctrlZ part?

  • @thedarkside6354
    @thedarkside6354 2 года назад

    i dont understand how worked the privileges escalation

  • @TheKoalaKids115
    @TheKoalaKids115 3 года назад

    Im currently in the room, and uhhh, using the recommended flag they have returns that the host is blocking ping probes and to try -Pn, and of course, when i use -Pn and any other number and combinations of flags, it just returns that all 1000 ports scanned are up, nothing else. ive been on this for 3 hours now xD ive tried, regular nmap, nmap -sC -sV ( -Pn ) ( -A) (-f) and each of those individually. ive reset my box twice now, did it break or am i just completely overthinking this?

    • @TheKoalaKids115
      @TheKoalaKids115 3 года назад

      forgot to mention, ive also used -sU and -sS, nothing so far has worked

  • @mushtakhussain9017
    @mushtakhussain9017 4 года назад

    Damn you're so inspiring

  • @santiagotodisco2668
    @santiagotodisco2668 4 года назад

    hey i'm doing this box and i get to the privilege escalation part. But the python -c is not working for me

  • @eyadhussien1055
    @eyadhussien1055 4 года назад

    Good job bro ♥️

    • @_JohnHammond
      @_JohnHammond  4 года назад

      Thanks so much! And thanks for watching!

  • @watchdog2864
    @watchdog2864 4 года назад

    So in order for your bin bash priv esc to work, you need another suid bit or something running as root to try and piggyback on?

    • @_JohnHammond
      @_JohnHammond  4 года назад +1

      Right, you would still need something that would allow you to run commands as root -- with that you can do whatever you would like for your privesc, but making the /bin/bash SUID makes for an easy technique. Thanks for watching!

  • @GodBurstPk
    @GodBurstPk 2 года назад

    Probably this is allowed havent touched python in a while but why not something like [f"php{i}" for i in range(1, 10)]+[...aditionals]
    This would "support" future versions if x function hasn't changed, easier to add multi support for additional list items also.

  • @jos1532
    @jos1532 4 года назад

    Oh man Thnks so much

  • @chiranjit9529
    @chiranjit9529 4 года назад

    Nice video man! 😄

    • @_JohnHammond
      @_JohnHammond  4 года назад

      Thanks so much! And thanks for watching!

  • @committedcoder3352
    @committedcoder3352 4 года назад +10

    Kinda lost me at the end, with the suid part, particularly with running the bin/bash -p, but very cool nonetheless

    • @saviofernandes5263
      @saviofernandes5263 4 года назад

      Me too, but after doing a little reading up on suid, it seemed simple.