﻿1
00:00:00,160 --> 00:00:06,880
Inside the stack, this is the temporary, local, and automatic area of the actual memory itself.

2
00:00:06,880 --> 00:00:14,640
The stack is more of a scratch pad for use for the overall system, and it exists only while a

3
00:00:14,640 --> 00:00:21,200
specific function is running. So like earlier we were talking about word.exe, that word.exe is

4
00:00:21,200 --> 00:00:26,879
going to be inside the actual stack itself whenever the program is called upon, and then when it's

5
00:00:27,440 --> 00:00:32,959
done, it gets moved to the heap because it's on its way out. And as soon as the function hits

6
00:00:32,959 --> 00:00:38,160
return at the end of the actual memory call itself, or at the end of the program,

7
00:00:38,160 --> 00:00:44,000
and when I say function, I'm talking about the program that's being executed, the memory is

8
00:00:44,000 --> 00:00:52,160
destroyed and basically gets pushed into the heap. So there are local variables that we can

9
00:00:52,880 --> 00:00:57,759
look at inside of there, and it starts getting into that area of looking into a program through

10
00:00:57,759 --> 00:01:06,320
the hex editor at the assembly level, because you're going to see assembly calls at the most

11
00:01:06,320 --> 00:01:12,559
basic level, no pun intended there, of coding when things are pulled in and out of the memory for

12
00:01:12,559 --> 00:01:18,160
those programs. Yes, you can still pull data out of there, but this is how it's being looked at

13
00:01:18,160 --> 00:01:26,400
by the actual processor. And we also have fixed size arrays of memory inside the actual RAM,

14
00:01:26,400 --> 00:01:33,599
and this is why we have buffer overflows attacks, because once we create a buffer overflow to fill

15
00:01:33,599 --> 00:01:38,480
it up with NOP sleds until the end of time, it goes outside of that actual fixed array.

16
00:01:39,120 --> 00:01:44,400
And you could use something as simple as just creating an infinite loop of NOPs,

17
00:01:45,040 --> 00:01:51,440
or a nested loop for all you programmers out there that want more coding talk.

18
00:01:52,239 --> 00:01:59,040
But this is the classic buffer overflow target, and this is primarily where most of the actual

19
00:01:59,040 --> 00:02:09,279
memory attacks happen at whenever they do exist. So if our, for example, let's say we have a

20
00:02:09,279 --> 00:02:17,919
variable call out of a program for a character that is a username, and that username only has,

21
00:02:17,919 --> 00:02:26,479
let's say, 50 character limit, and you go in and allow 55 to be typed, that five characters is

22
00:02:26,479 --> 00:02:32,639
going to spill over outside the actual fixed size array, causing a buffer overflow. Will it be as

23
00:02:32,639 --> 00:02:39,839
detrimental as something that we create? No, but that's what happens. And usually in programming,

24
00:02:39,839 --> 00:02:47,360
we prevent this by putting in variable checks and balances to make sure that those variables

25
00:02:47,360 --> 00:02:55,360
don't go over what the actual limit is supposed to be. Same with program size, program memory calls,

26
00:02:55,360 --> 00:03:01,360
and all sorts of things like that. And there's also a return address, basically stating inside

27
00:03:01,360 --> 00:03:06,880
the actual program or the program inside of the memory at the time, telling it where to go back to

28
00:03:07,919 --> 00:03:14,320
once the program either needs it or is completed. Because, again, our example is where exe, if we're

29
00:03:14,320 --> 00:03:19,360
going to take up from slot zero all the way up to 100, as an example, the return address is just

30
00:03:19,360 --> 00:03:26,399
saying that the return back to zero in order to rerun the program or perform another function

31
00:03:26,399 --> 00:03:31,360
within that program itself. Again, we're in a very structured environment here when we're inside

32
00:03:31,360 --> 00:03:38,800
the stack, so we're going to see calls going back and forth inside the memory to a pinpoint area

33
00:03:38,800 --> 00:03:42,720
instead of just saying, grab all of it and hope for the best.


