Assembly Primer For Hackers (Part 2) Virtual Memory Organization

Posted By: SecurityTube_Bot
Posted On: Mon 21 Feb 2011
Views: 37356
Share this video:
Share it on Facebook Share it on Twitter Share it on Reddit Share it on Digg Share it on Stumbleupon
Support SecurityTube:


Description: This is the second video in the "Assembly Primer for Hackers" series. Please begin here with Part 1, if you have not already done so before watching this video.

In this video we take an in-depth look at virtual memory organization concepts. The entire discussion is explained by taking a live example using the SimpleDemo.c code. We look at how one can use the /proc/PID/maps to peek into the layout of a program's virtual memory and interpret useful things. Also, we show how the Address Space Layout Randomization (ASLR) works in the latest 2.6 kernels and why this is significant from a security point of view. We also show how this can be disabled at runtime if the need be. This video is very important from an code exploitation perspective as it teaches us how to check for the presence of ASLR on a given system.



Tags: programming ,

This video is part of the following groups:

1. Assembly Language Megaprimer for Linux ( 11 videos)


Comments (62)

sailboat on Fri 25 Feb 2011

Very Interesting, I was unaware of stack protection in the linux 2.6 kernel.

Vivek-Ramachandran on Sat 26 Feb 2011

Thanks! The old vanilla buffer overflows hardly work anymore and OSs are getting smarter and so are hackers :)

sailboat on Sat 26 Feb 2011

For anyone who is trying to make these examples work, make sure that when you compile, you include the following option -fno-stack-protector so gcc -ggdb -mpreferred-stack-boundary=2 -fno-stack-protector -o demo demo.c

sailboat on Sat 26 Feb 2011

*meant for this comment to be placed in the buffer overflow primer

xorxorxor on Tue 01 Mar 2011

thank you sir, for this amazing video!

tommychai67 on Thu 03 Mar 2011

Thumbs up! :D

JCasper777 on Mon 14 Mar 2011

This series is great. Thank you very much for taking the time to share it with us.

KINGSABRI on Wed 16 Mar 2011

Thanks Vivik
1st all I'd like to thank you for all this effort
2nd
I've Fedora 14 with kernel "2.6.35.10-74.fc14.i686.PAE"

so when I looking in "randomize_va_space " value I found ...
cat /proc/sys/kernel/randomize_va_space
2

nor 1 neither 0

so kindly clarify these point

root on Sun 20 Mar 2011

I also got the same from kingsabri on randomization of va space but I'll try to get some info on the kernel's documentation.

There's something else I didn't understand. AFAIK, there's no more such thing as "pre-established" memory locations to store/run the processes. I mean, when we fire a process, it will be placed at a free position of the RAM according to a certain algorithm, right?
But why does everything start at 08048000 then?

Thank you very much for your time at posting these videos and answering our questions.

Best regards

sogood on Tue 22 Mar 2011

www.mjmwired.net/kernel/Documentation/sysctl/kernel.txt

randomize-va-space:
2 - Additionally enable heap randomization.

@root: based on these vids, free RAM positioning occurs in physical memory. Virtual memory mapping is always the same.

slingshot on Wed 23 Mar 2011

Thank you so much for creating these videos.
Great work.

Zukin on Sun 03 Apr 2011

Vivek,

As per your request I'm leaving you a comment.

I believe that the success of this video series is in the fact that:

- you provide a concise audio lecture, clearly communicating not too much & also not too little information
- you include visual aids which help in maintaining focus and clarity on the topic
- you are quick at explaining a topic, clearly, this not boring the viewer, and if more clarity is needed we can rewind the video and pay closer attention to what you're talking about.
- you type very well, you're quick, and it's easy to pause the video and follow along with what you're demonstrating.
- The coupling of audio/video/and hands-on training that you facilitate is truly remarkable.

You are very good at making training videos. PLEASE keep it up!!

grimertop90 on Sun 03 Apr 2011

Absolutely brilliant. This is only the second video I've watched on your site (after the first one in this series, which was mostly review for me) and I'm already quite excited about it. The whole thing is very well done.

grimertop90 on Sun 03 Apr 2011

Quick question:

Do you know anything specifically about the FreeBSD 6.3-RELEASE-p5 kernel? more specifically, I noticed that by default there is no address randomization used. Do you know if it has a switch somewhere that has been flipped? I could not find a /proc/sys/kernel/randomize_va_space file.

Any ideas? Just curious.

grimertop90 on Sun 03 Apr 2011

@root: If you return and watch Part1 in this series, Vivek explains that what we are dealing with will not be physical memory in the RAM but rather the operating system's abstraction of it, "virtual memory". The OS acts as though each process has the entire system to itself when displaying information about processes. Hence, everything starts at the same point. Watch Part 1 for more detail.

rootx on Fri 08 Apr 2011

it help me lot i love this . what are the up coming series ??
And will i be able to download these videos? how can i download these videos ?????????????????????

G-H on Mon 11 Apr 2011

Thank you very much >> and this is a nice Videos

but i have to ask you please .. what is your system??

windows or liunx

and putty is a tool to connect to the ssh .. is that correct ?

and can you make this more simple ?

thanks alot

vijitizer on Mon 18 Apr 2011

Thank u very much ...........

Immense on Fri 22 Apr 2011

Thanks you for a very great video. Really liked this Variable Stack segment concept.

Ash on Sun 24 Apr 2011

hey how can i connect putty to backtrack from windows.. plz help me...

Etalix on Fri 29 Apr 2011

That was beautiful dude!!!!

sekstiseks on Fri 29 Apr 2011

Same as Zukin said!

You rock! =)

lightofchaos on Wed 04 May 2011

Great Video series, and Zukin's comments defines my own.

isis.e on Thu 05 May 2011

I think you divided the series very well,
into focused and concise videos.

Also, you explain things as if the viewers are pretty much beginners, not knowing a lot but have heard some things about the subject- which works very good for me, and for most of the guys interested in the topic, I guess.

Discussing this video specifically, I think you should have compared the actual VA space we've seen here to the theoretical one you explained about in Video I- Tell exactly which range here matches each range there (not only the stack and .text/.data).

ram on Fri 06 May 2011

Thank you so much sir,
It's really helpful video..

ambient on Sun 15 May 2011

Excellent tutorial, it would be great if you provide more explanation on each column in /proc/[processID]/maps.
Thank you for your contribution!! :)

Ali on Tue 17 May 2011

i suggest to work in xp but thanks bro
for sharing us ur time and effort

Gripen on Fri 20 May 2011

Thanks Vivek, really good videos so far :)

charst46 on Fri 27 May 2011

Once again, great stuff. Well organized and presented. Clear explanations and demonstrations.

Thanks for adding to the knowledge pool.

mbleicher on Fri 27 May 2011

Excellent videos, I wish you had taught my assembly language classes in grad school. Very organized, clear, and easy to understand. Do you have videos on any other topics such as Memory Analysis and Forensics?

AMoore on Sat 04 Jun 2011

Excellent, excellent videos sir! This is really a wonderful public service you're providing us! Great work!!!!

anks on Mon 06 Jun 2011

Super Like!!

chris73it on Sat 11 Jun 2011

Thank you: you are really very clear in your exposition. Keep up with the good work!! Ciao, Chris

rblackburn on Sat 11 Jun 2011

Thank you for a clear, direct explanation of stack function. I have found your videos to be excellent, building in a logical manner without assuming a base of knowledge the viewer may not possess. It is amazing how a skilled teacher can make a complex point seem simple and obvious.

Random on Wed 15 Jun 2011

Thanks a lot for this videoseries!

ocelot.nahui on Thu 16 Jun 2011

Thanks to you V-R I will learn Assembly. Thank you for these videos.

Alteminor on Sat 18 Jun 2011

These are great. Thanks. :)

redBandit on Tue 21 Jun 2011

Any recommended reading , jedi master ?

beard on Fri 24 Jun 2011

as always the best video series out there.

DW2054 on Mon 27 Jun 2011

Thank you for sharing.

Govind_Rao_123 on Thu 30 Jun 2011

Hi Mr Vivek-Ramachandran : thanx a lot
Excellent video, please give a Quick Reply on my email id.
i want more learn...
Thank You Very Much. .. .. . . :-)

ssriram on Sat 02 Jul 2011

Nice video, Keep it up.
Can you put some videos on the 'not so known' parts of linux as in the /proc filesystem etc.? That would be great.

xplt on Fri 08 Jul 2011

As always! Another great movie! Thank you Vivek!

neo on Tue 12 Jul 2011

nice video..

in0cula on Mon 18 Jul 2011

thank you, very informative

geo.cmor on Wed 20 Jul 2011

hello! thAnks for the great video!!! I hAve 1 question though.. When I try to chAnge the value of the randomize_va_space responds with "bash: /proc/sys/kernel/randomize_va_space: Permission denied" I run suse 11.4 btw! Do you know whAt I cAN do to get access??

MANIKANTH on Sun 07 Aug 2011

Hi Ram Bro,

WOW what a video amazing.. i always dreamt to be a security professional .But worried of training cost and correct materials today i found this wonderful site and amazed to see very basic videos..Please ..please ..please continue with this good work and so many people like me who are not affordable of training costs will be benifited..God bless you with more success in your life Thanks once again

JuT on Thu 11 Aug 2011

Great Job Vivek!
These type of videos are exactly what I have been looking for, for getting a better understanding of Assembly!

Keep up the great work!

bot_master on Sun 14 Aug 2011

nice work

airwizard on Mon 12 Sep 2011

really nice!

Dr_Ninja on Wed 14 Sep 2011

niCe Sharing and Really helpfull in my System Programming course :)

d4rkhunt3r on Mon 17 Oct 2011

Nice video ... keep on with the good work :)

slacka on Thu 10 Nov 2011

Totally didn't think about the memory map in /proc. Good to know. Thanks for this vid.

As a side note, when using ps, leave out the dash and you won't get that warning. ie: ps aux , not ps -aux.

cheers.

V1K on Sat 12 Nov 2011

Thanks for the great video. I have studied the theory explained in this video but didn't came across such a vivid practical explanation of it.
One thing I'm still confused about is how the OS manages different processes when they are laid on the same virtual memory space. Do you have video or link for it?
thanks!

Mutex on Sun 04 Dec 2011

Hi, I'm getting a video not found error for all the videos in this section. Could you please look into it as I would love to view them all.

Regards
Reino Mostert

proff_g33k on Sun 04 Dec 2011

hi,nice explanation!
I have kernel 3.0.0-14-generic ubuntu,
and by process id 's maps file shows libs files,vdso,heap and stack adresses but not showing starting address you mentioned 80840000-its showing starting from libs to stack...
whay?is that something they have prevented to see?

XoR on Sat 10 Dec 2011

I tried to setup randomize_va_space with echo, but couldn't.

It works with sysctl kernel.randomize_va_space=0

On linux kernel 3.1.4

Sushant on Sat 24 Dec 2011

awesome.. liked it.. :)

Prd_schumy on Mon 26 Dec 2011

Thanks Vivek...I'm a hobbyist and was kind of interested in this subject topic, but you teaching style has greatly kindled my interest to go deeper into it...keep up the good work !!

Sean on Sat 31 Dec 2011

Hey Vivek, Really appreciate your demo style. Very clear explanations makes it easy to absorb this challenging information... Thanks!

bug on Fri 06 Jan 2012

wch software is used in this vdo i hav download putty bt when i start it ask for the ip...

plz help m totally new.........

bilakos88 on Tue 17 Jan 2012

excellent videos, mr. Vivek! They are really helpful! Thank you for the free lessons!

Login to post a comment