Тёмный

32-bit x86 LINUX BUFFER OVERFLOW (PicoCTF 2022 #31 'buffer-overflow1') 

John Hammond
Подписаться 1,9 млн
Просмотров 51 тыс.
50% 1

Help the channel grow with a Like, Comment, & Subscribe!
❤️ Support ➡ j-h.io/patreon ↔ j-h.io/paypal ↔ j-h.io/buymeac...
Check out the affiliates below for more free or discounted learning!
🖥️ Zero-Point Security ➡ Certified Red Team Operator j-h.io/crto
💻Zero-Point Security ➡ C2 Development with C# j-h.io/c2dev
👨🏻‍💻7aSecurity ➡ Hacking Courses & Pentesting j-h.io/7asecurity
📗Humble Bundle ➡ j-h.io/humbleb...
🐶Snyk ➡ j-h.io/snyk
🌎Follow me! ➡ j-h.io/discord ↔ j-h.io/twitter ↔ j-h.io/linkedin ↔ j-h.io/instagram ↔ j-h.io/tiktok
📧Contact me! (I may be very slow to respond or completely unable to)
🤝Sponsorship Inquiries ➡ j-h.io/sponsor...
🚩 CTF Hosting Requests ➡ j-h.io/ctf
🎤 Speaking Requests ➡ j-h.io/speaking
💥 Malware Submission ➡ j-h.io/malware
❓ Everything Else ➡ j-h.io/etc

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 81   
@LowPolySkull8303
@LowPolySkull8303 2 года назад
Thanks John for uploading this writeup. I'm embarrassed to say that I spent 5 days trying to solve this one and looking that the "print" command was to blame, made my jaw drop. Love your content and I have to admit that you've been my inspiration to pursue a career in cybersecurity
@teodorzhelev7181
@teodorzhelev7181 2 года назад
my first time ever i understood the whole logic of buffer overflow
@Desker_
@Desker_ 2 года назад
Literally the first content I've seen about buffer overflow that was so incredibly well explained that made me get really interested in learning more about it. This video doesn't even feel like it's 44 minutes long, I could watch way more of you teaching this super interesting stuff
@elijah2863
@elijah2863 2 года назад
There are videos that discuss stack over follow / buffer overflow and more variables. Just gotta know what to look for, this information has been out for many many years! Has a lot to do with network administration and active directories. Heck I'm surprised there hasn't been any CTF for buffer under run. I reported the security threat the second I figured I could gain full privilege to a server and reroute traffic. Sad part is I had no idea about bug bounty programs and since big shot did or else I'd be rich lol
@Joel-gf4zl
@Joel-gf4zl 2 года назад
@@elijah2863 are you a poorly written bot?
@joeyshi2114
@joeyshi2114 2 года назад
Fascinating stuff! Really shows how all these different Linux programs can be used to solve and debug a larger problem
@m4rt_
@m4rt_ 2 года назад
Thanks for explaining everything in a noob friendly way. I will be forever grateful
@Marc-yy9mo
@Marc-yy9mo 2 года назад
Fantastic Unreal content John. Could've been 3 hours and still entertaining and informative.
@mrhappytroll
@mrhappytroll 2 года назад
This was a good one, learned a lot, been watching all of these in order lol
@shivasijwali6779
@shivasijwali6779 2 года назад
This my first time seeing a buffer overflow and u explained it very well sir and total get it Your explanation is great always ❤️😇
@mahkhi7154
@mahkhi7154 2 года назад
The Computer has a Limited Number of PROCESSOR Registers (or Variables) e.g. EAX, EBX. When you Jump to Run another Function, those Registers (Variables) need to be saved on the Stack. The next function can then use EAX, EBX registers or Variables. When the Function finishes and Returns to the previous Function, Variables from the STACK are copied to EBX, EAX and Instruction Pointer, so the previous function can run.
@jorjo1061
@jorjo1061 2 года назад
Incredible stuff and fantastic explanation, you're a great teacher john
@yajusgakhar6969
@yajusgakhar6969 2 года назад
I usually don't say stuff like this, but I'm a fan of your videos.
@lfcbpro
@lfcbpro 2 года назад
THIS is what I wanted to learn, great content and explanations, finally understood some of the concepts. Enjoyed the programming walk thru too.
@georgehammond867
@georgehammond867 2 года назад
argparse is soo hard > you make it look easy, great work from John.
@bladesvlogs4965
@bladesvlogs4965 2 года назад
Melted my brain 😂😂
@chadgomez8508
@chadgomez8508 2 года назад
Your vids are awesome !!!
@ShootingUtah
@ShootingUtah 2 года назад
I sort of prefer to think of everything in terms of activation records and dynamic links to other activation records. For some reason it's easier to wrap my mind around everything.
@ozorg
@ozorg 2 года назад
great info! thx 4 uploading.
@animzex1257
@animzex1257 5 месяцев назад
that python programming was hectic
@rasraster
@rasraster 2 года назад
Awesome video, loved what you showed. Interesting how big a leap in required knowledge and skill this entailed. Are you sure there wasn't a simpler solution?
@KCM25NJL
@KCM25NJL Год назад
A slightly more efficient method of finding the offset is to generate a fairly large string of characters that never repeat the same 2 bytes, pass it into the app that you started with a debugger, then check the EIP register and read out the little endian format of the string. Search for that as a substring of the original string you generated, et voila.... count the bytes prior and you have your offset without trial and error.
@shadman1911
@shadman1911 2 года назад
Great stuff! this makes me fell extra noob
@abitterberry2149
@abitterberry2149 2 года назад
That was a fun challenge!
@FunkadelicFeed
@FunkadelicFeed 2 года назад
38:51 what's “I believe button" ?
@muhammadosama3358
@muhammadosama3358 2 года назад
what if the binary was stripped? how will we find the address of the function then?
@liudvikasstankus
@liudvikasstankus 2 года назад
can you please do more malware analysis videos
@DingDong-rc1ox
@DingDong-rc1ox Год назад
someone HELP ME PLEASE........i type "./ vuln" then after that it show this "-bash: ./: Is a directory". at minute 2.15 in this video......what i must do?
@animzex1257
@animzex1257 5 месяцев назад
dont give space after ./ vuln rather write it ./vuln
@fusillator
@fusillator 2 года назад
I don't get why the win function address is the same on both hosts, your local machine and the remote server, couldn't the win function be allocated in different addresses on memory of different hosts (also disabling aslr)?
@fusillator
@fusillator 2 года назад
I think im a stupid. it will be the same because its the virtual memory address, and it will be mapped on the appropriate physical memory by the os.
@HAGSLAB
@HAGSLAB 2 года назад
Well, you're not stupid, because you answered your own question correctly ;)
@fooyager
@fooyager Год назад
because there were protection called PIE/ASLR, which is will randomization the address but in this binary the protection are disabled so the address will be the same
@Noflexing100
@Noflexing100 2 года назад
A unique analogy I like to think of it as is say someone’s normal appetite. They’re normally able to comfortably eat 3 slices of pizza. You feed them 4, they may be able to handle it, feed them 5 they’ll start to feel sick, you feed them 6 and they’ll barf. Meaning you only saw them eat pizza but now thanks to throwing up overflowing, you could see say spaghetti, corn.
@KCM25NJL
@KCM25NJL Год назад
The return value has been compromised :)
@afb9999
@afb9999 2 года назад
Who uses 32bit x86 in 22
@popooj
@popooj 2 года назад
Your python scripting skills is always so incredible!!
@ShootingUtah
@ShootingUtah 2 года назад
Little endian means least significant byte gets stored in the lowest memory address. Big endian means the least significant byte gets stored in the highest address needed for all the bytes or in other words the most significant byte gets put in the smallest address. Just remember little endian is least significant byte goes to lowest address and big endian is reverse of that.
@charlesnathansmith
@charlesnathansmith Год назад
It just tells you if the "little end" or "big end" comes first. For anyone wondering why on earth little-endian became a thing, it's because it simplifies mathematical operations for the processor. You always start with the least significant byte then carry to the more significant ones, so starting with the LSB in memory avoids having to count over from the beginning of it's storage to find the LSB, esp for inc or dec or other small operations that only occasionally will carry
@tonyitalia7798
@tonyitalia7798 2 года назад
Congratulations. A thousand congratulations. I'm looking forward to Buffer Overflow 3. I've tried everything, but it won't.
@sha16
@sha16 Год назад
Great video, thank you so much!
@CanadianMason85
@CanadianMason85 8 месяцев назад
Lol I literally just held the "K" button to test if I could overflow it at random and it spit the flag out.
@ThatOldGuyYouKnow
@ThatOldGuyYouKnow Год назад
Cyberchef also does endian swapping, so you can just dump in the address (shown as big endian), then it will give you the little endian rep
@AreeshaAftab-kk3nv
@AreeshaAftab-kk3nv 10 месяцев назад
I have a question, can this python script be used for other ctfs with ofcourse some modifications
@abdirahmann
@abdirahmann 2 года назад
stand up for once so that i can scan that QR code!!, you are killing me! 😮‍💨💀
@neilmeich
@neilmeich 6 месяцев назад
thanks
@mback3713
@mback3713 Год назад
Use awk
@earthlyelder
@earthlyelder 2 года назад
great
@CesSanchez
@CesSanchez 2 года назад
Best RET2WIN Beginner Masterclass I've ever seen in RU-vid. A massive Thank you for that!
@m4rt_
@m4rt_ 2 года назад
40:00 You forgot to use the offset variable.
@GreatLich
@GreatLich 2 года назад
Loooooo forgotten but remembered in our hearts.
@HAGSLAB
@HAGSLAB 2 года назад
Pretty detailed this one John, should be very good for the beginners. You go through a lot of the standard pitfalls here which is great.
@mahkhi7154
@mahkhi7154 2 года назад
buffer Overflows Exist for Speed Performance reasons. e.g. What is Your Favourite Number? You could simply check in code that the user only types two characters. To Stop the buffer Overflow attack. However, you cant do something like that for Reading a large XML or HTML file. it will Slow things down.
@charliebeaufils9281
@charliebeaufils9281 6 месяцев назад
You explain it very well! I speak french, and your explanations are clearer than the ones on my main language
@kobaltauge
@kobaltauge 2 года назад
This was a very good video. A little bit chunky in the explanation about the stack, but the rest was perfect. One comment. You defined the variable "offset" but forgot to use it. =) Thank you very much for your efford. BTW I didn't solve this challenge during the event.
@smokingone
@smokingone Год назад
what were the error codes it gave when it segfaulted? i'm curious as to what exactly happened. the first one gave error 14 in _vuln_ second one was error 6 in _vuln_ and the third was error 14 in _libc-2.33_ , was it a coincidence they had the same number or was it the same error on different programs? is there a way to get more details about an error code when working with something like this?
@m4rt_
@m4rt_ 2 года назад
So this is where "Stack Overflow" comes from
@flying_r1chman577
@flying_r1chman577 6 месяцев назад
for the first time I understand what a buffer overflow really is, thank you!
@GreatLich
@GreatLich 2 года назад
This is a good video i learned how buffer overflow's are actually made and what the \x byte characters actually are, thank you.
@drewzilla1263
@drewzilla1263 2 года назад
Excellent content! learned a lot on this one. Based on seeing the previous buffer overflow CTF, I tried passing various lengths of strings to the program and did manage to get it to crash, but I didn't know anything about how to get the address to the win function and pass that in. Thanks!
@rsinistic
@rsinistic 2 года назад
Excellent video and explanation. Thanks
@KarolinaRiddle111
@KarolinaRiddle111 Год назад
Your knowledge is astonishing!
@PeetHobby
@PeetHobby 2 года назад
Is this not to easy with the source code?
@muhammadosama3358
@muhammadosama3358 2 года назад
only thing that the source code help with was the use of gets/buffer size
@fooyager
@fooyager Год назад
You can still view the source code with decompile the binary but its not 100% similiar with original source code
@williamperry2074
@williamperry2074 2 года назад
Great video John, learned a lot and had fun watching. You make it all seem so easy!
@SnedgeJohn
@SnedgeJohn 2 года назад
Great as always! Enjoyed it a lot!
@汝風留名
@汝風留名 Год назад
I have a little bit confusion on the little endian part. If stack grows from high addr to low addr, memory address increases towards the high addr, and the return addr is just somewhere above buf variable, then, when passing AAA....\x f6 \x 91 \x 04 \x 08 to the program, shouldnt it read and store the inputs from the \x 08 to the \x 41? like low addr high addr | local var | return address of the function | \x 08 \x 04 \x 91 \x f6 \x 41 ......... \x 41 \x 00 Then, when the return address is overwritten, it should be the \x 00 \x 41 being written to the return addr first, rather than the \x f6?
@汝風留名
@汝風留名 Год назад
And also, why is the address of win() in local the same as the one on the server? shouldnt the win() has a different address to be called in the server?
@charlesnathansmith
@charlesnathansmith Год назад
Say your function gets called, so return address gets pushed to the stack and execution transfers to the beginning of your function. ESP is say 0x2000 now, which points to the first byte of the return address in memory It's a completely bare-bones function that doesn't save the frame pointer or set up any other variables, all it does is subtract 0x100 from ESP, to create a 100-byte local buffer starting at address 0x1900. If you start copying a string to your buffer, the first byte gets copied to 0x1900, the 2nd byte to 0x1901, etc. If you don't do any bounds checking, the 101st through 104th bytes you copy in will go in 0x2000 through 0x2003 and you've overwritten your return address Discreet numbers the processor saves are stored in little-endian on Intel systems. Buffers are generally copied in byte by byte in an incrementing loop
@charlesnathansmith
@charlesnathansmith Год назад
They gave out a pre-compiled executable with the challenge to ensure it was configured to be based at the same virtual address to make the challenge easier. Since it actually tells you the original return address during operation, you could actually still calculate the right address on the server if it were based differently but not changing from run to run.
@LoayMatar
@LoayMatar 2 года назад
Excellent explanation!
@AmanPatel-rv2it
@AmanPatel-rv2it 2 года назад
At 31 will watch it all !!
@petehinch3871
@petehinch3871 2 года назад
Well explained John
@DaniSpeh
@DaniSpeh 2 года назад
Exceptional !!!
@MsDuketown
@MsDuketown 2 года назад
It's GNU/Linux. And it's a framebuffer, not a linux buffer. And industry names 32-bit x86 simply Aarch64, so terminology related to hardware and software are less confused with platform and system concepts. So maybe a better name is a Unix buffer. Simple user mistakes by displaced devs but keep up the good work! Just work on your terminology conventions because using it like you do really sucks and kills people. (btw, your graphic terminology sucks even harder but that's not just a typical problem in the USA; it's global.)
@easternplatypus
@easternplatypus 2 года назад
holy shit, you need to go outside dude, touch some grass fr.
@HAGSLAB
@HAGSLAB 2 года назад
I'm pretty sure mixing up some terminology doesn't kill people 🤣
@jacoumata
@jacoumata 11 месяцев назад
Great video, thanks John
Далее
Exploiting C strstr Function (PicoCTF 2022 #37 'rps')
14:53
pumpkins #shorts
00:39
Просмотров 9 млн
Running a Buffer Overflow Attack - Computerphile
17:30
Pwntools ROP Binary Exploitation - DownUnderCTF
55:21
Buffer Overflow Hacking Tutorial (Bypass Passwords)
55:39
Buffer Overflow 101: Ep 1 - x86 Memory Fundamentals
8:43
Return Oriented Programming (PicoCTF 2022 #48 'ropfu')
35:09