why do hackers love strings?

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 พ.ย. 2022
  • Hackers have been trying to steal information since the beginning of the information age. Buffer overflow attacks have been one of the ways they do it. By taking advantage of logic bugs in programs, hackers have been able to get access to computers and steal information which they later sell on the dark web. Buffer overflows have been one of the most common ways they get in.
    In C, strings are a little weird. Because there is no length encoded with the string type, string functions in C are extremely easy to use incorrectly. When used in an unsafe way, hackers can abuse the way that functions call each other to give them access to your computer.
    🏫 COURSES 🏫 Learn to code in C at lowlevel.academy
    📰 NEWSLETTER 📰 Sign up for our newsletter at mailchi.mp/lowlevel/the-low-down
    🙌 SUPPORT THE CHANNEL 🙌 Become a Low Level Associate and support the channel at / lowlevellearning
    🛒 GREAT BOOKS FOR THE LOWEST LEVEL🛒
    C Programming Language, 2nd Edition: amzn.to/3OKh3q2
    Computer Systems: A Programmer's Perspective: amzn.to/3N3PqHe
    Blue Fox: Arm Assembly Internals and Reverse Engineering: amzn.to/4394t87
    Practical Reverse Engineering: x86, x64, ARM, Windows Kernel, Reversing Tools, and Obfuscation : amzn.to/3C1z4sk
    Practical Malware Analysis: The Hands-On Guide to Dissecting Malicious Software : amzn.to/3C1daFy
    The Ghidra Book: The Definitive Guide: amzn.to/3WC2Vkg
    🔥🔥🔥 SOCIALS 🔥🔥🔥
    Low Level Merch!: www.linktr.ee/lowlevellearning
    Follow me on Twitter: / lowleveltweets
    Follow me on Twitch: / lowlevellearning
    Join me on Discord!: / discord

ความคิดเห็น • 565

  • @anon_y_mousse
    @anon_y_mousse ปีที่แล้ว +1

    Most important message to be conveyed here,

  • @RobbCorp
    @RobbCorp ปีที่แล้ว +672

    Be really fun to see your 'secure' server broken live and record the actual memory. Great video!

  • @eluraedae
    @eluraedae ปีที่แล้ว +150

    In this reality some hackers love strings more than physicists.

  • @sledgex9
    @sledgex9 ปีที่แล้ว +335

    Technically you must read at most 63 bytes/characters. The 64th byte in the array is the null byte. And you need to remember to set it to null when creating the array.

  • @mk72v2oq
    @mk72v2oq ปีที่แล้ว +360

    And all this just because someone decided that extra few bytes for storing the length is too expensive.

  • @FreshSmog
    @FreshSmog ปีที่แล้ว +88

    You can always implement strings as structs and store the length data. It's C, you can do anything. Unfortunately, you still need to get the data back out pretty frequently as the usual null terminated char arrays in order to use other functions.

  • @jorgeherrera1074
    @jorgeherrera1074 ปีที่แล้ว +107

    Honestly there are no excuses for buffer overflows in your programs today. With all the tools available to devs you have no reason for this to still happen.

  • @ReptilianXHologram
    @ReptilianXHologram ปีที่แล้ว +134

    I think you should make a course on how to program in C securely/safely for beginners.

  • @Agryphos
    @Agryphos ปีที่แล้ว +98

    We should all be grateful that code is getting safter

  • @donjindra
    @donjindra ปีที่แล้ว +7

    As a C programmer I would never uses gets() in a professional program. I always bound check when copying to buffers.

  • @younesmdarhrialaoui643

    I have to say this channel is very, very, very good. You really are delivering quality wise.

  • @nick9198
    @nick9198 ปีที่แล้ว +52

    Remember to pass the -fno-stack-protector flag when compiling your C programs for added stack based security.

  • @coolbrotherf127

    That's why the newer secure versions of these input functions also include a max data value so they can ignore any input over the intended amount making them much more difficult to exploit with buffer over flows.

  • @RealNekoGamer
    @RealNekoGamer ปีที่แล้ว +19

    In Pascal-style strings, the length is encoded as a byte at string[0], or sometimes the first 2 bytes (first 2 indices). This is a practice that the Macintosh pre-Intel era used in its API, and how strings are usually stored in binary file formats.

  • @vladislavkaras491

    It was informative!

  • @garyhalsey7693
    @garyhalsey7693 ปีที่แล้ว +10

    Having just completed my CompTIA Network+, Security+ & PenTest+, this is a perfect example of the need for sanitisation of user input!!! Great video and you’ve just got a new subscriber!!

  • @hanzo2228
    @hanzo2228 ปีที่แล้ว +5

    great video ! how did you get the function description in c

  • @rodtronics771
    @rodtronics771 ปีที่แล้ว

    I am so glad your videos are short. Theyre so good.

  • @jamesleecoleman
    @jamesleecoleman ปีที่แล้ว +5

    This is great! I wish I had this years ago when I was learning more about Buffer Overflows for a pentesting cert. It took me like a year to actually perform my first BO but it was still messed up but it worked lol.