- Видео 19
- Просмотров 127 308
RazviOverflow
Добавлен 10 июл 2018
Exploit code, not people.
Reverse Engineering: Cutter installation, configuration and customization
Using a great reversing platform is key when it comes to making your life easier while trying to understand the intricate inner workings of any program. In this video, we will see how easy it is to install, configure and customize Cutter, a reverse engineering framework based on Rizin. Additionally, we will discuss and (hopefully) understand the changes introduced some versions ago about how variables are referenced. That is, the newer stack vs the older rbp/rsp - offset.
Cutter - cutter.re/
Cutter on GitHub - github.com/rizinorg/cutter
Reverse Engineering question on Stack Exchange - reverseengineering.stackexchange.com/questions/32317/cutter-shows-addresses-relative-to-stack-but-not-rbp-ho...
Cutter - cutter.re/
Cutter on GitHub - github.com/rizinorg/cutter
Reverse Engineering question on Stack Exchange - reverseengineering.stackexchange.com/questions/32317/cutter-shows-addresses-relative-to-stack-but-not-rbp-ho...
Просмотров: 3 517
Видео
Making stack executable with malicious mprotect call - pwn110 - PWN101 | TryHackMe
Просмотров 2,6 тыс.Год назад
Abusing a buffer overflow to craft a malicious call to mprotect(2) and change the stack protections making it executable in order to spawn a shell (shellcode). This will bypass the NX bit, which the binary was compiled with. Step-by-step resolution of the pwn110 challenge of TryHackMe's PWN101 room. We will also understand what an aligned address is by calculating the page boundary of the memor...
How to debug your exploit and payloads - Binary Exploitation PWN101
Просмотров 1,9 тыс.Год назад
In this video we will attach a debugger to our exploit and debug the various payloads and crafted inputs we may need in order to successfully exploit the binary. Debugging the exploit is extremely useful whenever you want to know if your payload is arranged in memory how you expect, or if you are parsing and correctly crafting a given payload. This technique is useful for every debugger, but es...
Exploiting Return to Libc (ret2libc) tutorial - pwn109 - PWN101 | TryHackMe
Просмотров 9 тыс.2 года назад
Return to libc (ret2libc) fully explained from scratch. In this video we will see and understand how to perform a ret2libc in a multistaged exploit. First, we will abuse a buffer overflow in order to hijack the execution flow and leak addresses from the global offset table (GOT). We will create a tailored ROP chain to jump to PLT, passing as parameters addresses from the GOT. Once we obtained t...
Exploiting Return Oriented Programming (ROP) tutorial - Binary Exploitation PWN101
Просмотров 23 тыс.2 года назад
ROP tutorial step by step, explained in detail. We will understand how Return Oriented Programming works and how to use this exploitation technique to abuse (exploit) vulnerable binaries. We will understand the theory behind the technique and later put it into practice by exploiting an actual challenge from ROPEmporium. In order to understand ROP, the most important thing is to understand what ...
GOT overwrite with Format String - pwn108 - PWN101 | TryHackMe
Просмотров 7 тыс.2 года назад
In this video we will see step by step how to overwrite GOT (Global Offset Table) entries by abusing a Format String vulnerability, hence hijacking the execution flow of the program. We will see in detail how to overwrite memory with the %n format specifier from the printf family of functions, understanding how to write 4 or less bytes with the values we desire at the address we want. Besides, ...
Global Offset Table (GOT) and Procedure Linkage Table (PLT) - Binary Exploitation PWN101
Просмотров 7 тыс.2 года назад
In this video we will see how the Global Offset Table (GOT) and the Procedure Linkage Table (PLT) work together in order to make the execution of the binary possible. We will dig into the GOT and PLT from a binary exploitation (PWN) perspective, aiming at understanding how attacks like ret2plt or GOT overwrites are carried on. We will also debug the invocation of the Dynamic Linker when it is t...
PIE and Canary bypass with Format String - pwn107 - PWN101 | TryHackMe
Просмотров 7 тыс.2 года назад
Bypassing stack canaries and PIE/PIC by abusing a Format String vulnerability. In this step-by-step tutorial we will understand what a canary is, what is its main purpose and how can we bypass it in order to hijack the program's execution flow. At the same time, we will dig into Position Independent Executable (PIE) or Position Independent Code (PIC) and learn how to bypass it as well, exploiti...
Exploiting Format String vulnerabilities tutorial - pwn106 - PWN101 | TryHackMe
Просмотров 6 тыс.2 года назад
Understanding the format string vulnerability step by step in this thorough tutorial explaining its very foundations, the underlying concepts. How do format string vulnerabilities happen, why and how can we abuse them. Format String vulnerabilities allow an attacker to both leak memory and corrupt it by writing arbitrary values. In this video we will learn how to leak memory by abusing a Format...
Shellcode Execution (ret2shellcode) - pwn104 - PWN101 | TryHackMe
Просмотров 5 тыс.2 года назад
Hijacking the program's execution flow in order to execute our payload, which conveniently corresponds to assembly instructions/code that spawn a shell (Shellcode), an attack that is commonly referred to as ret2shellcode or simply shellcode execution. This time we are abusing a buffer overflow caused by the misuse of read. The address of the buffer on the stack (where we want to jump to in orde...
Exploiting Integer Overflow (IOF) / Underflow tutorial - pwn105 - PWN101 | TryHackMe
Просмотров 3,6 тыс.2 года назад
We will see what an Integer Overflow (IOF) is and how to abuse them. Exploiting an integer overflow so as to spawn a shell. In this video we are exploring the binary world and how the CPU treats numbers. We will discuss their representation in memory (both positive and negative numbers) and how basic arithmetic (addition and subtraction) is carried out, which will inevitably lead us to integer ...
Buffer Overflow to Modify Variable Values - pwn102 - PWN101 | TryHackMe
Просмотров 6 тыс.2 года назад
Overflowing a buffer due to the use of scanf function. We are overwriting memory in such a way that we're placing specific values at specific addresses hence spawning a shell. Step-by-step tutorial solving pwn102 from PWN101 binary exploitation room on TryHackMe. Endianness video: ruclips.net/video/T8E_JRqN0fY/видео.html PWN101 Room: tryhackme.com/room/pwn101 Binary Exploitation PWN101 Playlist...
Intro - Binary Exploitation (PWN101) room on TryHackMe
Просмотров 4,2 тыс.2 года назад
Welcome to PWN101 video series. We will see how to solve Binary Exploitation (PWN101) room from TryHackMe. Join me in this new stack-based pwn adventure! PWN101 Room: tryhackme.com/room/pwn101 Binary Exploitation PWN101 Playlist: ruclips.net/p/PLchBW5mYosh_F38onTyuhMTt2WGfY-yr7 Binary Exploitation PWN101 Webpage: razvioverflow.github.io/tryhackme/pwn101 Exploit code, not people. Twitter: @Razvi...
Exploiting Buffer Overflow (BOF) tutorial - pwn101 - PWN101 | TryHackMe
Просмотров 14 тыс.2 года назад
In this video we will see what a buffer overflow is, why does it happen and how to exploit it. Abusing a call to a vulnerable function (gets) in order to perform a buffer overflow and overwrite the value of a given variable stored in the stack. Since the value of this variable is later checked in the code, by overwriting it we manage to spawn a shell. Step-by-step walkthrough solving pwn101 fro...
Execution Flow Hijacking (ret2win) - pwn103 - PWN101 | TryHackMe
Просмотров 5 тыс.2 года назад
Hijacking the program's execution flow in order to execute a function of our choice, which is usually called ret2win (because we are returning to win() or any equivalent function) . We are abusing a buffer overflow caused by the use of scanf. A detailed explanation is given about how the stack behaves and what is happening in memory during the execution, so as to understand the underlying conce...
Endianness Explained. Little-Endian and Big-Endian for 32 and 64 bits - Binary Exploitation PWN101
Просмотров 3,5 тыс.2 года назад
Endianness Explained. Little-Endian and Big-Endian for 32 and 64 bits - Binary Exploitation PWN101
TryHackMe | Dear QA - Binary Exploitation (PWN)
Просмотров 2,1 тыс.2 года назад
TryHackMe | Dear QA - Binary Exploitation (PWN)
Compiling Crypto++ in Microsoft Visual Studio 2019/2017 (with Cryptopp-PEM)
Просмотров 18 тыс.3 года назад
Compiling Crypto in Microsoft Visual Studio 2019/2017 (with Cryptopp-PEM)
Seccomp nanosleep pwn binary exploitation | DekraCTF 2020 WeirdChall
Просмотров 6834 года назад
Seccomp nanosleep pwn binary exploitation | DekraCTF 2020 WeirdChall
Does PIE prevent this?
Initially yes, because addresses are randomized. However, if you are able to leak any address of the corresponding section during the execution, you may be able to find out the randomized address.
@RazviOverflow If you are trying an lpe and you can't get an interactive session on the binary, will ASLR and pie prevent exploitation?
@@oliverford5367 If you can't an interactive session, you must somehow be able to leak addresses from the running binary's memory sections. If you can't leak addresses during the execution, yes. ASLR/PIE prevents exploitation.
@RazviOverflow Annoying because I have found a Linux LPE 0-day that works with ASLR off
thats nice info man! Appreciate that
Glad you like it :)
Quality videos;-)
Thank you :)
ok so i did this locally by writing the payload to a file and inputting the file the payload is made with from pwn import * payload =b'A'*32 +p64(0x7fffffffdbf0)+p64(0x0000000000401554) with open('input.txt', 'wb') as f: f.write(b'3 ') f.write(payload) """ beg addr of main 0x000000000040158c admins_only beg 0x0000000000401554 location to of rip in stack addr 0x7fffffffdbd8 rsp before scanf 0x7fffffffdbb0 value of rbp after leave 0x7fffffffdbf0 """ but i am getting a segmentation fault at first i thought it was because i am writing rbp as some random thing and when it tries to store to stack it is inaccessable but even after writing rbp as the address it would be after the normal return i am still getting seg fault can anyone help me figure out why
Just in case, check 23:41 - The MOVAPS issue and modify your exploit accordingly. Try again and tell us how it goes.
@@RazviOverflow hey yeah i added an extra ret statement for the stack alignment thing it didnt work either but i did the same thing with sendline in python instead of writing to a text file and sending it with < and it worked idk why thanks for the help
Thank you a lot for your efforts.
You are welcome, and thank you for watching
Hello Ravzi, I'm not trying to reach you from everywhere, how can I reach you?
Hi there. Twitter is usually a good place to start a conversation.
@@RazviOverflow I Write :(
What will you do if the flag() address contains bad characters?
In case that happens, you can try jumping to adjacent addresses if they also do the job. Otherwise you'd have to find alternative solutions.
This is so useful! And I really appreciate the references
You are welcome!
excellent tutorial
I want to copy the entire assembly, how do I do that? I tried using "export code" but it only copies the hexdump part.
You can try using other tools like objdump
Very helpful! Please keep doing more of this binary exploitation / reverse engineering stuff... and even if u can do some forensics stuff that will be awesome! Anyway, thanks
Thank you :)
Please also show the decompiled code in your videos.
There's no need. Besides, which tool do you propose using?
Do we actually overflow the buffer ? What I understand is we only send payload that will rewrite until full size of buffer.
How do you know the size of the buffer? What's its size?
@@RazviOverflow from what i understand the size buffer is 70 which we can get at rbp-0x70 and we send payload enough 70 byte right? so we not actually overflow it?
@@Ziq0012 And what about vars _4h and _8h, living at rbp-0x4 and rbp-0x8 respectively? Do they live within the buffer?
@@RazviOverflow yes within the buffer it at bottom of the buffer . rbp > vars_4h >var_8h > scanf input
@@Ziq0012 How can a variable live within a buffer if it has its own type and allocated memory? What if the code is something like int a; int b; char buff[104]; Do a and b live within buff?
Your content is super clear and well explained. Thanks for explaining the rop concept in the best possible way.
You are more than welcome :)
when i run the binary, there is no __libc_csu? the value is just 0
I have a problem, I just downloaded the binary from THM. But there is no __libc_csu? the value is just 0 when printing it out Anybody got this problem?
ye got the same problem, but there was .text main address which could be used as a dynamic base address. idk why it didn't show __libc_csu_init.
@@yukesh- omg same here, i have tried to fixed that for days but nothing has been like razvi himself =((((
Great video
Thank you :)
absolutely loved it !!! loved the way you broke down each concept and explained
Glad you liked it :)
really good video, i don't know if you will answer but some weird things happened to me, the first thing is that when debugging the binary locally I couldn't find the libc library using radare2 in its place was another gnu lib, but i still tried the exploit remotely and I seem to find the libc but what I don't really understand is why the position of the libc was in the 14 place so my payload was like this: "%14$lX.%13$lX", the 13 is the canary but it doesn't make sense, because i've learn from you that the canary is before the rbp and the 14 place should be the rbp not the libc. (sorry for the long comment )
i have the same issue too, how can u exploit it locally?
The canary is always "before" the rbp, yes. "Before" in this context means at a lower memory address. If rbp is at, for example, 0x400, the canary is at 0x400-8
@@RazviOverflow sorry for bothering the conversation, but why when i debug it locally, using radare2 or gdb, but there is no __libc_csu? the value is just 0, why happening?
@@neverclick6520 if you are using the same binary as I did in the video, there should definitely be a __csu.
@@RazviOverflow when i tried i locally there's no a __csu, the value of %10 is 0, but when i tried it remotely, it have a value on the %10 address, im use the binary that tryhackme given, so thats why im not understand what happening
Hi, the binaries i compiled on my machine, they don't have "pop rdi" gadget even
I'm not sure what binaries are you talking about, but you can place arbitrary instructions with the asm() function.
like? @@RazviOverflow
@@RazviOverflowwhere i put it
@@r3plican docs.pwntools.com/en/stable/asm.html
Very very good explained broo
Thank you :)
i got an error not a valid win32 application ?
Thank you so much! I couldn't find anything else on this. Only crypto bros trying to sell me their coins
You are welcome. Yes, unfortunately cryptobros trying to scam people are flooding the internet nowadays.
Thanks for a great video! I have one question: because we overwrited the RBP with 'B'*0x8, wouldn't the "leave" assembly code set RSP = RBP, sending the stack pointer into an invalid location and failing the code?
Hi there. Yes, that's totally correct. Overwriting old rbp with random padding bytes implies the old stack frame (the one about to be restored with mov rsp, rbp; pop rbp) becoming invalid. Depending on what you are trying to achieve, you may or may not have to care about the state of the stack. In this case, it is irrelevant.
"If there is something you want to say, leave it in a comment" I want to say thank you man for this great series, I have learned a lot from you. your explanations are very clear.
Thank you for your kind words. I'm happy my videos helped you :)
Every single one of your videos has taught me 10 x anything I have ever learned from any other instructor. Your approach with explaining each subject and all of the complex details is just phenomenal. So grateful to have stumbled across you. Working my way through your content and loving every minute.
Thank you for your kind words ❤Glad my videos are useful to you :)
Why did you use ret "0x000000000040101a"? like based on what you chose it? do we use any ret gadget cuz it won't modify the code? just pop the address and go to it? Thank you <3
Any ret instruction would have the same effect.
trying to understand how to make the payload was the roughest part for me tbh. but after a couple of hours, I managed to understand it entirely. alhamdulillah Thanks, brother <3
You're welcome :)
take another heart <3
Glad to receive it (again)
take a heart <3
Glad to receive it :)
exelent 🥸
Thank you :)
At some point you found an address that persist over multiple execution. But i tried and cant find it. What am i missing😢
You should be able to replicate the video, that's weird.
You are the perfect man, my friend. I am very happy to have found someone who explains it as logically and comprehensively as you, because you speak the only language I understand, and that is logic!
Glad to help :) Thank you for your kind words!
Excellent video dude, thanks!
You are welcome :)
The king has returned
Hey i am getting, stopped with exit code -11 (SIGSEGV) error while trying this example. Welcome admin 😄 [*] Got EOF while reading in interactive i am getting this output but not able to use the shell for anything and "payload = b"A"*0x28 + admins_only_address" is my payload anyway thanks for the help, really helpful videos
At 9:25, you mentioned about changing the whole memory page protection (in order to be able to execute the shellcode), but how did you know that the shellcode is within the memory page of __libc_stack_end (and not in some other page of the stack which will make the stack not executable)?
17:55 - Aligning the leaked address Usually the stack isn't that large. However, you can always debug and check it.
@@RazviOverflow Thanks for the tip. I ran the debugger in IDA several times (ASLR enabled) and noticed that you’re right in terms of the standard input and __libc_stack_end are always in the same page. Specifically, the offset between rbp-20h (the beginning of the buffer for standard input) and the virtual address of __libc__stack_end is always 0x148 bytes, which is good enough for a page size of 4096 bytes
Hey Razvi, great video as always. So I got the virtual address of puts() from libc and I subtracted this address by its offset (last 3 hex values) so I should get the base address of libc. However, jumping to the resulting address in IDA does not show the text segment but some random data bytes. I wanna ask you if you think using a (virtual address + offset) is an unreliable way to obtain the base address of a segment, thanks!
If the library is loaded and you got its dynamic base address you should be able to see it.
@@RazviOverflow Thanks for the reply Razvi! The issue with the offset bits in a virtual address is that they are only 12 bits long. But you can have a starting virtual address of 0x7FABCDEF0000A000 in the text segment and a virtual address within the segment at 0x7FABCDEF0000B000. So the real offset here is not “000” but 0x1000, which is more than 12 bits.
@@rgb123-jm5mc I think I'm not fully understanding your problem. In order to get the offset, you shouldn't care about how many bits are used for this specific addressing. If you know the base address and the dynamic address, simply subtract them. Now, where does it say the offset has to be 12 bits? Could you link some docs?
@@RazviOverflow Hey Razvi, I think I might have mistaken the segment offset with page offset (lower 12 bits in virtual address). Since RUclips filters link, I found it in the first entry from the Google search “Cornell virtual address 12 bit offset”. Even though it uses 32-bit architecture, 12 bit virtual address offset is still used in 64-bit systems
@@RazviOverflow I think YT has deleted my comment for some reason, but I searched up Cornell Linux Virtual Address Offset and clicked on the first entry. Even though the webpage talks about 32-bit architecture, the offset is still 12 bits in 64-bit architecture.
It's hard. But thanx.
I know it is, but it's worth the effort.
thank you so much once again, I've been doing 1-2 of the PWN101 tasks per day. By the way what would you rate the difficulty of pwn108, pwn109, and pwn110?
You are welcome :) Difficulty is something very hard to estimate. It is relative and subject to each one of us. However, I can tell you they're harder than a simple BOF. Specially pwn107, that requires you to know and understand what GOT and PLT are, and how do they work. (I have a video on that topic as well).
your explanations are very very good! Towards the end when you mentioned about padding an extra 'ret' to the stack (by overwriting the stack using buffer overflow vulnerability), I assume this extra return instruction's address is popped so code execution will begin at that address, which is just another return instruction. Once this executes, it will pop the stack again and direct code execution to the admins_only function. Is that right? By the way, it seems like with PIE disabled, ASLR still applies to other non-text segments. Also, is there a way to tell if the stack is 16-byte aligned, or is this 'ret' padding method a technique that may or may not work? Thank you!
Thank you :) The extra ret instruction has no effect from the operational point of view, it just aligns some stuff within the stack frames. It is usually needed in ubuntu 18.04, give to the MOVAPS issue (which I briefly speak about in the ROP video)
Best ROP explanation I found on internet. Seriously most of contents on internet are all about using rop gadget tool. First 2 challenges on ropemporium are great too. I learned a lot from them (and simple login on pwnable kr)
I love your way of explaining things, I've been checking several sources for this stuff and so far this is the best for my way of thinking. GG
Thank you Javier. I'm glad my videos could help you :) Gracias
how do you know this 216f is format specify?
What do you mean?
Thank you so much, was stressing and struggling with this implementation and library inclusion. Success with Visual Studio 2022👍
You are welcome, glad I could help :)
Why do you minus shellcode? why do you not add them all together like in the previous videos?
I'm not doing -shellcode, I'm doing - len(shellcode). That's because I want to pad with A's 0x50 minus the bytes of the shellcode, and I don't want to manually count them. So I use 0x50 - len(shellcode)
@@RazviOverflow Oh ok what is the purpose of subtracting 0x50 from the length of the shellcode ?
ignore me I think I figured it out.
@@davidmohan2698 No worries at all. If you still have any doubt ask me, I'll do my best to clarify it.
Thanks A LOT!!!
You are welcome
Man these are great! Please make more.
Thank you :)
If anyone wonders how to configure Cutter to look like the instance you see in the video, I have prepared a step-by-step configuration video: ruclips.net/video/zrXA3AC_658/видео.html Hope this helps!
polino mi manchi