Google CTF - Authentication Bypass

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

КОМЕНТАРІ • 134

  • @theRealWhexy
    @theRealWhexy 4 роки тому +503

    First to know in MySQL, unless the string is a number ('123', '-42') or the strings starts by a number, every other string equals 0 (or FALSE). That makes password = 'username' = 'anything' be true in this way: the DB system fill Michelle's password into the where clause, it becomes 'MichellePassword' = 'username' = 'anything'. Then, 'MichellePassword' = 'username' is 0(false), and 0 = 'anything' is true because the string 'anything' is calculated as an 0! And finally the where clause makes a funny result --> True. That makes the attack success.

    • @_JohnHammond
      @_JohnHammond  4 роки тому +130

      Oh WOAH! Okay, THAT is awesome! Thanks for helping clarify that. I never exactly understood it 1000%. Pinning your comment so other viewers get a more solid explanation :)

    • @padaloni
      @padaloni 4 роки тому +4

      nice one! thanks for the explanation.

    • @hackndo6891
      @hackndo6891 4 роки тому +83

      @@_JohnHammond If we wanna be a little bit more precise, it is password = `username` = 'anything'. Note the backticks on the "username" field. It's because the key of the passed object is username, and backticks indicate it's a column name, not a value.
      Thus, when evaluating, MySQL will resolve password column as Michelle's password, let's say "MichelleP4ssword"
      `username` will be evaluated as "michelle", and "anything" will stay "anything".
      If you put password[password]=anything, then the `password` column will be replaced with "MichelleP4ssword" ending with this evaluation:
      "MichelleP4ssword" = "MichelleP4ssword" = "Anything". First, "MichelleP4ssword" = "MichelleP4ssword" will be true, and then, true = "Anything" will be false, so it doesn't authenticate.
      That's why it's working with "username" or "id", but not with "password".

    • @BrainFood155
      @BrainFood155 4 роки тому +1

      Wow! That bizarre!!

    • @juliengrijalva8606
      @juliengrijalva8606 4 роки тому +4

      @@hackndo6891 So is this also the reason it didn't work with admin-admin, because "admin"="admin" returns true, and admin is both username and password?

  • @jfkz2000
    @jfkz2000 4 роки тому +205

    John, never worry about video length when making these. We like to see your learning process. It helps us become better. I used to hack in the 90's and after the family i never had time. Just now getting back into it! Keep up the good work. Kudos to you!
    \

    • @trev1980x
      @trev1980x 4 роки тому +2

      Yup, if anything a bit more digging would have been good in this case. I don't feel like this video had a real conclusion :( I'm still a bit lost as to why password[password]="xyz" doesn't work.

    • @jongalloway4104
      @jongalloway4104 4 роки тому

      I completely agree! Watching how you think through things helps me learn how to do the same. You told everyone when you captured the flag, whoever didn't want to keep watching could stop 🙂

    • @krztix
      @krztix 4 роки тому +1

      damn in the 90's you coming back from that http password cleartext era xD

    • @clemsonfan53089
      @clemsonfan53089 4 роки тому

      I agree 100%.. Let the video be long.. Watching you go down these rabbit holes, helps us understand the hacker mentality and the different ways to solve problems. Love your vids!

  • @allokrvlastnamesareoverrat4914
    @allokrvlastnamesareoverrat4914 4 роки тому +31

    That "boring and stupid" part at the end was exactly what I'd love to see more of

  • @AhrenBaderJarvis
    @AhrenBaderJarvis 4 роки тому +70

    Honestly I found the part at the end (that you said was so boring) where you were exploring why that worked to be the most intriguing part. 😁

  • @michaelogrady4435
    @michaelogrady4435 4 роки тому +27

    Watched until the end because im here to learn, love the extended cut.

  • @seanolson4582
    @seanolson4582 4 роки тому +36

    Hey the end where you are trying to understand what’s going on is just important. It’s not stupid. You are showing people how to find answers and learn

  • @DCLEE-co3dj
    @DCLEE-co3dj 3 роки тому +1

    I agree John 95% of your support group is here to learn so dont worry about surfing the net making a video too long because the whole process helps all of us learn new methods, tricks and valuable information for the long haul. Thanks for adding me on LinkedIn recently. Another great video my friend.

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

    I may not speak for everyone but hearing your thinking process when going down the rabbit hole is what taught me the most in this video. Thank you!

  • @grandmaashley
    @grandmaashley 4 роки тому +55

    grandma approved

  • @Luxgil
    @Luxgil 4 роки тому +2

    Watching you trying to learn something isn't boring, I actually enjoy to watch that.
    Good job and a nice video.!

  • @DarknessLPs
    @DarknessLPs 4 роки тому +1

    John,
    I am getting into cybersecurity as a new job and I actually really appreciated seeing how you looked up information to try to figure out how things were working at the end of the video. I appreciated it for 2 reasons, 1, it shows how to find the cause of a security flaw (and therefore how it might be patched) and 2, it shows the actual logic on why the method worked in the first place (pretty much an exercise in "how" to think about it rather than just stopping at "it works, so why do I care why it works?").

  • @ngonx5051
    @ngonx5051 4 роки тому +34

    I was also really curious as to why this bypass worked so I did a little digging. By using the "mysql.format" function with the nodejs library and passing in the SQL statement from the source code with the two input parameters that would have come in from the request (with the password coming in as an object), it returns the following query: Select * from users where username = 'michelle' and password = `username` = 'whatever'. The issue comes with the comparison having the multiple equals signs, which will always evaluate to true with string comparisons based on the order that MySQL evaluates such a statement (there are some stack overflow threads that explain this better than I can). I think the whole point of the challenge was that passing in an object into the prepared statement would produce a scenario where it adds this extra = to the password checking part of the query, rendering it useless.

    • @sgaleta
      @sgaleta 4 роки тому +1

      Could you point to the stack overflow threads, I couldn't find them and I'm interested

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

      @@sgaleta I think this one explains it in a really clear, concise manner stackoverflow.com/questions/19214675/why-does-select-a-b-c-return-1-in-mysql

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

      Great explanation, but I have one small question left. Why at 16:28 does username=admin not work? To my understanding it should just log you in as the admin user right?

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

      @@J0R1AN I think it’s because the password for is also admin

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

      To elaborate, the password=‘username’ would evaluate to true (which is evaluated as 1 in MySQL), which would be compared to “whatever” as “1=0(false)”, which would ultimately return false

  • @chiko3603
    @chiko3603 4 роки тому +2

    Bro i'm sure most of us are learning lot of stuff from ur videos, and we r here because of the way u explain things so don't worry about the writeup being urs or no, i prefer watch one of ur videos than reading an article

  • @tvathome562
    @tvathome562 2 роки тому +1

    Even if its someone else's work its still John's ability to work through, digest and express ideas in a easy to understand way that keeps the viewers coming back.

  • @TobyDeshane
    @TobyDeshane 4 роки тому

    Nothing at all wrong with following the rabbit hole until you find a solution. I can't speak for others, but learning WHY these things work is part of why I watch these. By all means, throw down a point like you did where folks can get off the train, but don't feel obligated to cut the research short if it's still unknown. That's the most important part, IMHO.

  • @whistletoe
    @whistletoe 4 роки тому +5

    The extended cut is awesome. Don’t worry about the length of the video!

  • @Philbertsroom
    @Philbertsroom 4 роки тому +1

    I really like these videos. You reading through write ups and explaining your thought process is really informative. Good job keep it up!

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

    What an amazing video John! Thankyou so much for such content.

  • @diegushio91
    @diegushio91 4 роки тому

    hey just a comment! @John Hammon the way you wondered on the internet, is something we all do and talk exactly like that just not otloud but it ends up being natural, and it's besides entertaining a good way of showing the process to new comers! so keep it natural, we love it!
    Suscribed

  • @gingercam3127
    @gingercam3127 4 роки тому +1

    I learn sooo much from your videos! Thank you

  • @suyogdahal8185
    @suyogdahal8185 4 роки тому

    This is too good. I am entertained by this type of stuff than other regular videos where you get to the point without any trouble. And let the videos be hours long it does not matter.

  • @jasonmikinskiwallet4308
    @jasonmikinskiwallet4308 4 роки тому +1

    This was not boring at all bro! Keep it up

  • @deepakrana9872
    @deepakrana9872 4 роки тому

    I also love finding out why a technique work and your video helps me a lot to learn many stuffs

  • @ca7986
    @ca7986 4 роки тому +2

    Love the end learning part! ❤️

  • @jacoblobo95
    @jacoblobo95 4 роки тому +1

    I'm doubtful anybody ever can or has gotten to a point where they'll never have to look something up to solve every CTF challenge. Considering your audience, myself included, we're always coming across something that makes redefine our understanding and makes us dig for why things work the way they do. I think this is the fun part, we're not just learning. We're constantly asking "How can I use these rules, this system to solve the challenge?"
    With how technical and dry all of this stuff can be, I think that's a key part of what makes it fun. Well, at least for me. It's a mystery waiting to be solved.
    Nobody wants to watch a mystery thriller where we jump from unsolved case to the criminal being arrested. I know, at least personally, I love watching how someone else uses critical thinking and deductive reasoning to find the answer. It's inspiring and fascinating.
    Anywho, thanks for the video! I really enjoyed this one more than usual and look forward to watching more!

  • @elderorozco-ochoa5249
    @elderorozco-ochoa5249 4 роки тому

    Thank you so much for uploading your videos! I'm super new into the tech world and am learning so much from. Although I don't know 100% of what you're talking about it makes me curious and I start searching up these words. Thank you John !!!

  • @sasharofikrahmanie
    @sasharofikrahmanie 4 роки тому

    thats what i like about you and your videos. you are awesome and humble at the same time. i learned so much from your videos and yourself. wholesome hacker and conetent creator 👏👏🙌🙌

  • @Slenkz
    @Slenkz 4 роки тому

    Definitely my new favorite channel, great content ❤️

  • @JimmyCroissant69
    @JimmyCroissant69 4 роки тому +4

    Hi John,
    Love the channel and the videos. You seem to have a great eye for exploitable aspects of the code during the ctf you get the job done. I would much prefer a longer format where you dig deeper into the node source given in the challenge prior to retrofitting write ups. Possibly you could run the code locally, step through with breakpoint debugging. Would also love to see an 'alarm bells ringing when I see this' cheat sheet per domain server stack / language.
    Keep the good content coming!

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

    I like when you wonder around and trying to understand whats happening and explaining to us

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

      👆👆 for your account recovery he's the best and reliable indeed you're trustworthy💯💯

  • @RohanMukherjeeRoe
    @RohanMukherjeeRoe 4 роки тому +1

    The string actually evaluates to:
    "Select * from users where username = 'michelle' and password = `username` = 'michelle';"
    I added a part in my writeup (at 21:26) explaining how I think it works, hope this helps :)
    Link: github.com/csivitu/CTF-Write-ups/tree/master/Google%20CTF/Web/Log-Me-In

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

      Thanks for adding more information to that write-up, I understand it now. Not 100% but it's slowly sinking in XD

  • @ahmadzulfikark8486
    @ahmadzulfikark8486 4 роки тому

    I love your mindset which is amazing

  • @fatcatgaming695
    @fatcatgaming695 4 роки тому

    this process of investigating and learning is great content, at least imo.

  • @alhasanmohammed4378
    @alhasanmohammed4378 4 роки тому

    Dude never stop making videos please ♥️

  • @creonte38
    @creonte38 4 роки тому

    Time is necessary to learn and don't worry about it! Amazing try! Try hard always!! Thanks for sharing your knowledge with us!

  • @JesseBourretGheysen
    @JesseBourretGheysen 4 роки тому

    You videos are teaching me so much! Thanks amigo

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

    Great video man! Honestly the end helped me the most

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

    Pure genius. Thanks John

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

    1:18 I knew we would have retroactively hilarious Deltarune predictions

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

    Agree with everyone, last part was fun to watch.

  • @Emkay-1999
    @Emkay-1999 4 роки тому

    Don't worry about the length of your video... Because learning new things is itself interesting!!

  • @devotee9606
    @devotee9606 4 роки тому +2

    learned new thing about curl
    Thanks!!!!

  • @reaperkilledyou9669
    @reaperkilledyou9669 4 роки тому +4

    John! Dude first off just wanna say I love your videos

  • @hackernews1059
    @hackernews1059 4 роки тому

    thanks john for your effort

  • @theprateekmahajan
    @theprateekmahajan 4 роки тому

    Rabbit holes are good. They exists so we can learn something new!

  • @rami3sam
    @rami3sam 4 роки тому

    another awesome video thank you john

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

    Unless I'm mistaken Michelle is the password and when you parse it in the way you did the string works. I face-palmed when I figured it out. Admin's password is "admin" so it's logical that they did something overly easy for the flag account. Either that or it's including the password as a part of the username object.

  • @andycascade
    @andycascade 4 роки тому +5

    Still don't get why select * from table where field=''='' gives all the table
    John, how about bonus episode with explanation about SQL type-cast weirdness and how vulnerable could it be?

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

      Some clarification:
      SELECT * FROM table WHERE field=''='', evaluates the WHERE clause for each record/row. With the assumption that 'field' is a string type, let's say for the first row, 'field' has a value of 'first'. Then for the first row, the WHERE clause evaluates to 'first'=''=''. The first part of the expression is 'first'=''. This is an equality comparison between two (clearly distinct) strings. The result is obviously false (which is the same as 0). The second part of the expression is then evaluated, as 0=''. For the purpose comparing numeric values and strings, strings are implicitly casted to said numeric type. Strings that are a numeric value will be casted as that value. For example '32' will be casted as 32. Strings beginning with a numeric character and containing non-numeric characters will be casted as the numeric value leading the string. For example '4somestring' will be casted as 4. All other strings are casted as 0. Returning to our expression, this means that the second comparison becomes 0=0 (since an empty string has no numeric characters), resulting in true. Thus, we can return this record/row. As becomes apparent, for all records, unless the value contained within 'field' is an empty string, this WHERE clause will always evaluate to be true. If a record has a 'field' value of an empty string, then the expression evaluates as follows: ''=''='' -> true/1='' -> true/1=0 -> false/0. So, if every record in your table has a value for 'field' that is a non-empty string, you will return them all.

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

      I should add that this is an example of terrible language design and I do not advocate using MySQL for this reason, amongst many others.

  • @sentinalprime8838
    @sentinalprime8838 4 роки тому

    amazing video john you rock

  • @siddharthjohri2935
    @siddharthjohri2935 4 роки тому

    John the Don. Love ya.

  • @wesauis
    @wesauis 4 роки тому

    on SQL, ` can be used to mark the value as the name of a column or table
    password=`password` it is the same as password=password, basically it is comparing if the value of the password column is equal to itself, what will always be true
    password = `password` = 1 will be evaluated to true = 1 which is the same as true = true, that is, true

    • @wesauis
      @wesauis 4 роки тому

      Very confusing, but it works

  • @tdevzone2654
    @tdevzone2654 4 роки тому

    what a video, really thank you

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

    Hey John,
    tbh the last part was the most interesting one for me, not boring at all :-)
    also... I would've loved if you would have tried the prototype polution here aswell

  • @ArmyK9
    @ArmyK9 4 роки тому

    Nested SQL query within a query. 👏

  • @eugenekolodenker9976
    @eugenekolodenker9976 4 роки тому

    My suggestion is to start a local copy of the challenge as soon as possible. Then start debugging the program, i.e., put prints near the query to understand what's happening and what's actually being sent to MySQL.

  • @richardjones9598
    @richardjones9598 4 роки тому +1

    Thank you!! Cant wait xD

  • @jannikmeissner
    @jannikmeissner 4 роки тому

    Gives me vibes of "Silicon Valley": "Your username is password and your password is password?"

  • @parikshitsingh9847
    @parikshitsingh9847 4 роки тому +2

    Hey man, have you got the logic behind that query now? Can you explain it?

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

    I wish you finished figuring this out - I want to know why its working the way it is. Also doesn't make sense to me.

  • @nadavram7322
    @nadavram7322 4 роки тому +1

    Good stuff! :)
    THM Throwback network vid coming soon? 🖥

  • @SaudAlfurhud
    @SaudAlfurhud 4 роки тому

    I love how you explain things about the code and how it works, is there any course you could recommend for beginner this fields ?

  • @facebookdatasciencecambrid3885
    @facebookdatasciencecambrid3885 4 роки тому +1

    Good vid. Not bad.

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

    Hey John, if I wanna practice these ctf challenges now, I mean I wanna upsolve them how can I do ? Could you please provide me any hint or something, please help.

  • @k0rtz376
    @k0rtz376 4 роки тому

    Good stuff!!

  • @chrishammer5925
    @chrishammer5925 4 роки тому

    I have to tell you to "slow the F down" sometimes and pause you... lol I need to visualize things, which means I may need to read what you read outloud twice. Not sure if possible, but if there is a way you could describe a visualization of things, like what that pinned comment means, it would be amazingly helpful on how it works. Appreciate your videos mate

  • @healthyjibbit
    @healthyjibbit 4 роки тому

    Like always good video

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

    hey may I know what OS were you using in this video?

  • @samcameron6734
    @samcameron6734 4 роки тому

    So, instead of setting password to the correct string, you pass an object that evaluates to true?

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

    I can't find video where you solve first chalange ("Hardware"), can you send me a link to that video please?

  • @krztix
    @krztix 4 роки тому

    at 7:25, i don't see any checks for the given parameters u and p
    can't you do a SQL Injection here?

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

    what subjects/programmes best to learn to begin hacking?

  • @kennyng6568
    @kennyng6568 4 роки тому

    Hello, john. I am new here. May I ask how do you got a build output while editing your python script (starts from 14:06 to 15:04)

    • @twistedspirit
      @twistedspirit 4 роки тому +1

      There is a package called buildview, it can be used to show build output in a separate file as he does here.

    • @twistedspirit
      @twistedspirit 4 роки тому +1

      you just have to hit the build command(Ctrl+B) again every time you change the script.

    • @kennyng6568
      @kennyng6568 4 роки тому +1

      Thx so much

  • @jimbuckley341
    @jimbuckley341 4 роки тому

    Does anyone know a video or link to a video of Johns that explains the process of downloading/extracting the page source? It was gone over around 2:25 in the video but he said 'hes already downloaded the source' and simply extracts it. i've tried this in the past and usually get the html source after the code has been interpreted by a browser, rather than the raw source like he has. thanks!

  • @SimonHuenecke
    @SimonHuenecke 4 роки тому +2

    John, we both know it’s pronounced ”sea-surf”

  • @naveennirban
    @naveennirban 4 роки тому

    not boring dude at all

  • @Spongman
    @Spongman 4 роки тому

    Talking about the code and your thought process, not boring. On the other hand... constant interruptions talking about the length of the video, how we can stop if we want, and how we may be perceiving it...

  • @no-qm1gs
    @no-qm1gs 4 роки тому

    What distro are you using ?

  • @rakenso
    @rakenso 4 роки тому

    How bad did you cry John? your eyes looks red.

  • @akustevanry4386
    @akustevanry4386 4 роки тому

    In my opinion when pass object variable with keys into js it will without qoute, so it translate into sql language to this 'select * from users where username="michelle" and password=username' it means 'password' equal to 'password' in same row where username="michelle" #cmiww

  • @mahmednabil2429
    @mahmednabil2429 4 роки тому

    it's a very helpful and cool vedio

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

    what about 1 'or' 1 '=' 1 in password field and michell in username field SQL Query: SELECT * FROM column_name where username = michell AND password = 1 'or' 1 '=' 1
    1 is not the valid password, but 2nd statement is true ( 1 = 1 )

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

      👆👆 for your account recovery he's the best and reliable indeed you're trustworthy💯💯

  • @z08840
    @z08840 4 роки тому

    "username=michelle&password[username]=" - works just fine
    and you can do it just from chrome using devtools

  • @Zecr
    @Zecr 4 роки тому

    Just play Fearless at the end :)

  • @AniltonNeto
    @AniltonNeto 4 роки тому

    16:38 to 19:53 has the CTF flag :D

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

    amzg
    claps and TY

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

    Erorr cocokis cap to pist ?

  • @prasadbroo
    @prasadbroo 4 роки тому +5

    Bro you should make ethical hacking series to learn haking

  • @helluci6449
    @helluci6449 4 роки тому

    So 'password[username] = anything' means whatthefu..? :D

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

    21:13 I don't mind

  • @jialx
    @jialx 4 роки тому

    I don't get this video. Are you acting like you don't know the answer like a recreation of what someone would do for this CTF or is this you doing it for the first time? Just because you keep flipping from not knowing and exploring to being certain and just putting in the answer in seemingly by accident... I am genuinely confused.

  • @code4720
    @code4720 4 роки тому +2

    who else is still noob

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

    you look like ippsec 🤔

  • @Hackedpw
    @Hackedpw 4 роки тому

    K

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

    login mi.chelle

  • @allahschild9088
    @allahschild9088 4 роки тому

    commen for ytalg

  • @roberts1711
    @roberts1711 4 роки тому

    Not watched this yet. But last 2 i watched this guy couldnt do but basically made a vid "teaching" while following another persons write up.
    If same happens here im giving up on this channel