SQL Injection - Lab #12 - Blind SQL injection with conditional errors

Поделиться
HTML-код
  • Опубликовано: 28 сен 2024
  • In this video, we cover Lab #12 in the SQL injection track of the Web Security Academy. This lab contains a blind SQL injection vulnerability. To solve the lab, we perform a blind based SQL injection attack on the database that retrieves the password of the administrator user on the application.
    ▬ ✨ Support Me ✨ ▬▬▬▬▬▬▬▬▬▬
    Buy my course: academy.ranakh...
    ▬ Links ▬▬▬▬▬▬▬▬▬▬
    Long video: • SQL Injection - Lab #1...
    SQL injection Lab #11 video (previous video): • SQL Injection - Lab #1...
    SQL Injection | Complete Guide (theory video): • SQL Injection | Comple...
    Notes.txt document: github.com/rkh...
    Web Security Academy Video Release Schedule: docs.google.co...
    Web Security Academy: portswigger.ne...
    Rana's Twitter account: / rana__khalil

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

  • @RanaKhalil101
    @RanaKhalil101  3 года назад +2

    Interested in supporting me and gaining early access to the Web Security Academy videos when they're recorded? Consider buying my course: academy.ranakhalil.com/p/web-security-academy-video-series! ✨ ✨

  • @RanaKhalil101
    @RanaKhalil101  3 года назад +29

    After recording the video, I realized the SQL payload can be much more simple. We don't need a CASE expression in order for it to work. The following is the alternative payload:
    ' || (select TO_CHAR(1/0) FROM users WHERE username='administrator' and SUBSTR(password,1,1)='a')|| '

    • @ahmedsaleem9327
      @ahmedsaleem9327 2 года назад +3

      Great Video. Can we use AND instead of concatenation? i am unable to understand that why haven't we used AND

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

      @@ahmedsaleem9327 Yes. AND works as well.

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

      How does this ' || (select TO_CHAR(1/0) FROM users WHERE username='administrator' and SUBSTR(password,1,1)='a')|| ' --- works exactly?
      I mean, i think that if the SUBSTR is true then you will select the 1/0 and get the error message, which is what we want.
      But in the case that the password 1,1 is not A, then the clause is False, which is also leading to error, right?
      So how does this works?

  • @Zephyr-tg9hu
    @Zephyr-tg9hu 2 года назад +11

    Noticed that there were a couple people who were wondering why the solution for this lab uses concatenation:
    Doesn't matter what technique you use, this lab simply introduces a new technique that uses string concatenation instead of an equality check. You could just as easily do this lab using previous techniques.
    Eg.
    Instead of:
    '||(SELECT CASE WHEN (1=2) THEN to_char(1/0) ELSE '' END FROM dual)||'
    We could have:
    ' AND (SELECT CASE WHEN (1=2) THEN to_char(1/0) ELSE '' END FROM dual)=''--
    Concatenation simply leads to a more simple solution in this case, so it is quicker to use.

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

      ||(select+username+from+users+where+username%3d'administrator')|| this statment doesnt gives an internal error that means administrator exits in the table right ?

    • @user-h8m
      @user-h8m Год назад

      ​@@anirudhsaxena9214 i guess the purpose here is to get an error if you do not get it so the condition is true and passe to the second part of the condition -->' ' =blank
      It means that every think is alright and the administrator user does not exist.

    • @alla-turca
      @alla-turca 9 месяцев назад

      could we use the same payload as the previous video instead of trying to do 1/0 or case keyword? for example we did "and (select username from users where username = 'administrator') = 'administrator'--" wouldnt this work here as well? if not why?

  • @mahmoudchiboub8213
    @mahmoudchiboub8213 3 года назад +9

    Hi, can you please tell why did we need to use the concatenate operator in this case
    and why we didn't use the comment operator to ignore the apostrophe.

    • @MohammedAhmed-id1ry
      @MohammedAhmed-id1ry 2 года назад +1

      تقدر تعملها ب AND تقريبا مش هتفرق كثير بس ده تكنيك تاني

  • @marcschweiz
    @marcschweiz 2 года назад +1

    Great stuff Rana. I bought your course to support you! Thank you for your time on these videos...

  • @x7331x
    @x7331x 9 месяцев назад

    Amazing explanation of why the query for finding if the admin user exists works. Keep it up 👆 !

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

    Great work, your videos are really helpful.
    I just didn't understand why you decided to concatenate? Is this an obvious move for Blind SQLi?

  • @lollocanzo5633
    @lollocanzo5633 9 месяцев назад

    Hey, I have a question. Since in this case it's an Oracle database, not knowing the syntax, after having found the parameter vulnerable to injection and having made sure that it was vulnerable by seeing if it interpreted what was passed as a query, I passed everything to the sqlmap obviously specifying the injection point, is this a good thing in your opinion?

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

    Salamu Alaykoum Rana how are you?
    what an amazing walk through you make it as it was so easy!
    Unbelievable skills.
    Thank you by the way.
    Do you recommend learning SQL?
    I don't have much SQL Knowledge.
    Thank you again.

  • @user-h8m
    @user-h8m Год назад

    i barely understood the logic of this kind of sql injection in Oracle ...but what i would like to know if there is the same trigerreing errors for sql database ?

  • @Abhishekn._
    @Abhishekn._ 3 года назад

    nice explanations , waiting for the rest of the videos also

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

    Here's a very peculiar error-
    '|| (select CASE WHEN (1=1) THEN TO_CHAR(1/0) ELSE '' END FROM users where username = 'administrator' and LENGTH(password>100) ||--
    Using comments at the end with the concatenation doesn't work. However what does work is using comments without the concatenation string:
    ' || (select CASE WHEN (1=1) THEN TO_CHAR(1/0) ELSE '' END FROM users where username = 'administrator' and LENGTH(password>100) --
    Anyone know why that is?

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

    tks, amazing video!!

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

    can someone explain me the significance of ' ' not ' please i am confused in that

    • @user-h8m
      @user-h8m Год назад

      I guess the ' ' means that every thing is ok and does not display any message if the first condition is true..
      So it returns https 200

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

    Great!

  • @melantheoszimurri9981
    @melantheoszimurri9981 7 месяцев назад

    Why are your using solutions that go more inline with what the labs are teaching. There’s no way a beginner is going to know all of these different commands you are using.

  • @BigHeadEddie
    @BigHeadEddie 2 года назад +2

    I did the lab before this one called "Blind SQL injection with conditional responses". I didn't have to concatenate in that lab. I am not sure why concatenation was necessary in this lab. Can you explain?

  • @nvssairam5754
    @nvssairam5754 3 года назад +3

    Why cant we follow the same steps here what we follow in Blind SQLi with conditional response , because the difference of conditional error and response is that there if true we get WELCOME message else NO MESSAGE but here if true NO ERROR else ERROR. TYIA

  • @mih4743
    @mih4743 10 месяцев назад +1

    Excellent video.
    My eWPT cert is in 4 weeks, so can't thank you enough for your videos & effort of quality educationally content you put out.
    Method I found I'm able to learn, regardless of it being tedious ( the method, not content ), it allows retention for those struggling with the information sticking, because this stuff is hard lol but you've done us a great service:
    Method:
    1. Solo Attempt
    2. Watch Video ( as a lecture )
    3. Re-Attempt ( still without video )
    4. Complete with Video ( side by side )
    5. 3rd Attempt (without the video )

  • @shamanwolf1335
    @shamanwolf1335 3 месяца назад

    I had hard time understanding why we still get an error while 1=1 and we have a user called administrator. Then you explained how SQL queries worked and bingo! I instantly understood! Thank you so much!!

  • @PeterCoder02
    @PeterCoder02 5 месяцев назад

    Hi, Ms. Khalil. Can you help me figure out the difference between conditional response and conditional errors in SQL Injection, please? This confused me. Thanks.

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

    someone can explain to me why this challenge don't use this -- at the end of a sentence like other challenges

  • @adilhashmi7608
    @adilhashmi7608 4 месяца назад

    we can perform this attack's using ffuf tool

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

    Eagerly waited for your walkthrough

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

    did you just reupload this?

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

      Nope. This is the short version that will be linked to from the official Web Security Academy website.

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

    How i'Know the Type of database ?

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

    it took me three days to solve this lab😅😅😅

  • @moizbutt119
    @moizbutt119 8 месяцев назад +1

    Why we cant use AND statements in this scenario too like previous lab was pretty similar to this so why cant we use AND statements
    Thanks

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

    Hey Rana, Thanks for that amazing video explanation!
    Can you please explain how the function of 'TO_CHAR' is manifested on the query?

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

    Hi Rana
    Thanks for sharing such helpful videos but I need your help with this challenge
    I am using the below query to find the password length
    ' || (select CASE WHEN (1=1) THEN TO_CHAR(1/0) ELSE '' END FROM users where username = 'administrator' and LENGTH(password>1) ||
    ' || (select CASE WHEN (1=1) THEN TO_CHAR(1/0) ELSE '' END FROM users where username = 'administrator' and LENGTH(password>50) ||
    In both cases I am getting 500 response
    I am following the same steps which you have did in this video, can you please help me in this issue

    • @mohdaadilf
      @mohdaadilf Год назад +1

      Have you closed the query? From what you've posted, the syntax is wrong. You've an open quote-mark, but haven't closed it. Either add a single quote to comment out after the length function without concatenation.
      ' || (select CASE WHEN (1=1) THEN TO_CHAR(1/0) ELSE '' END FROM users where username = 'administrator' and LENGTH(password>1) || '
      or
      ' || (select CASE WHEN (1=1) THEN TO_CHAR(1/0) ELSE '' END FROM users where username = 'administrator' and LENGTH(password>1) --

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

      Just add ' at the end of the query

  • @7Arunkumar
    @7Arunkumar Год назад

    hi @rana Khali, I do watched your basic video, in previous video we used conditional responses and now we are using different one., can we use old method as well?

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

    how to exploit database MYSQL ? please give me video for exploit database mysql 🙏

  • @melisaozen4897
    @melisaozen4897 7 месяцев назад

    Perfect, love your detailed explanations! Thank you ☺ 🙏

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

    Thanks for this Ms.Khalil

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

    It will be really helpful if you could make a video to get a clear idea on DOM xss

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

    Thank you so much for these videos, they are easy to understand and learn!

  • @0xPr3d4T0r
    @0xPr3d4T0r 2 года назад

    Underrated channel👏

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

    08:30 i didn't understand why it doesn't work without rownum and why we used the rownum=1

    • @ZoMbiE4CoBRA
      @ZoMbiE4CoBRA 11 месяцев назад

      because the query will return ' ' for every entity in the users table, the returned query will be like this for example if there are 3 users:
      row Num |
      1 | ' '
      2 | ' '
      3 | ' '
      it is important to note that by i mean the ' ' in the select statement (select ' ' from users)

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

    Great video. Its really refreshing listening to a female voice in pentesting videos. So much nicer on the ears :) Also your explanations are on point and simple to understand. Keep it up :)