MAJOR EXPLOIT: GitLab was Hacked with an IMAGE??

Поделиться
HTML-код
  • Опубликовано: 19 июн 2024
  • Try SquareX for free today! 👉 sqrx.io/db_yt
    In this video, we take a deep dive into the GitLab / ExifTool metadata parsing vulnerability, which enables attackers to gain access to GitLab servers via an RCE (remote code execution). Whether you're a pen tester, security researcher, or cyber security expert, having a solid foundation in escape sequences, code evaluation, and character parsing is critical.
    JOIN THE DISCORD! 👉 / discord
    0:00 - Overview
    0:26- Metadata
    1:59 - DjVu
    2:34 - C Escape Sequences
    4:18 - Structure
    11:14 - Exploit
    13:45 - SquareX
    Hackerone report
    hackerone.com/reports/1154542
    William Bowling’s report
    devcraft.io/2021/05/04/exifto...
    Vulnerable code
    github.com/exiftool/exiftool/...
    Patch
    github.com/exiftool/exiftool/...
    SquareX socials:
    Twitter: / getsquarex
    LinkedIn: / getsquarex
    Instagram: / getsquarex
    Facebook: / getsquarex
    Blog: labs.sqrx.com/
    MUSIC CREDITS:
    LEMMiNO - Cipher
    • LEMMiNO - Cipher (BGM)
    CC BY-SA 4.0
    LEMMiNO - Firecracker
    • LEMMiNO - Firecracker ...
    CC BY-SA 4.0
    LEMMiNO - Nocturnal
    • LEMMiNO - Nocturnal (BGM)
    CC BY-SA 4.0
    LEMMiNO - Siberian
    • LEMMiNO - Siberian (BGM)
    CC BY-SA 4.0
    LEMMiNO - Encounters
    • LEMMiNO - Encounters (...
    CC BY-SA 4.0
    #programming #software #softwareengineering #computerscience #code #programminglanguage #softwaredevelopment #hacking #hack #cybersecurity #exploit #tracking #softwareengineer #vulnerability #pentesting #privacy #spyware #malware #cyber #cyberattack #bugbounties #ethicalhacking #JPEG #encoding #lowlevelsecurity #zeroday #zero-day #cybersecurityexplained #bugbounty #memorymanagement #gitlab #security #cybersecurity #github #git #versioncontrol #breaches #databreaches #bug #bugbounty #pentesting #penetrationtesting #BeFearlessOnline #SquareX #Befearless&SecureOnline #Cybersecurity #Privacy #Security #Cybersec
  • НаукаНаука

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

  • @DanielBoctor
    @DanielBoctor  5 месяцев назад +17

    THANKS FOR WATCHING ❤
    JOIN THE DISCORD! 👉 discord.gg/WYqqp7DXbm
    👇 Let me know what type of bug bounty reports you would like to see next! 👇

  • @ArthurKhazbs
    @ArthurKhazbs 5 месяцев назад +1524

    Epic move from the GitLab team paying 100% bounty for a vulnerability in the code they didn't even write

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +361

      I know, GitLab made a good move. A good reputation among bug hunters can be very valuable.

    • @tg_2137
      @tg_2137 4 месяца назад +123

      You could argue that the way they validate file types is part of the exploit, at least on their end.

    • @hunchie
      @hunchie 4 месяца назад +71

      Very true, but it’s tough that it’s only $20,000. The sad reality is that such a “small” quantity means you rely on the morality of the white hat hacker rather than the economic incentive, since surely there are millions of dollars of potential payout for zero-day exploits on major SCM platforms in an immoral market.

    • @nostii
      @nostii 4 месяца назад +19

      @@hunchie i mean 20k is 20k, still a lot of money

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +57

      @huchie it's a real issue for sure. In September 2023, Operation Zero raised it's payouts for iOS and Android RCE exploits to $20,000,000. For comparison, the Apply bug bounty program is only offering up to $1,000,000 for the same type of exploit, if reported.

  • @jems5996
    @jems5996 4 месяца назад +409

    I think the inventor of PHP once said about eval: “If eval is the answer, you’re almost certainly asking the wrong question.”

  • @dealloc
    @dealloc 5 месяцев назад +671

    Anytime I see user input being passed to eval it sends shivers down my spine. There's always the question _when_ (not if) it will be exploited.

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +66

      yup, guess someone never learned about defensive programming 😔

    • @twitchizle
      @twitchizle 5 месяцев назад +39

      ​@@DanielBoctor i recently learnt that, you shouldn't trust user input even after successful database query, I'm not talking about SQL injection, I'm talking about character encoding.

    • @dealloc
      @dealloc 5 месяцев назад +1

      @@twitchizle Absolutely. God forbid you use regex, but in case you need to, you have to think twice before passing user input directly in to a regex without any form of sanitization. It will simplify the regex as well so you don't have to handle all kinds of edge cases that are likely to make it exploitable to ReDoS.

    • @MasterBroNetwork
      @MasterBroNetwork 5 месяцев назад +25

      Why do people use eval in production code in the first place?

    • @boomknuffelaar
      @boomknuffelaar 5 месяцев назад +8

      @@twitchizle
      Wait, shouldn't trust input after successful database query?
      Are you doing input validation after using the input to query a database?

  • @jalvrus
    @jalvrus 4 месяца назад +240

    As soon as you said "metadata", I was expecting a buffer overflow. Instead I got regex *and* eval. Double evil!

    • @brawldude2656
      @brawldude2656 2 месяца назад

      eval the oldest trick in the book still works time to time

  • @shrunkensimon
    @shrunkensimon 4 месяца назад +127

    Eval and regex together. Delicious.

  • @anon_y_mousse
    @anon_y_mousse 4 месяца назад +61

    It still amazes me how many people fail to adequately check user input. If you're reading something that comes from an external source or that can be modified by a user of the system, that is most definitely user input and should be checked.

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

      Im glad it wasn't sanitized and they deserve it.

  • @AM-yk5yd
    @AM-yk5yd 4 месяца назад +160

    I was ready to write snarky "wouldn't happen in Rust", but the bug is so bizarre, it wouldn't happen in C.
    In fact using eval seems like a clever trick. And "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it" comes from Kernighan himself.

    • @robertkiestov3734
      @robertkiestov3734 4 месяца назад +1

      You will never be a woman

    • @KryptLynx
      @KryptLynx 2 месяца назад +1

      Well using "eval" for anything but executing code from string violates "minimal authority" principle. Also, I pretty sure, djvu's list of escaped symbols do not match perl's list of escaped symbols

  • @thegreatbambino3358
    @thegreatbambino3358 4 месяца назад +27

    Im surprised they didnt just rm -rf their db1 again to solve the problem

  • @VaguerGolf05
    @VaguerGolf05 5 месяцев назад +127

    This is hugely interesting it’s crazy how people can find these over looked bugs

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +16

      Some of these bug hunters are on another level

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

      True, but this one could be found with grep. ANYTHING that calls eval is bound to have an issue like this. (I won't count the number of times I've seen this is stupid in "web applications" - perl, php, python, ...)

    • @s1nistr433
      @s1nistr433 5 месяцев назад +12

      There are so many microscopic bells and whistles you have to focus on while making a website, so many ways of remote code execution by some small file format from 20 years ago where the specific exif metadata allows for direct access to the database, like it's difficult even for an entire team of people.
      If making websites was more streamlined and didn't require so many random libraries and so much of the same repetitive manual labor we wouldn't have issues like this. Web frameworks do help but not nearly enough

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

      @@s1nistr433 And there's the problem: no one actually builds a website anymore, they just install and glue together whatever shiny they see. (and then ignore any security alerts / patches. Wordpress anyone?) That's what happened here. They grabbed EXIF and never cared to look at what it _can_ do.

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

      They likely just searched the opensource code for usage of "eval", and figured: I can hack that.

  • @teeesen
    @teeesen 5 месяцев назад +102

    13:44 The buggy code wasn’t fixed. It was made unexploitable; but the bug remains. As someone else mentioned, the simple and straight forward approach is to deal with escapes and finding the closing quote in one pass.

    • @Yolwoocle
      @Yolwoocle 4 месяца назад +6

      Would you mind explaining how? The eval call was removed

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +47

      It's sneaky, but @teeesen is right. It was a strange choice indeed.
      The underlying bug originated on line 227, which was due to the misuse of the dollar symbol within the regular expression. When you look at what was patched (full diff is in my description), no changes were made to line 227. Only the eval line was replaced. Technically, the bug still exists ($tok would continue to contain the same string), however it was made unexploitable due to the removal of the eval line, which is what caused the harm.
      You would need both lines to pull off the exploit.
      Link to the still present regex POST PATCH:
      github.com/exiftool/exiftool/blob/cf0f4e7dcd024ca99615bfd1102a841a25dde031/lib/Image/ExifTool/DjVu.pm#L227
      Link to the diff
      github.com/exiftool/exiftool/commit/cf0f4e7dcd024ca99615bfd1102a841a25dde031

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

      In the interest of pedantry: while the eval _call_ was removed, the /e modifier on the regex substitution means that the replacement half of the regex will be evaluated by Perl. What the new regex does is look up the escaped character in a hash table. If it's present, it substitutes in the corresponding value; if not, it leaves the escape sequence as-is (using short circuit evaluation).
      Presumably the more naïve solution would be preferable: consume the string character-by-character, keeping track of whether the preceding character was an unescaped backslash (using an escape sequence whitelist as they've done in their patch probably isn't a bad idea).
      I'm not sure if this would have a meaningful performance impact when parsing very large numbers of files. Regardless, security is more important.

    • @Jeff-ss6qt
      @Jeff-ss6qt 2 месяца назад

      ​​​@@DanielBoctorIf they then blindly deem the bug patched and the code secure, what would happen if they decide to directly use the output from the code somewhere else in another program?

  • @austingoodrich2193
    @austingoodrich2193 5 месяцев назад +40

    About 20 seconds in, I turned my headset up to max volume because I thought I was hearing the "Cicada 3301" video by LEMMiNo! Checked your description and saw the mentions, good choice!

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +15

      haha I know! He's an inspiration to me. It's cool that you picked up on it!

  • @IvanToshkov
    @IvanToshkov 4 месяца назад +29

    Thank you for the very informative video!
    Besides the horrific use of `eval` here, I can't understand why they used regexes for this in the first place. The whole escape processing and finding the closing quote can be done together with a single loop pass.
    There's must be a law that you have to use regex everywhere in Perl. Just take a look at the patch! (13:41).

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +12

      Glad you liked it! It definitely seems that it could have been done differently. It's already alarming enough when you find this commented directly above the function lol.
      # Notes: The DjVu annotation syntax is not well documented, so I make a number of assumptions here!

    • @nand3kudasai
      @nand3kudasai 4 месяца назад +5

      nice comment. ive seen people using regex becauae its 'fancy' but they themselves dont really understand it. and even if they do it makes it harder to understand for other devs, and more expensive to maintain. since now you require more knowledgable devs to deal with that.

    • @davestorm6718
      @davestorm6718 4 месяца назад +1

      Naturally, using eval for this task was a bad idea (or lazy), but don't put all your faith in regex. It's cool and saves a lot of dev time, but, honestly, it's kind of slow (and requires a lot of testing with different inputs when your match pattern gets really complex). Sometimes you have to just go back to the basic loops and simple tests (gasp!) - that eliminates ambiguity, but doesn't look as "cool" - though a potential exploit would reveal itself immediately (not so with regex). This is all relative to the skills of the dev for these high level functions we take for granted, of course.

    • @TheJamesM
      @TheJamesM 4 месяца назад +1

      I think it's a pretty good demonstration of how languages with roughly equivalent capabilities can lead people to code quite differently by way of the languages' respective design choices. Perl treats regular expressions as an integral part of the language to the degree that there are operators for regex matching and substitution. That doesn't necessarily correspond to any greater efficiency behind the scenes, but psychologically it feels that much more natural to use them. If nothing else, the resultant code will be shorter, which on some level feels like it ought to be faster.

  • @Rotem_S
    @Rotem_S 4 месяца назад +20

    DJVU isn't an obscure file format, it's the standard way to share things like book scans and is much better at that than PDF

    • @TheJamesM
      @TheJamesM 4 месяца назад +11

      Sounds like "specialist" would have been a better description.

    • @UJustGotGamed
      @UJustGotGamed 4 месяца назад +10

      i'd rather manually write an image in binary than try to edit a PDF so i'm sure it's better

  • @newwindserver
    @newwindserver 5 месяцев назад +112

    jeez this is horrible security, languages should not be able to evaluate code from user input during runtime, even if its *almost* always "safely" sanitized.

    • @HwSystems
      @HwSystems 5 месяцев назад +6

      So true, the laziness and carelessness of some programmer is astonishing.

    • @joe-skeen
      @joe-skeen 5 месяцев назад +15

      And especially not inside a library or tool that others consume without knowing what risks they are accepting.

    • @JorgetePanete
      @JorgetePanete 5 месяцев назад +2

      it's*

    • @dennisestenson7820
      @dennisestenson7820 5 месяцев назад +16

      It's not really up to the language to decide whether code should be executed or not. It doesn't know or care where the code came from. Even if it did, there'd be ways to subvert it.

    • @1p2k-223
      @1p2k-223 5 месяцев назад +4

      @@dennisestenson7820 like writing to a file, then using include to include it as code... if include is disabled, lots of stuff fails, and timestamp checking could cause other bugs, if it is intended behaviour, for example

  • @nicholasvinen
    @nicholasvinen 4 месяца назад +8

    That Perl code looks like something out of an obfuscated programming competition...

    • @einsteinx2
      @einsteinx2 4 месяца назад +3

      So basically just standard Perl then. 😂They don’t call it a write-only programming language for nothing!

  • @almightyhydra
    @almightyhydra 5 месяцев назад +35

    Ugh. Surely rather than using regex, just iterating the string one character at a time and figuring out the escapes along the way would be simpler, safer and faster?

    • @acters124
      @acters124 4 месяца назад +2

      It would be easier and safer to just grab the string, make sure the size is not too big, and iterate over the entire string, and convert them, Its entirely possible there are libraries already made for this. Not sure why this is what ended up in prod. eval sucks

    • @davestorm6718
      @davestorm6718 4 месяца назад +1

      I agree. Regex saves time and makes difficult parsing tasks easier. On the flip side, it has all that extra overhead to handle generalized cases. This means it is slower (a lot of throughput tests done over the years shows this to be true). For this particular task, it's overkill (like using a microcontroller to make a blinking light instead of single transistor).

    • @TheJamesM
      @TheJamesM 4 месяца назад +1

      Yeah, do it the way the specification is defined: left to right in atomic units.

  • @user-tv6sw3vt9q
    @user-tv6sw3vt9q 22 дня назад +1

    As soon as you mentioned metadata, my first thought was "somebody used it to inject code into memory." Sometimes the worst issues come from the simplest oversights.

  • @djh1455
    @djh1455 5 месяцев назад +3

    Great breakdown and step by step, thanks for the vid!

    • @djh1455
      @djh1455 5 месяцев назад +1

      (I personally lacked a lot of the regex and file extension vs file header nuances for this story. Great video! Subbed)

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +2

      Glad you liked it! Thanks for watching 😊. Glad you have you apart of the community

  • @TheControlMastr
    @TheControlMastr 4 месяца назад +2

    What an amazing video, always learning from you Dan! I missed the OG background music 😁
    The sandwich analogy is literally clutch, new way of looking into backslashes and quotes!

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +1

      Thank you @TheControlMastr! You're a real one for all the support. Thanks for watching 😊

  • @MyAmazingUsername
    @MyAmazingUsername 4 месяца назад +3

    Wow, the production quality is like a channel with 100k+ subscribers. I subscribed. This is awesome!

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +1

      Thank you! Glad to have you apart of the community. If you thought this one was good, just wait until my next one 😜

  • @camelotenglishtuition6394
    @camelotenglishtuition6394 5 месяцев назад +25

    Very well edited and very interesting ..thanks! **edit .. I wonder how long it took him to find that 0day

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +14

      Thanks! Glad you liked it 😊. Me too - these bug hunters are unreal. One day I hope to make one of these videos where I am the one who found the bug 😆

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

      @@DanielBoctor same!!

    • @camelotenglishtuition6394
      @camelotenglishtuition6394 5 месяцев назад +1

      @@DanielBoctor or sell it to zerodium and retire

  • @Bokatrice
    @Bokatrice 4 месяца назад +1

    This reminds me about how you used to be able to run console commands in Garry's Mod by sending a chat message containing ";
    ...because the chatbox just ran the 'say' command and you can cut the quote early. It's not sanitised.
    Then the semicolon tells the console that a second command is being typed. So, typing the following:
    man i'm dead"; kill
    would get interpreted as
    say "man i'm dead"; kill
    This no longer works as they now properly escape double quotes in the chatbox.

  • @purelaziness7095
    @purelaziness7095 3 месяца назад +2

    An offering for the algorithm gods. Keep it up!

  • @pabloenriquegorga4222
    @pabloenriquegorga4222 5 месяцев назад +3

    An other master piece ! thanks you !

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +1

      Thank you too! Glad you liked it 😊

  • @saeedgnu
    @saeedgnu 4 месяца назад +6

    Running an external Perl program (or any script) in a non-isolated environment sounds very stupid! Specially since Perl is something between Bash and Python! And with low readability!

  • @cat-.-
    @cat-.- 4 месяца назад +19

    the hidden semantics in the $ of the regex is wild, but parsing a string literal with the approach showed in the video is still a clever trick. I only know to scan the literal and handle escape sequences on site. I will keep doing that though

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

    You deserve a lot more views!

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +2

      I can hope! Thank you for the support - I appreciate it

  • @mo938
    @mo938 4 месяца назад +1

    Excellent vid! Subbed!!

  • @SivaranjanGoswami
    @SivaranjanGoswami 4 месяца назад +1

    I expensively use regex when I need to analyze some text data on my local. But when I write a code for production, I avoid regex most of the time. I always feel safer to write string parsers manually.

  • @yux5188
    @yux5188 5 месяцев назад +4

    Good video thanks for making it daniel

  • @ayushmishra6077
    @ayushmishra6077 5 месяцев назад +7

    We need more people like you :simle:

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +2

      Glad to have you apart of the community. Thanks for the kind words, keep on doing what you're doing 😊

  • @itaynafrin3409
    @itaynafrin3409 5 месяцев назад +4

    This is pure quality!

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +2

      Thank you! Glad you liked it

  • @sherpya
    @sherpya 4 месяца назад +5

    using eval to unescape strings 💀

  • @m.projects
    @m.projects 4 месяца назад +7

    3:39 RAM pictures are the old DIMM sticks, nice

  • @kingman351
    @kingman351 5 месяцев назад +4

    Wow! What an amazing video!

  • @mcrotbot
    @mcrotbot 4 месяца назад +2

    Awesome breakdown!

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

    Incredible! I used to write a lot of code in perl like 20-30 years ago but even then I would have never used the eval function on data which came from the outside. Actually I probably wouldn’t have used it at all because it is inherently dangerous. I can’t believe that this code was still present in a tool used in 2023.

  • @RuriYoshinova
    @RuriYoshinova 4 месяца назад +2

    A lot of people already told me how dangerous eval is, and I'm surprised that even big companies do this..

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +1

      Keep in mind that this was done in ExifTool, which is a 3rd party library that GitLab was using. They didn't write it themselves, but yeah, it shouldn't have been used regardless.

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

      @@DanielBoctor it is still their end though, they couldn't have used a tool that is vulnerable to exploits, or review them before even using it.

  • @MrHenryG123
    @MrHenryG123 4 месяца назад +1

    Mind boggling that Workhorse would determine filetype based off extension, like it isnt even difficult to implement a solution to fix that (i.e. just run it through `file` on most Linux distros).

  • @ndererseje1077
    @ndererseje1077 4 месяца назад +3

    I got a GitLab ad on this video 😂

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +2

      no way LOL. I didn't think they would be running ads on RUclips since they're main customers are enterprises.

  • @kevinwydler7305
    @kevinwydler7305 4 месяца назад +1

    Love your content!

  • @IlluminatiBG
    @IlluminatiBG 2 месяца назад

    Eval is quite useful for dynamic feature check, but it is often misunderstood and used for either data processing or breaking the boundary of trust. Everything passed to eval should come only from sources that already have execution access. But this specific usage of eval fails on both cases.
    Here there is another bug due to infinite loops. All data (especially untrusted data) should be under a length constraint. 1GiB of key or a value in a metadata is not valid metadata, parser loops passing such data should be finite and reasonably small.

  • @LT4141
    @LT4141 5 месяцев назад +3

    Good video

  • @TopchetoEU
    @TopchetoEU 5 месяцев назад +7

    regex and eval? seems like a recipy for disaster

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +2

      couldn't have said it better myself

  • @Neproxan
    @Neproxan 5 месяцев назад +1

    Very entertaining!

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +1

      Thanks! Glad you liked it 😊

  • @netomtoloko01
    @netomtoloko01 4 месяца назад +6

    I'm really thinking about move to cybersec at the moment, but these clever moves looks so fun and so scary at the same time...
    thanks for the explanation!

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

      Cyber is definitely a blast. Glad you enjoyed the video!

  • @Jango1989
    @Jango1989 4 месяца назад +1

    This is a brilliant video!

  • @myname-mz3lo
    @myname-mz3lo 5 месяцев назад +3

    20 k is so little for how importand of a bug he found .

  • @brocolliduck
    @brocolliduck 4 месяца назад +1

    Nice video

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

    Also you forgot .MP3 files that display the cover art album artist name release date genre number on the album which disc it is on

  • @forty4seven46
    @forty4seven46 4 месяца назад +14

    I really enjoy your videos! However, I suggest slightly lowering the volume of the background music to enhance the overall experience. 😅
    Keep up the fantastic work! ❤️❤❤

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +2

      Thank you!! I appreciate the support ❤. Means a lot

  • @llynnmarks3382
    @llynnmarks3382 5 месяцев назад +2

    Great video but I wonder how I could understand this at a deeper level. If I had to explain this I'd find it challenging.

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +2

      Interesting comment - would you say this was because of how I made the video? Would there be anything you suggest I do differently?

  • @brawldude2656
    @brawldude2656 2 месяца назад

    Tbh I wasn't expecting it to be this simple. Sometimes some things are really over looked

  • @kirillt9009
    @kirillt9009 4 месяца назад +1

    Good work.

  • @yoyoma2831
    @yoyoma2831 5 месяцев назад +1

    Amazing!

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

    It always amazes me how big part of all exploits are running user input string as code

  • @Mitch-xo1rd
    @Mitch-xo1rd 5 месяцев назад +7

    I might superstitious, but eval should NEVER be used in production code. Especially with user input, "sanitized" or not. No exception.

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +2

      It should definitely be avoided whenever possible. It's not only a massive risk, but also unnecessary most of the time.

    • @marsovac
      @marsovac 5 месяцев назад +3

      Never is a hard word. WOuld you also say that user provided data should never be sent to SQL?
      You just need to correctly escape and sanitize the data. But you need it, you cannot avoid using it.
      If you don't you get SQL injection, or in this case unautorized code execution. It could have been avoided here, but there are use cases where it is needed by design (eg. scripting).
      In this scenario the process running Exif also should never have had permission to run system calls, which exif doesn't need, but that is beside the point, a last measure of protection when all rest fails.

    • @ratchy1231
      @ratchy1231 5 месяцев назад +3

      ​@@marsovac In SQL you can also use parametrized queries instead of escaping user input inside a query string. I think that's the safest choice.

    • @marsovac
      @marsovac 5 месяцев назад +1

      @@ratchy1231 i know, but that is the same thing, except you don't do the escaping yourself, but let it to a framework.

    • @ratchy1231
      @ratchy1231 5 месяцев назад +2

      @@marsovac Technically parameterized queries/prepared statements are made in a way that user input sanitization is not necessary, as the statement and the parameters are processed completely separately, bypassing the problem of SQL injection altogether. I only wanted to mention this to remind everyone that even SQL doesn't require an "eval". Sanitizing string input works well but you never know, someone could find a way to escape it under weird circumstances!

  • @bringbackwindowsphone
    @bringbackwindowsphone 4 месяца назад +2

    Loved the video! Just wanted to point out that WhatsApp is native instead of Electron as of mid 2023.

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +2

      Thanks! Also good catch, thanks for pointing this out. I stand corrected. Also, did you comment this on the wrong video? lol

    • @bringbackwindowsphone
      @bringbackwindowsphone 4 месяца назад +1

      @@DanielBoctor HUH HOW DID THE COMMENT END UP HERE WHAT??? Maybe it autoplayed while I was typing it lol

  • @Mmouse_
    @Mmouse_ 2 месяца назад

    Second I heard "Eval" I chuckled.

  • @SuperPupperDoggo
    @SuperPupperDoggo 4 месяца назад +2

    you say that disposable browser is free… what’s the catch?

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +1

      Right now, SquareX is pre earnings startup. They're running on funding they raised apart of a seed round led by Sequoia Capital. In the future, they plan on launching a paid version of their service, however they will always offer a free tier, even after monetization.

  • @mohammadthamyizna8036
    @mohammadthamyizna8036 2 месяца назад

    damn, i thought i'm watching the same video, when that "on april 7th 2021" came in. it looks definetrly the same as, the other video with "on april 7th 2020"

  • @NeverGiveUpYo
    @NeverGiveUpYo 5 месяцев назад +1

    Cool video.

  • @lancemarchetti8673
    @lancemarchetti8673 4 месяца назад +1

    Brilliant!

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +2

      Brilliant indeed. Thanks for watching!

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

      @@DanielBoctor I thought I'd give this Jpeg metadata thingy a try in Notepad++ , here is my little effort...
      aS5wb3N0aW1nLmNjL3E3anpNQjNyL1dob3MtYXQtdGhlLURpbmVyLmpwZw

  • @PKua007
    @PKua007 4 месяца назад +1

    I just got to the part with “eval-ing” the string just to process escapes. I facepalmed hard and even though I didn’t see the rest of the video yet, I’m pretty sure this is the problem

  • @The_Last_Question
    @The_Last_Question 4 месяца назад +2

    Title made me think of an old psp exploit that used .tiff images

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +2

      interesting, never heard of that one before

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

    Jeez, and I thought my codes are bad

  • @beepbop6697
    @beepbop6697 4 месяца назад +2

    8:10 eval -- oh no. Just no. Never execute anything that is untrusted!!

  • @MorgurEdits
    @MorgurEdits 3 месяца назад +1

    Your sponsor actually seems interesting. Rarely do I hear useful sponsors.

  • @FadkinsDiet
    @FadkinsDiet 2 месяца назад +1

    The video sequences when nothing is happening, are those AI generated or stock? Looking very professional.

    • @DanielBoctor
      @DanielBoctor  2 месяца назад +1

      They are really well done indeed. They come from a collection of "Visualising AI" animations from Google DeepMind. Here is the source if you want to check it out!
      deepmind.google/discover/visualising-ai/

  • @ainiro
    @ainiro 4 месяца назад +1

    What a ridiculous algorithm. You can scan forward until you find the first ", then if you find a \, you just read the next character raw, without checking for ". The algorithm is fundamentally flawed ...

  • @eclypze_
    @eclypze_ 4 месяца назад +1

    11/10 explanation

  • @SuperPupperDoggo
    @SuperPupperDoggo 4 месяца назад +1

    honestly I think you should have to use a flag when executing to enable eval (i.e. ‘python whatever.py --enable-eval-unsafe’). I guarantee this would not have passed review if that were the case.

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

      you could say that about every language feature though

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

      @@thewhitefalcon8539 but eval in particular because as you’ve seen, it is not a question of *if* but *when* it will be exploited if the code interacts with data from users basically at all. It is literally Arbitrary code execution, which when exploited is generally considered the most severe vulnerability possible. The only reason to use eval is if the input will change in ways that cannot be accounted for by just writing the code normally, and since there is almost always a way to do something without eval, this means there is only a very slim number of cases where it is truly necessary, and given the known potential for security disasters, programmers should be forced to either find a way around using it, or have to explain to anyone who runs the code why it really is necessary. This would make sure anyone running the code knows that it uses eval without having to look through every line of code, and then they can make their own decision from there.

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

    Many years ago I heard the phrase "eval is the root of all evil" when using eval in JS. Still true.

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

    as soon as I saw eval I understood that code injection was possible, argh!

  • @ElChapoDel8
    @ElChapoDel8 4 месяца назад +2

    20.000 dollars for that? What a rats

  • @samgoodwin89
    @samgoodwin89 2 месяца назад +1

    20k is too cheap. He deserves 200k

  • @guujjlu
    @guujjlu 5 месяцев назад +3

    Love

  • @bra1nsen
    @bra1nsen 4 месяца назад +1

    Wow!

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +1

      wow indeed. thanks for watching!

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

    Either heavily sanitize the input, strip all and recreate it from scratch, take whole words and no strings, remove all floating point numbers or round up numbers, remove all tags besides date and name.
    The f are they doing.

  • @minibun04
    @minibun04 4 месяца назад +2

    LEMMINO MUSIC !

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

    I'm am getting this video in my notifications now? That attack will work as you hitting the lottery now days.
    The vulnerability was in djvu that doesn't work anymore

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

    i sense GitHub roast coming

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

    eval in a parser. genius

  • @jacobjayme6280
    @jacobjayme6280 5 месяцев назад +15

    Dan delivers phenomenal content again. Make sure to subscribe so we can have the most ultimate world changing ping pong game you have ever seen.

  • @Twisted_Code
    @Twisted_Code 4 месяца назад +1

    2:00 I have a guess where this is going:
    is one of the metadata tags in djvu (and supported by EXIF) a "run this thing" tag?

    • @Twisted_Code
      @Twisted_Code 4 месяца назад +1

      4:15 Seems my guess is probably wrong. New guess: Buffer overflow in the code that interprets the C-string

    • @Twisted_Code
      @Twisted_Code 4 месяца назад +1

      7:40 I'm now uncertain, since this part of the video dealt with RegEx, and there's frankly a lot of ways to mishandle RegEx. The algorithm looks solid, but I don't use RegEx enough to be certain.

    • @Twisted_Code
      @Twisted_Code 4 месяца назад +1

      7:50 wait, what happens if the string never has a true closing quote?

    • @Twisted_Code
      @Twisted_Code 4 месяца назад +1

      8:15 (This is the comment where, as the video predicted around 10:15, I confidently assumed "eval is evil" and was not yet aware of the qq. Obviously I'm getting ahead of things, so while I basically see where this is going, I'm not going to make any more predictions on how they escaped the string.)

  • @tomtravis858
    @tomtravis858 5 месяцев назад +1

    Honestly that code just smells, multiple regex, eval, commented out code.

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

    Interpolate doesn't mean the same thing as interpret.

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

    8:10 IT'S A FOUR-LETTER WORD

  • @Janos0206
    @Janos0206 28 дней назад +1

    truly the root of all eval

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

    is square x adblockers able to stop the effects of youtube crackdown on ad blockers?
    it seems as youtube is somehow able to detect adguard.

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

      That was adguard itself malfunctioning

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

      Hello, we have uBlock Origin built into our extension, which works perfectly with RUclips.

  • @ruhruhruhruhruheisjsij
    @ruhruhruhruhruheisjsij 5 месяцев назад +8

    For someone who knows their shit like this, youd figure they would do a lot more with SEO. Which you should. Because you deserve way more views than this

    • @DanielBoctor
      @DanielBoctor  5 месяцев назад +2

      I appreciate the support LOL. I'm trying my best

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

    $20k for these exploits are chump change compared to the potential damage they could cause. Surprised bounty hunters put up with it.

    • @DanielBoctor
      @DanielBoctor  4 месяца назад +2

      yup, it's a real issue. In September 2023, Operation Zero raised it's payouts for mobile RCE exploits to $20,000,000. For comparison, the Apply bug bounty program is only offering up to $1,000,000 for the same type of exploit, if reported.

  • @user-hd3pz2ow1b
    @user-hd3pz2ow1b 3 месяца назад

    nice

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

    RCE - Remote code execution

  • @ankk98
    @ankk98 4 месяца назад +1

    Eval is the biggest evil

  • @christopherstaples6758
    @christopherstaples6758 4 месяца назад +1

    well worth the $20k

  • @AshkanKiani
    @AshkanKiani 3 месяца назад +1

    “Written in perl” say no more fam.

  • @juicygirls3989
    @juicygirls3989 5 месяцев назад +3

    if the product is free, then you are the product, regarding your "private" browser

  • @Will-uv9kx
    @Will-uv9kx Месяц назад

    I thought your yt name was doctor boctor