Follow us

Description: This is Part 11 of the "Assembly Language Primer for Hackers" video series. Please start this series by watching Part 1, if you have not already done so. In this video, we will look at how to use the Stack to pass arguments to functions. <br><br>In course of this video we will look into exactly how the Stack works, how to store arguments on the stack, how the "call" instruction stores the return address on the stack, the logic behind storing the EBP register on the stack, how and why EBP is used to reference function arguments and local variables in a function and how to adjust the ESP to accommodate all this. This video is very important as a lot of learning from this will be used in the Buffer overflow video series I plan to make next. <br><br>Please download Function3.s before you view this video. <br><br><br><style type="text/css"> body { background: #FFF; } </style> </div>

Disclaimer: We are a infosec video aggregator and this video is linked from an external website. The original author may be different from the user re-posting/linking it here. Please do not assume the authors to be same without verifying.

Great Series Vivek! I think I'm gonna check out the Buffer Overflow series next.

General comments about this series are all positive, I liked how we went through and used gdb to set breakpoints and examine the memory, it really helped me to understand what was going on. Please make more!

Like everyone, I like your work, I think we need more people like you who are willing to share their knowledge, I have followed the series since the first video and I've tried all the examples, all they have worked, however, I you need to clarify something I've encountered and I'm sure many have found too, it is the execution platform, I mean:If you run an assembly code on a 32 bit, works perfectly using functions like popl, movl, leal, pushl, etc.but if you use a 64-bit platform, you can still use some registers and ecx, ebx, etc. and functions as movl, leal, etc. with some success, but functions like popl %eXX, pushl %eXX doesn't work at all... and worse, operations such as those shown in this video, obtaining a value as a function of the memory location of the EBX register, to run this example I changed the shape functions by popq, pushq, movq, addq, etc, and the registers by %rsp, %rsb, %rax, %rbx, etc. Also, get a value from the memory location of the EBX/RBX the values must be multiplied by two (64 bits platform after all), for this reason the instructions in the function have changed to the following: movq $4, %rax movq $1, %rbx movq 16(%rbp), %rcx movq 24(%rbp), %rdx int $0x80I hope that if someone is in a similar situation trying the exercises, this review will be helpful.

Again, thank you for your wonderful work Vivek, I hope to see many more videos made ​​by you on Hacking.

Thank you so much Vivek for the time and effort it took you to create this series of very useful videos! For those who are new to assembly and really need to get the basics down for proper reverse engineering efforts, this series should help quite a bit. I plan to pass on the "group" URL for this series to all of my junior co-workers. Thanks again!!

I really, really, appreciate this series. However, you've asked for constructive feedback and commentary, so I'll pose what comes to mind. Why are you using AT&T syntax when the standard seems to be Intel syntax (and GAS supports Intel syntax just fine)? Also, why did you choose to use GAS versus something like NASM, since GAS been been designed specifically for the GCC back-end, and not really as a standard for normal products. I can see that, having been exposed to GAS (and AT&T syntax), learning another flavor of assembly would be relatively easy, but I think NASM is a better start for most people. Or at least Intel syntax, since that's what most others use.

I just went through all of these videos and wanted to leave my comment until the end: You rock. I've heard of people complain about how assembly is so hard to learn that it deterred me from even trying. But going through your tutorials, I don't know what they are complaining about because I feel like I know so much about assembly right now. I'm going to share this link with all of my old CS friends at the University of Chicago.

Thanks again Vivek! Another awesome series with a ton of easy to understand information! I am officially addicted to securitytube lol! I was wondering if you had any plans on adding to this series at all and delving any deeper into assembly? I'd like to learn more about working with firmware and writing assembly code to hack LED displays, mechanical outputs, or other simple electronics. Would this be something you would be interested in elaborating on? One way or another thank you very much for taking the time to create all the videos, primers, and guides on this site. It is indispensable for anyone getting into IT security or hacking for fun! I look forward to many more videos from you in the future!

A great video series. Thank u so much Vivek! :)I studied this tutorial using a 64bit machine. I solved the problem of the instructions like pushl etc assembling and linking with 32bit directives.Eg: "as --32 -o my_prog.o my_prog.s" and for the linker "ld -m elf_i386 -o my_prog my_prog.o"I did that in order to reproduce correctly the examples on my machine.So thx again Vivek!

Love the videos! They've been great. Could you please make some cheat sheets for your future videos. It's quite hard and frustrating having to look through all the videos to find one command/solution to your problem. Thanks.

Great teaching style! I've enjoyed all of your videos, and they've gotten me interested in Assembly --- which is no small feat! The only thing I've run into as a beginner that caused a bit of trouble was: it seems that most of the code that I see is in Intel notation; though, because the differences are somewhat minor, it wasn't a huge deal. I'm going onto buffer overflow and windows asm now --- thank you for these!

Another superb video. The Function3 program would not compile for me. I got the following errors when I ran "as -ggstabs -o Function3.o Function3.s"Function3.s:13:Error: invalid instruction suffix for 'push'Function3.s:25:Error: invalid instruction suffix for 'pop'Function3.s:33:Error: invalid instruction suffix for 'push'Function3.s:37:Error: invalid instruction suffix for 'push'

It must be because I have a 64 bit CPU. I will investigate this and try to see if I can figure out the appropriate fixes.