Linux Hackers Become Root with CURL & Sudo

Поделиться
HTML-код
  • Опубликовано: 3 июн 2024
  • jh.live/pwyc || Jump into Pay What You Can training at whatever cost makes sense for you! jh.live/pwyc
    Play my "Book Store" challenge on HackingHub: app.hackinghub.io/book-store
    Learn Cybersecurity - Name Your Price Training with John Hammond: nameyourpricetraining.com
    WATCH MORE:
    Dark Web & Cybercrime Investigations: • Tracking Cybercrime on...
    Malware & Hacker Tradecraft: • Malware Analysis & Thr...
    📧JOIN MY NEWSLETTER ➡ jh.live/email
    🙏SUPPORT THE CHANNEL ➡ jh.live/patreon
    🤝 SPONSOR THE CHANNEL ➡ jh.live/sponsor
    🌎FOLLOW ME EVERYWHERE ➡ jh.live/twitter ↔ jh.live/linkedin ↔ jh.live/discord ↔ jh.live/instagram ↔ jh.live/tiktok
    💥 SEND ME MALWARE ➡ jh.live/malware
    🔥RUclips ALGORITHM ➡ Like, Comment, & Subscribe!

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

  • @TheMAZZTer
    @TheMAZZTer Месяц назад +41

    Your first python3 web server is running as "user" which is why "user" needs access to /home/fry/.bash_history to successfully serve the file. There's no security exploit here. Hence why you needed to adjust the file permissions. I would expect users wouldn't run that server since it doesn't give them anything they don't already have.
    Edit: The second python3 server running as fry is better since you smuggle in a file fry has access to into /root/ using curl as root. But ultimately you could have done the same by using curl as a fancy cp.

  • @Tib3rius
    @Tib3rius Месяц назад +67

    Appreciate the shout out John! This was a really interesting privesc. :D

    • @ytg6663
      @ytg6663 Месяц назад

      What interesting. He could just directly do ls -l . Cat /etc/passwd
      In real enterprise environment he tricks wont work

    • @davel202
      @davel202 Месяц назад +3

      Oh hey! I think I remember seeing you do an interview with Spycast or someone in the vet community. I recognized the avatar

    • @ytg6663
      @ytg6663 Месяц назад

      @@davel202 lol

    • @Tib3rius
      @Tib3rius Месяц назад

      @@davel202 Sorry, haven't done an interview with Spycast or the vet community.

  • @almog4373
    @almog4373 Месяц назад +11

    You could also rewrite the /etc/shadow file, edit the uid of a user u have in /etc/passwd…

    • @aerozine2389
      @aerozine2389 Месяц назад +2

      I just removed the hash of root then overwrote shadow; then just ran su :)

    • @AlejanroDelHierro
      @AlejanroDelHierro Месяц назад +2

      @@aerozine2389 Mostly, only root is approved to write, even read a file.

  • @aalbatrossguy
    @aalbatrossguy Месяц назад +5

    man, I love your videos :)
    keep up the good work :)

  • @DHIRAL2908
    @DHIRAL2908 Месяц назад +15

    6:00 Doesn't python server read the file and serve it? How can curl having the sudo perms make python be able to serve a forbidden file?🤔

  • @algorithmblessedboy4831
    @algorithmblessedboy4831 Месяц назад +4

    3:10 lmao I am watching at 23 pm and i got flashbanged

  • @liveting4579
    @liveting4579 Месяц назад +1

    Hey John, is there anyway to reach out to you about setting up vulnerable servers?

  • @rogerioabreu3081
    @rogerioabreu3081 Месяц назад +3

    Great work, John!

  • @ChillstreamCentral
    @ChillstreamCentral Месяц назад +3

    wait a min. i didn't get that, when we access that file via curl its requesting python server for that file and python don't have perms to read that file, how the hell curl suid perms allowed that?

    • @user-mk3zz8zn9b
      @user-mk3zz8zn9b 13 дней назад

      its not requesting python server, curl can do that on its owm , since it had root perms. we dont need pythonserver, at all after the fry shell

  • @Adkali
    @Adkali Месяц назад

    Nice!
    Thanks for sharing John!

  • @ToyeTuning
    @ToyeTuning Месяц назад +1

    Always great videos. Thanks John!
    Edit: I often make the same mistake when doing links 😂.

  • @Trilipop
    @Trilipop Месяц назад +1

    great stuff! really clever

  • @carl313313
    @carl313313 Месяц назад +1

    If you fixed up the perms, then this wouldn't work, because the HTTP server would need to run as fry or root to read any of fry's files.
    Could've just "cat /home/fry/.bash_history" at this point instead to save time.

  • @mihaiciocan59
    @mihaiciocan59 Месяц назад

    Hi. Just a quick question. If you had access to write, is there a possibility to overwrite the/etc/shadow file with a new hashed password that you actually know for the root account?

    • @_JohnHammond
      @_JohnHammond  Месяц назад

      Yes! That is an even better technique, so it all stays local and you don't have to rely on SSH. If you remove the hash entirely, you can su to root without even needing a password 😎

    • @mihaiciocan59
      @mihaiciocan59 Месяц назад

      @@_JohnHammond Exactly, thanks for the answer 😉

  • @gabrielex
    @gabrielex Месяц назад

    That was neat, the only downside is that this way if the authorized_keys file does exist you'll be overwriting it, so the original user wouldn't be able to access anymore using their key.
    Also root ssh access could have been disabled for safety reasons.

  • @NANa-nz2pz
    @NANa-nz2pz Месяц назад +2

    John, what do you think of Tcm security training?

  • @xCheddarB0b42x
    @xCheddarB0b42x Месяц назад +1

    Great stuff. I now have more CTF problems than I have time. LMAO 😅

  • @nickg.7275
    @nickg.7275 Месяц назад

    Nice idea. Thx.

  • @gregorh5658
    @gregorh5658 Месяц назад

    Awesome !!

  • @definitelyno
    @definitelyno Месяц назад

    The first curl example does not make any sense. The web server that reads the symlink will do it as the same user as is running curl and the web server. Curl simply does nothing in that case, just that the permissions were set incorrectly.

  • @wrathofainz
    @wrathofainz Месяц назад +1

    Glad I'm not the only one who consistently fucks up the ln command.
    I do the same with mklink on Windows -_- oh the pain

    • @beardlyinteresting
      @beardlyinteresting Месяц назад

      Commands I've used a million times but always need to look up:
      ln
      tar
      find

  • @RuggMatt
    @RuggMatt Месяц назад +3

    Someone once time me the order of the params for ln is the same as mv and cp and i have never forgotten it since.
    mv
    cp
    ln -s

    • @paultapping9510
      @paultapping9510 Месяц назад

      ln -s will overwrite the old file with a blank new one. I discovered this trying to move my .bashrc into .config and symlink it into ~. That was a fun hour 😂

  • @JustenCase
    @JustenCase Месяц назад +1

    You can just become root with only needing sudo..... sudo passwd -d root && su and now ur root. Way faster..

  • @an3ssh
    @an3ssh Месяц назад

    please put the nahamcon ctf hosted somewhere.....

  • @hacker4fun
    @hacker4fun Месяц назад

    john never disappoints !!

  • @luis-rv8jj
    @luis-rv8jj Месяц назад

    how to access one system to another system

  • @thespecialchannel
    @thespecialchannel Месяц назад

    if he's already running commants using fry and using sudo then where the heck is the privilege escalation

  • @AUBCodeII
    @AUBCodeII Месяц назад

    Hey, John, let's get OSEE.

  • @lltheblankll3024
    @lltheblankll3024 Месяц назад +1

    nice!

  • @amnahidhasan
    @amnahidhasan Месяц назад

    You are amazing

  • @sluuny
    @sluuny Месяц назад +1

    Love your videos !! Thx !!
    Is this Kali on bare metal or in a VM ?

  • @tametov
    @tametov Месяц назад

    Cool 😊

  • @yajusgakhar6969
    @yajusgakhar6969 Месяц назад

    Not me doing a symbolic link CTF just before watching this video 😂

  • @petermoras6893
    @petermoras6893 Месяц назад

    Privilege escalation, in MY sudo? It's more likely than you think.

  • @ahmedazizabbassi
    @ahmedazizabbassi Месяц назад

    Thanks a lot for this valuable and enjoyable content 🥰

  • @false_positive
    @false_positive Месяц назад

    conclusion - no ssh no problem :D

  • @ramprasadmuppana5002
    @ramprasadmuppana5002 Месяц назад

    I want to learn Exploit development, any suggestions mates..

    • @Jarling-so4oi
      @Jarling-so4oi Месяц назад +1

      Buffer overflows, Azeria Labs and Liveoverflow's Bin series

    • @ramprasadmuppana5002
      @ramprasadmuppana5002 Месяц назад

      @@Jarling-so4oi mate, any prerequisite

  • @Apple_Beshy
    @Apple_Beshy Месяц назад

    ❤❤❤

  • @rigsshiver823
    @rigsshiver823 Месяц назад

    6:13 pepePains the password

  • @temolantern9091
    @temolantern9091 Месяц назад

    mmm hamham-yumyum-tumtum

  • @nightwalker83
    @nightwalker83 Месяц назад

    I can't see the subsibe button 😂

  • @bertosudu9506
    @bertosudu9506 29 дней назад

    👍👍👍👍👍👍👍👍👍👍👍👍

  • @meanjellybean8963
    @meanjellybean8963 Месяц назад

    Second

  • @stylo__boy
    @stylo__boy Месяц назад +2

    First 🥇

  • @proveryourpoint_8554
    @proveryourpoint_8554 Месяц назад +1

    for some reason I hate when you say "tac" instead of "dash"

  • @abdullahgunduz2656
    @abdullahgunduz2656 Месяц назад

    Brother, why are there no Turkish subtitles? Do you have a problem with Turks?

    • @RadicalInteger
      @RadicalInteger Месяц назад

      there's also no Persian, probably unintended

    • @hawks5196
      @hawks5196 Месяц назад +2

      Ask RUclips, they are auto generated

    • @MI7DJT
      @MI7DJT Месяц назад

      Why race-baiting? That's VERY low IQ.

  • @paradoxlord
    @paradoxlord Месяц назад

    very good