Blind MongoDB NoSQL Injection - HackTheBox Cyber Apocalypse CTF

Поділитися
Вставка
  • Опубліковано 25 жов 2024

КОМЕНТАРІ • 81

  • @blackwidow4real
    @blackwidow4real 3 роки тому +11

    As a beginner programmer and database analyst, these videos truely facinate me. I love your content John!

  • @MrNederlande
    @MrNederlande 3 роки тому +5

    You could have checked the folder „routes“ for the route implementation :) - awesome vid!

  • @danielfrycowski4713
    @danielfrycowski4713 3 роки тому +2

    Wow just wow, watching You and Ippsec hosting HTB battlegrounds tournament event tomorrow will be the best thing i could have hoped for. I am so hyped up to see it tomorrow :)

  • @immunesicness3399
    @immunesicness3399 3 роки тому +1

    Seeing you do all this help me understand it all in real time thanks john

  • @JFDicer927
    @JFDicer927 3 роки тому +1

    You woke me up this morning lol. Great Video!

  • @loganwolf3524
    @loganwolf3524 2 роки тому

    You should put this quote on a t-shirt, “Can I do weird stuff with it?” -time stamp 6:05

  • @NormCantoral
    @NormCantoral 3 роки тому +1

    anyone else who has a nice subwoofer with their sound system, listen to those words that start with the letter "P"... now those are some hits in the LFE range.

  • @NateRoberts
    @NateRoberts 3 роки тому

    Lots of Blind SQL, very interesting concept! Appreciate the video John

  • @joosh.e
    @joosh.e Рік тому

    Man... I understood about 30-35% of what was going on in this video. but a year ago that would have been more like 1-5%. can't wait to see where I am a year from now!

  • @viv_2489
    @viv_2489 3 роки тому +14

    Big fan John Hammond 🙏

  • @Martynas_
    @Martynas_ 3 роки тому +1

    Mr Robot Easter egg at the beginning - sysadmin

  • @diddyman1958
    @diddyman1958 3 роки тому

    I just about followed this. I'm getting better!

  • @MardukNHR
    @MardukNHR 3 роки тому

    "(SYSADM) - Elliot Anderson"
    Hello friend :_)

  • @bbowling619
    @bbowling619 3 роки тому +1

    Everytime i join back into one of these with you john my brain gets better 🥰

    • @codr6934
      @codr6934 3 роки тому

      lol can relate

  • @hackingismylife2167
    @hackingismylife2167 3 роки тому +1

    Sir I really appreciate your videos more helpful for bigger

  • @guieguima
    @guieguima Рік тому

    This was really helpful! Good video :)

  • @mf-11111
    @mf-11111 8 місяців тому

    John Hammond is a Legend

  • @JaskaranSingh-ob4fu
    @JaskaranSingh-ob4fu 3 роки тому +1

    The video i ve been waiting for. Finalllyyy.

  • @tringo1538
    @tringo1538 2 роки тому

    Thanks so much ! It's really good !

  • @NoONE-bk7ud
    @NoONE-bk7ud Рік тому

    This is art bro your using the keyboard by your head

  • @deuxvlve746
    @deuxvlve746 2 роки тому

    Genius John Hommand

  • @addyhadmelike655
    @addyhadmelike655 3 роки тому

    Making my sacrifice to the youtube algorithm.
    Great video by the way

  • @scenepool
    @scenepool 3 роки тому +14

    Why is the response returning OK for each char tho?

    • @jasonmus
      @jasonmus 3 роки тому +4

      I believe the password is being sent through as a regex expression that is telling the db to match the first character only. the caret symbol (^) in regex means "start of line", so that query is asking the db to match only the first character of the password.

  • @SuitUpDubstep
    @SuitUpDubstep 3 роки тому

    That script was so freaking rad!

  • @andrecederholm1608
    @andrecederholm1608 3 роки тому

    Great video as always and learning a ton from watching!

  • @JanRautiainen
    @JanRautiainen 3 роки тому +1

    I was a bit late to join, just in time to see the conclusion, gotta rewatch later.

  • @ocortesl
    @ocortesl 3 роки тому

    Thanks.

  • @endgame_1332
    @endgame_1332 3 роки тому

    love the thumbnail

  • @DimosAvergis
    @DimosAvergis 3 роки тому +4

    Am I'm missing something or why does a backend service/DB connector answers with a success message if I post a part/single character of a PW that happens to be the beginning of the real PW?

    • @GamingBlarg
      @GamingBlarg 3 роки тому +3

      I'm confused too.

    • @ArthursHD
      @ArthursHD 3 роки тому +3

      Sounds like a bad implementation of user passwords. Shouldn't it fail until full password string is provided? Password hash would be completely different once a letter has been changed :)
      And shouldn't there be login time-out, bolck of IP's for too many attempts?

    • @DimosAvergis
      @DimosAvergis 3 роки тому +2

      @@ArthursHD Idk to be honest. For me it seems like the passwort check is doing a ".beginsWith(input)" check and we brute force our way into it.
      I fail to see how this is an blind NoSql Injection, because under a (No)Sql Injection I understand to either modify data or gain access to data that should not be accessible to you, not bruteforcing a admin password.
      But this just seems to be a easy mode brute force attack, because even normal brute force attacks require you to send the complete password, not parts of it.
      Maybe I'm missing something that Mongo does to inputs and how it handles stored data access which would explain why this strange brute force attack worked.
      But in that case I didn't catch the explanation for it, even after 3 rewatches.

    • @DimosAvergis
      @DimosAvergis 3 роки тому

      @@GiQQ Okay after reading a bit about the python % strings and understand how mongo handles search "queries" I get what happens here.
      in short we put a mongoDB regex lookup into the post request as password parameter. Which then causes mongo to look for a user named "admin" where the regex matches true. So we could have logged in way earlier (like the first C) if we get a token in response.
      I feel like this part could have been explained a bit more/better in 2- to 3 sentences, like I did above. But maybe that happened in other videos he made before and mentioned and he didn't wanted to repeat himself.
      Which is understandable but is also making them harder to be standalone learning videos. Because I found his video from a google search for "MongoDB NoSQL injection"
      But this attack wouldn't work on any even half asses login system, as the DB would not store plain PWs and would only use the hash of the request payload and compare it with the hash that is stored in the DB (+ hopefully some salt). So the cool regex would be just a long hashvalue and would always return false, even if you give the correct password string into the regex, because the word regex itself would cause the hash to be completely of.
      It could however work for other plain data fields.
      But then my question would be, how do we sanitize user input for which I need to query? Are there inbuild functions in mongo adapter for the corresponding platform (e.g. mongoose)? There is not a lot in the web for MongoDB input validation/NoSql injection. At least way less than what Sql Injection offers.

    • @DimosAvergis
      @DimosAvergis 3 роки тому +1

      @@GiQQ but if my backend logic is to insert userinputs into my hash function and then search the hash in my hasshed-PW-DB I would also hash the '{"regex": "....." }' part, because that is what my request has as value for the password key (inside the payload) and which will get pumped into my hash function

  • @bulmavegeta23
    @bulmavegeta23 3 роки тому

    a couple of days ago I solved a ctf like this, it wasn't sqli, it was brute force, I think it was from hacker101
    u r awesome John 👍🏼

  • @yotshmep1224
    @yotshmep1224 2 роки тому

    Awesome videos, keep making em please

  • @tomasgorda
    @tomasgorda 3 роки тому

    I love John Hamond´s scripts 😁👍👍

  • @VexillariusMusicEDM
    @VexillariusMusicEDM 3 роки тому +1

    I'd be very curious to see the api code that allowed for this injection to take place. I'm assuming it's located in the "routes" folder somewhere (which you can see included in the express code on line 17). Very informative video, thank you sir!

    • @caionakai3134
      @caionakai3134 3 роки тому +1

      here it is
      router.post('/api/login', (req, res) => {
      let { username, password } = req.body;
      if (username && password) {
      return User.find({
      username,
      password
      })
      .then((user) => {
      if (user.length == 1) {
      return res.json({logged: 1, message: `Login Successful, welcome back ${user[0].username}.` });
      } else {
      return res.json({logged: 0, message: 'Login Failed'});
      }
      })
      .catch(() => res.json({ message: 'Something went wrong'}));
      }
      return res.json({ message: 'Invalid username or password'});
      });

    • @deathdefier45
      @deathdefier45 2 роки тому

      Me too, hey, did you find what bad code practice led to this exploit? If so could you share the resource?

  • @nickynielsen6132
    @nickynielsen6132 3 роки тому

    great, love your vids. hope that this will be great as well!

  • @DahlFreeman
    @DahlFreeman 3 роки тому

    This videos are really cool!

  • @MrFailcam
    @MrFailcam 3 роки тому

    awesome stuff man
    really enjoyed the stream

  • @Thiago1337
    @Thiago1337 3 роки тому

    Cool stuff John

  • @felixjimenezgonzalez9292
    @felixjimenezgonzalez9292 2 роки тому

    Well, this is scary

  • @cherifxtitou6822
    @cherifxtitou6822 3 роки тому

    love u man

  • @gillesva51
    @gillesva51 2 роки тому

    algorythm!

  • @therealblastpop4540
    @therealblastpop4540 2 роки тому

    Hey John ! I'm a huge fan btw. So, I was wondering if it is possible to make the request faster?

  • @Shubhamkumar-sv1ty
    @Shubhamkumar-sv1ty 3 роки тому

    How can we attempt these challenges again because now I cant seen to find a place from where I can access it

  • @iote56_laveshpashte99
    @iote56_laveshpashte99 3 роки тому

    great

  • @choleralul
    @choleralul 3 роки тому

    Cool!

  • @chickeningay
    @chickeningay 3 роки тому +1

    Guys im really curious about something and i dont know where to ask when you do the challanges in try hack me kind of websites you need to be connected to it so how does hackers in russia for example hack servers in other countries?

  • @PROGRAMMINGFORFUN
    @PROGRAMMINGFORFUN 3 роки тому

    nice one!

  • @lnaver
    @lnaver 3 роки тому

    Wish this was challenge was available after the ctf ended so we could follow along

  • @blow5371
    @blow5371 3 роки тому

    I like CTF video!!!

  • @hydejel3647
    @hydejel3647 3 роки тому

    comment for the algorithm!

  • @noy5626
    @noy5626 Рік тому

    👍

  • @BuRRak
    @BuRRak 3 роки тому

    Sick video :)

  • @danielv3228
    @danielv3228 3 роки тому

    Im still somewhat new to THM and HTB (about 2 months in - daily), but I am a bit confused by what went on at the beginning of this video. Is there a place someone could direct me to so I could understand what was happening here as it seems so different than the usual challenges? Docker, downloading all the source, etc... Thanks!

    • @Imwer
      @Imwer 3 роки тому

      Perhaps this is what you are looking for: hackthebox[.]eu Or at least you find can what you are looking for there :)

  • @deathdefier45
    @deathdefier45 2 роки тому

    Does hashing the password before saving prevent this type of injection?

  • @يونسايمنيونسشكر
    @يونسايمنيونسشكر 3 роки тому

    hey man i love your videos but there is a proplem i am having i installed kali on virtualbox and i am learning the from INE but when i try to connect to their vpn i get tcp (not bound ) and when i tried try hack me vpn file it gave me udp (not bound ) as well
    i will be thankful if you could help

  • @jhbonarius
    @jhbonarius 3 роки тому

    Great, but not a good as the secret live stream today. 😜

  • @ajaykumark107
    @ajaykumark107 3 роки тому

    please make more videos!

  • @petergentile8974
    @petergentile8974 3 роки тому

    i wish i could understand any of this.

  • @OrangeJuicehcst
    @OrangeJuicehcst 3 роки тому

    Reading the source code before cracking it isn't a little bit cheating ?

    • @user-cd6vy2jg6f
      @user-cd6vy2jg6f 2 роки тому +1

      Every challenge has a different difficulty level. Some of them provide “downloads” that you are expected to look at

  • @dasbootin8127
    @dasbootin8127 3 роки тому

    algo comment

  • @seanvinsick
    @seanvinsick 3 роки тому +2

    you have an exponential algorithm.
    try this to speed it up
    new_printable=set(string.printable)-set('*+/;\'\\\"')
    for c in new_printable:
    ...

  • @bhagyalakshmi1053
    @bhagyalakshmi1053 Рік тому

    Nod moor explain

  • @jvcss
    @jvcss 3 роки тому

    só eu que pensei em usar um bloco try catch englobando o if ? kkkk

  • @psd00m
    @psd00m 3 роки тому

  • @bhagyalakshmi1053
    @bhagyalakshmi1053 Рік тому

    T finu d codo details coro codo

  • @heatheasley751
    @heatheasley751 3 роки тому

    algorithm_thing.txt

  • @user-ke7bz5ue5j
    @user-ke7bz5ue5j 3 роки тому

    Who saw mr beast in the thumbnail and came here

  • @shashank6753
    @shashank6753 3 роки тому

    Hii i want to become a cyber expert if you can guide me sir so, plez reply