SlideShare a Scribd company logo
CNIT 127: Exploit Development



Ch 18: Source Code Auditing
Updated 4-10-17
Why Audit Source Code?
• Best way to discover vulnerabilities
• Can be done with just source code and
grep
• Specialized tools make it much easier
Cscope
• A source code browsing tool
• Useful for large code trees,
such as the whole Linux
kernel
• Many useful search
functions
• Cbrowser: GUI front-end
• Links Ch 18a, 18b
Ctags
• Indexes source code
• Creates a tag file with
locations for language
tags in files scanned
• Works in many
languages, including C
and C++
– Link Ch 18c
Text Editor
• Vim and Emacs have features that make
writing and searching though large
amounts of code easy
• Bracket-matching: find matching ([{
Automated Source Code
Analysis Tools
Splint
• Badly out-of date (last revised in 2007)
• Output a little hard to understand
– Links Ch 18d, 18e
• Many available, specialized by language
• Link Ch 18f
• Easy to use
• Finds about half the obvious
vulnerabilities we've exploited
Heap Overflow
Finds Some Vulnerabilities
• But not the overflow!
Format String Vulnerability
• It doesn't find
it at all!
Flawfinder
• Much better
• In Kali
• apt-get update
• apt-get install flawfinder
Methodology
Top-Down (Specific) Approach
• Search for specific lines of vulnerable
code, such as format string errors
• Auditor doesn't have to understand
application in depth
• Misses vulnerabilities that span more than
one part of the code
Bottom-Up Approach
• Auditor reads large portion of code
• Starting at main()
• Time-consuming but can reveal subtle
bugs
Selective Approach
• Most auditors use this approach
• Locate code that can be reached with
attacker-defined input
• Focus energy on that code
• Learn the purpose of that code thoroughly
Vulnerability Classes
Generic Logic Errors
• Requires good understanding of an
application
– And internal structures and classes
• Example: wildcard certificates
– Pascal-based CA will sell a certificate for *
0.evil.com
– C-based browser will see it as *, a wildcard
• Link Ch 18g
(Almost) Extinct Bug Classes
• Unbounded memory copy functions
– strcpy(), sprintf(), strcat(), gets(), …
• Hunted nearly to extinction
Root Cause (from Microsoft)
Bypassing ASLR & DEP
Format Strings
• Easy to find with a code audit
– Although cppcheck failed
• Often found in logging code
• Vulnerable only if attacker controls the
format string
Generic Incorrect Bounds-Checking
• Coder attempts to check limits, but does
it incorrectly
• Example: Snort RCP Processor (2003)
– Processes a series of RPC fragments
– Checks each fragment to make sure it's not
larger than the buffer
– But it should check the total size of all
combined fragments
Snort RCP Processor (2003)
Loop Constructs
• Coders often use intricate loops, and loops
within loops
• Complex interactions can lead to insecurities
• Led to a buffer overflow in Sendmail
• Link Ch 18h
Demonstration Exploit
• Link Ch 18i
Off-by-One Vulnerabilities
• Often caused by improper null-
termination of strings
• Frequently found in loops or introduced
by common string functions
• Can lead to arbitrary code execution
Example from Apache
• When both if statements are true
– Space allocated is one byte too small
– memcpy will write one null out of bounds
OpenBSD ftp Daemon
• If last character is a quote, it can be
written past the bounds of the input
buffer
strncat()
• Strncat always null-terminates its output
string
• Will write a null byte out of bounds unless
the third argument is equal to the
remaining space in the buffer minus one
byte
Non-Null Termination Issues
• If a string is not terminated with a null
– Memory after the string is interpreted as part
of the string
– May increase length of string
– String writes may corrupt memory outside the
string buffer
– Can lead to arbitrary code execution
strncpy()
• If there's not enough space in the
destination buffer
– strncpy() won't null-terminate the string it
writes
strncpy() Example
– First strncpy won't null-terminate not_term_buf
– Second strcpy is unsafe, even though both
buffers are the same size
– Fix it by adding this line of code after the first
strcpy
Skipping Past Null-Termination
• String-processing loops that process more
than one character at a time
– Or where assumptions about string length are
made
• Can make it possible to write past end of
a buffer
– Possible arbitrary code execution
Example from Apache
• This line is intended to skip past :// in a
URL
– cp += 3
But Not All Schemes End in ://
• If the URI is ldap:a
– The null byte is skipped
Signed Comparison Vulnerabilities
• Coder attempts to check input length
• But uses a signed integer variable
• Or two different integer types or sizes
– C sometimes converts them both to signed
integers before comparing them
• Following example from Apache
– Led to code execution on Windows and BSD
Unix
Example from Apache
• bufsize is a signed integer
– Remaining space in the buffer
• r->remaining is signed
– Chunk size from the request
• len_to_read should be the smaller of the two
– Negative chunk size tricks the code into performing a
large memcpy later, because it's cast to
unsigned
Integer Conversions
• Link Ch 18l
• A hashed password can begin with 0e and
contain only digits (very rare)
– Like 0e12353589661821035685
• PHP reads that as scientific notation
– 0^123…
– Always zero (link Ch 18j)
Double Free Vulnerabilities
• Freeing the same memory chunk twice
• Can lead to memory corruption and arbitrary
code execution
• Most common when heap buffers are stored
in pointers with global scope
• Good practice: when a global pointer is
freed, set it to Null to prevent it being re-
used
• Prevents dangling pointers
Out-of-Scope Memory Usage
Vulnerabilities
• Use of a memory region
before or after it is valid
• Also called "Dangling
Pointer"
– Image from Wikipedia
• Link Ch 18k)
Uninitialized Variable Usage
• Static memory in the .data or .bss
sections of an executable are initialized
to null on program startup
• But memory on the stack or heap is not
• Uninitializes variables will contain data
from previous function calls
• Argument data, saved registers, or local
variables from previous function calls
Uninitialized Variable Usage
• Rare, because they can lead to immediate
program crashes
• So they get fixed
• Look for them in code that is rarely used
• Such as handlers for uncommon errors
• Compilers attempt to prevent these errors
Example
• If data is null
– test is never assigned any value
– But test is still freed
Exploitation
• The "uninitialized" data in test is not
random
• It comes from previous variables and
function calls
• It may be controlled by the attacker
• So the free() leads to a controllable
memory write
– Arbitrary code execution
Use After Free Vulnerabilities
• Heap buffers are temporary
– Released with free()
• But a program may use a pointer after
free()
– If more than one variable points to the same
object
• Allows an attacker to write to RAM
– Possible arbitrary code execution
Multithreaded Issues and 

Re-Entrant Safe Code
• A global variable is used by more than one
thread, without proper locking
– A variable might be changed unexpectedly by
another thread
• Such issues won't appear until the server
is under heavy load
– May remain as intermittent software bugs
that are never verified

More Related Content

What's hot (20)

PPTX
Linux file system
Md. Tanvir Hossain
 
PDF
CNIT 127 Ch 8: Windows overflows (Part 1)
Sam Bowne
 
PDF
CNIT 126 5: IDA Pro
Sam Bowne
 
PDF
CNIT 126: 10: Kernel Debugging with WinDbg
Sam Bowne
 
PDF
Practical Malware Analysis: Ch 11: Malware Behavior
Sam Bowne
 
PPTX
Apache web service
Manash Kumar Mondal
 
PDF
Linux Internals - Part I
Emertxe Information Technologies Pvt Ltd
 
PPTX
Vi editor
Ramakrishna kapa
 
ODP
Apache ppt
poornima sugumaran
 
PPTX
file system in operating system
tittuajay
 
PDF
makefiles tutorial
vsubhashini
 
PDF
Shell scripting
Manav Prasad
 
PDF
CNIT 126 8: Debugging
Sam Bowne
 
PDF
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Ahmed El-Arabawy
 
PDF
Practical Malware Analysis: Ch 15: Anti-Disassembly
Sam Bowne
 
PPTX
Operating system components
Syed Zaid Irshad
 
PPTX
Linux ppt
lincy21
 
PDF
CNIT 126 9: OllyDbg
Sam Bowne
 
Linux file system
Md. Tanvir Hossain
 
CNIT 127 Ch 8: Windows overflows (Part 1)
Sam Bowne
 
CNIT 126 5: IDA Pro
Sam Bowne
 
CNIT 126: 10: Kernel Debugging with WinDbg
Sam Bowne
 
Practical Malware Analysis: Ch 11: Malware Behavior
Sam Bowne
 
Apache web service
Manash Kumar Mondal
 
Vi editor
Ramakrishna kapa
 
Apache ppt
poornima sugumaran
 
file system in operating system
tittuajay
 
makefiles tutorial
vsubhashini
 
Shell scripting
Manav Prasad
 
CNIT 126 8: Debugging
Sam Bowne
 
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Ahmed El-Arabawy
 
Practical Malware Analysis: Ch 15: Anti-Disassembly
Sam Bowne
 
Operating system components
Syed Zaid Irshad
 
Linux ppt
lincy21
 
CNIT 126 9: OllyDbg
Sam Bowne
 

Similar to CNIT 127: Ch 18: Source Code Auditing (20)

PDF
Ch 18: Source Code Auditing
Sam Bowne
 
PPT
Buffer Overflow Attacks
harshal kshatriya
 
PPTX
Search for Vulnerabilities Using Static Code Analysis
Andrey Karpov
 
PDF
AllBits presentation - Lower Level SW Security
AllBits BVBA (freelancer)
 
PDF
Secure Coding Practices for Middleware
Manuel Brugnoli
 
PDF
1.Buffer Overflows
phanleson
 
PPT
6 buffer overflows
drewz lin
 
PDF
Software Security
Roman Oliynykov
 
PDF
2.Format Strings
phanleson
 
PPTX
Stack-Based Buffer Overflows
Daniel Tumser
 
PPT
Buffer Overflows
Sumit Kumar
 
PPTX
antoanthongtin_Lesson 3- Software Security (1).pptx
23162024
 
PDF
2 buffer overflows
Karthic Rao
 
PPTX
Control hijacking
Prachi Gulihar
 
PPTX
Shooting clay pidgins
volvent
 
PPTX
Static analysis and writing C/C++ of high quality code for embedded systems
Andrey Karpov
 
PDF
lect02--memory.pdf
Andy Sutherland
 
PDF
Ceh v5 module 20 buffer overflow
Vi Tính Hoàng Nam
 
PDF
Fuzzing - Part 1
UTD Computer Security Group
 
PDF
Lecture #15: Buffer Overflow Attack (Non Malicious Attack)
Dr. Ramchandra Mangrulkar
 
Ch 18: Source Code Auditing
Sam Bowne
 
Buffer Overflow Attacks
harshal kshatriya
 
Search for Vulnerabilities Using Static Code Analysis
Andrey Karpov
 
AllBits presentation - Lower Level SW Security
AllBits BVBA (freelancer)
 
Secure Coding Practices for Middleware
Manuel Brugnoli
 
1.Buffer Overflows
phanleson
 
6 buffer overflows
drewz lin
 
Software Security
Roman Oliynykov
 
2.Format Strings
phanleson
 
Stack-Based Buffer Overflows
Daniel Tumser
 
Buffer Overflows
Sumit Kumar
 
antoanthongtin_Lesson 3- Software Security (1).pptx
23162024
 
2 buffer overflows
Karthic Rao
 
Control hijacking
Prachi Gulihar
 
Shooting clay pidgins
volvent
 
Static analysis and writing C/C++ of high quality code for embedded systems
Andrey Karpov
 
lect02--memory.pdf
Andy Sutherland
 
Ceh v5 module 20 buffer overflow
Vi Tính Hoàng Nam
 
Fuzzing - Part 1
UTD Computer Security Group
 
Lecture #15: Buffer Overflow Attack (Non Malicious Attack)
Dr. Ramchandra Mangrulkar
 
Ad

More from Sam Bowne (20)

PDF
Introduction to the Class & CISSP Certification
Sam Bowne
 
PDF
Cyberwar
Sam Bowne
 
PDF
3: DNS vulnerabilities
Sam Bowne
 
PDF
8. Software Development Security
Sam Bowne
 
PDF
4 Mapping the Application
Sam Bowne
 
PDF
3. Attacking iOS Applications (Part 2)
Sam Bowne
 
PDF
12 Elliptic Curves
Sam Bowne
 
PDF
11. Diffie-Hellman
Sam Bowne
 
PDF
2a Analyzing iOS Apps Part 1
Sam Bowne
 
PDF
9 Writing Secure Android Applications
Sam Bowne
 
PDF
12 Investigating Windows Systems (Part 2 of 3)
Sam Bowne
 
PDF
10 RSA
Sam Bowne
 
PDF
12 Investigating Windows Systems (Part 1 of 3
Sam Bowne
 
PDF
9. Hard Problems
Sam Bowne
 
PDF
8 Android Implementation Issues (Part 1)
Sam Bowne
 
PDF
11 Analysis Methodology
Sam Bowne
 
PDF
8. Authenticated Encryption
Sam Bowne
 
PDF
7. Attacking Android Applications (Part 2)
Sam Bowne
 
PDF
7. Attacking Android Applications (Part 1)
Sam Bowne
 
PDF
5. Stream Ciphers
Sam Bowne
 
Introduction to the Class & CISSP Certification
Sam Bowne
 
Cyberwar
Sam Bowne
 
3: DNS vulnerabilities
Sam Bowne
 
8. Software Development Security
Sam Bowne
 
4 Mapping the Application
Sam Bowne
 
3. Attacking iOS Applications (Part 2)
Sam Bowne
 
12 Elliptic Curves
Sam Bowne
 
11. Diffie-Hellman
Sam Bowne
 
2a Analyzing iOS Apps Part 1
Sam Bowne
 
9 Writing Secure Android Applications
Sam Bowne
 
12 Investigating Windows Systems (Part 2 of 3)
Sam Bowne
 
10 RSA
Sam Bowne
 
12 Investigating Windows Systems (Part 1 of 3
Sam Bowne
 
9. Hard Problems
Sam Bowne
 
8 Android Implementation Issues (Part 1)
Sam Bowne
 
11 Analysis Methodology
Sam Bowne
 
8. Authenticated Encryption
Sam Bowne
 
7. Attacking Android Applications (Part 2)
Sam Bowne
 
7. Attacking Android Applications (Part 1)
Sam Bowne
 
5. Stream Ciphers
Sam Bowne
 
Ad

Recently uploaded (20)

PPTX
Iván Bornacelly - Presentation of the report - Empowering the workforce in th...
EduSkills OECD
 
PPTX
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
PPTX
Life and Career Skills Lesson 2.pptxProtective and Risk Factors of Late Adole...
ryangabrielcatalon40
 
PPTX
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
PPTX
How to Configure Taxes in Company Currency in Odoo 18 Accounting
Celine George
 
PDF
DIGESTION OF CARBOHYDRATES ,PROTEINS AND LIPIDS
raviralanaresh2
 
PPTX
MATH 8 QUARTER 1 WEEK 1 LESSON 2 PRESENTATION
JohnGuillerNestalBah1
 
PDF
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
PPTX
ENGLISH 8 REVISED K-12 CURRICULUM QUARTER 1 WEEK 1
LeomarrYsraelArzadon
 
PDF
Indian National movement PPT by Simanchala Sarab, Covering The INC(Formation,...
Simanchala Sarab, BABed(ITEP Secondary stage) in History student at GNDU Amritsar
 
PPTX
How to Manage Wins & Losses in Odoo 18 CRM
Celine George
 
PPTX
Connecting Linear and Angular Quantities in Human Movement.pptx
AngeliqueTolentinoDe
 
PDF
Andreas Schleicher_Teaching Compass_Education 2040.pdf
EduSkills OECD
 
PPTX
The Gift of the Magi by O Henry-A Story of True Love, Sacrifice, and Selfless...
Beena E S
 
PDF
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
PDF
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.06.25.pdf
TechSoup
 
PDF
Lean IP - Lecture by Dr Oliver Baldus at the MIPLM 2025
MIPLM
 
PDF
WATERSHED MANAGEMENT CASE STUDIES - ULUGURU MOUNTAINS AND ARVARI RIVERpdf
Ar.Asna
 
PDF
Cooperative wireless communications 1st Edition Yan Zhang
jsphyftmkb123
 
PDF
Free eBook ~100 Common English Proverbs (ebook) pdf.pdf
OH TEIK BIN
 
Iván Bornacelly - Presentation of the report - Empowering the workforce in th...
EduSkills OECD
 
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
Life and Career Skills Lesson 2.pptxProtective and Risk Factors of Late Adole...
ryangabrielcatalon40
 
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
How to Configure Taxes in Company Currency in Odoo 18 Accounting
Celine George
 
DIGESTION OF CARBOHYDRATES ,PROTEINS AND LIPIDS
raviralanaresh2
 
MATH 8 QUARTER 1 WEEK 1 LESSON 2 PRESENTATION
JohnGuillerNestalBah1
 
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
ENGLISH 8 REVISED K-12 CURRICULUM QUARTER 1 WEEK 1
LeomarrYsraelArzadon
 
Indian National movement PPT by Simanchala Sarab, Covering The INC(Formation,...
Simanchala Sarab, BABed(ITEP Secondary stage) in History student at GNDU Amritsar
 
How to Manage Wins & Losses in Odoo 18 CRM
Celine George
 
Connecting Linear and Angular Quantities in Human Movement.pptx
AngeliqueTolentinoDe
 
Andreas Schleicher_Teaching Compass_Education 2040.pdf
EduSkills OECD
 
The Gift of the Magi by O Henry-A Story of True Love, Sacrifice, and Selfless...
Beena E S
 
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.06.25.pdf
TechSoup
 
Lean IP - Lecture by Dr Oliver Baldus at the MIPLM 2025
MIPLM
 
WATERSHED MANAGEMENT CASE STUDIES - ULUGURU MOUNTAINS AND ARVARI RIVERpdf
Ar.Asna
 
Cooperative wireless communications 1st Edition Yan Zhang
jsphyftmkb123
 
Free eBook ~100 Common English Proverbs (ebook) pdf.pdf
OH TEIK BIN
 

CNIT 127: Ch 18: Source Code Auditing

  • 1. CNIT 127: Exploit Development
 
 Ch 18: Source Code Auditing Updated 4-10-17
  • 2. Why Audit Source Code? • Best way to discover vulnerabilities • Can be done with just source code and grep • Specialized tools make it much easier
  • 3. Cscope • A source code browsing tool • Useful for large code trees, such as the whole Linux kernel • Many useful search functions • Cbrowser: GUI front-end • Links Ch 18a, 18b
  • 4. Ctags • Indexes source code • Creates a tag file with locations for language tags in files scanned • Works in many languages, including C and C++ – Link Ch 18c
  • 5. Text Editor • Vim and Emacs have features that make writing and searching though large amounts of code easy • Bracket-matching: find matching ([{
  • 7. Splint • Badly out-of date (last revised in 2007) • Output a little hard to understand – Links Ch 18d, 18e
  • 8. • Many available, specialized by language • Link Ch 18f
  • 9. • Easy to use • Finds about half the obvious vulnerabilities we've exploited
  • 11. Finds Some Vulnerabilities • But not the overflow!
  • 12. Format String Vulnerability • It doesn't find it at all!
  • 13. Flawfinder • Much better • In Kali • apt-get update • apt-get install flawfinder
  • 15. Top-Down (Specific) Approach • Search for specific lines of vulnerable code, such as format string errors • Auditor doesn't have to understand application in depth • Misses vulnerabilities that span more than one part of the code
  • 16. Bottom-Up Approach • Auditor reads large portion of code • Starting at main() • Time-consuming but can reveal subtle bugs
  • 17. Selective Approach • Most auditors use this approach • Locate code that can be reached with attacker-defined input • Focus energy on that code • Learn the purpose of that code thoroughly
  • 19. Generic Logic Errors • Requires good understanding of an application – And internal structures and classes • Example: wildcard certificates – Pascal-based CA will sell a certificate for * 0.evil.com – C-based browser will see it as *, a wildcard • Link Ch 18g
  • 20. (Almost) Extinct Bug Classes • Unbounded memory copy functions – strcpy(), sprintf(), strcat(), gets(), … • Hunted nearly to extinction
  • 21. Root Cause (from Microsoft)
  • 23. Format Strings • Easy to find with a code audit – Although cppcheck failed • Often found in logging code • Vulnerable only if attacker controls the format string
  • 24. Generic Incorrect Bounds-Checking • Coder attempts to check limits, but does it incorrectly • Example: Snort RCP Processor (2003) – Processes a series of RPC fragments – Checks each fragment to make sure it's not larger than the buffer – But it should check the total size of all combined fragments
  • 26. Loop Constructs • Coders often use intricate loops, and loops within loops • Complex interactions can lead to insecurities • Led to a buffer overflow in Sendmail • Link Ch 18h
  • 28. Off-by-One Vulnerabilities • Often caused by improper null- termination of strings • Frequently found in loops or introduced by common string functions • Can lead to arbitrary code execution
  • 29. Example from Apache • When both if statements are true – Space allocated is one byte too small – memcpy will write one null out of bounds
  • 30. OpenBSD ftp Daemon • If last character is a quote, it can be written past the bounds of the input buffer
  • 31. strncat() • Strncat always null-terminates its output string • Will write a null byte out of bounds unless the third argument is equal to the remaining space in the buffer minus one byte
  • 32. Non-Null Termination Issues • If a string is not terminated with a null – Memory after the string is interpreted as part of the string – May increase length of string – String writes may corrupt memory outside the string buffer – Can lead to arbitrary code execution
  • 33. strncpy() • If there's not enough space in the destination buffer – strncpy() won't null-terminate the string it writes
  • 34. strncpy() Example – First strncpy won't null-terminate not_term_buf – Second strcpy is unsafe, even though both buffers are the same size – Fix it by adding this line of code after the first strcpy
  • 35. Skipping Past Null-Termination • String-processing loops that process more than one character at a time – Or where assumptions about string length are made • Can make it possible to write past end of a buffer – Possible arbitrary code execution
  • 36. Example from Apache • This line is intended to skip past :// in a URL – cp += 3
  • 37. But Not All Schemes End in :// • If the URI is ldap:a – The null byte is skipped
  • 38. Signed Comparison Vulnerabilities • Coder attempts to check input length • But uses a signed integer variable • Or two different integer types or sizes – C sometimes converts them both to signed integers before comparing them • Following example from Apache – Led to code execution on Windows and BSD Unix
  • 39. Example from Apache • bufsize is a signed integer – Remaining space in the buffer • r->remaining is signed – Chunk size from the request • len_to_read should be the smaller of the two – Negative chunk size tricks the code into performing a large memcpy later, because it's cast to unsigned
  • 41. • Link Ch 18l
  • 42. • A hashed password can begin with 0e and contain only digits (very rare) – Like 0e12353589661821035685 • PHP reads that as scientific notation – 0^123… – Always zero (link Ch 18j)
  • 43. Double Free Vulnerabilities • Freeing the same memory chunk twice • Can lead to memory corruption and arbitrary code execution • Most common when heap buffers are stored in pointers with global scope • Good practice: when a global pointer is freed, set it to Null to prevent it being re- used • Prevents dangling pointers
  • 44. Out-of-Scope Memory Usage Vulnerabilities • Use of a memory region before or after it is valid • Also called "Dangling Pointer" – Image from Wikipedia • Link Ch 18k)
  • 45. Uninitialized Variable Usage • Static memory in the .data or .bss sections of an executable are initialized to null on program startup • But memory on the stack or heap is not • Uninitializes variables will contain data from previous function calls • Argument data, saved registers, or local variables from previous function calls
  • 46. Uninitialized Variable Usage • Rare, because they can lead to immediate program crashes • So they get fixed • Look for them in code that is rarely used • Such as handlers for uncommon errors • Compilers attempt to prevent these errors
  • 47. Example • If data is null – test is never assigned any value – But test is still freed
  • 48. Exploitation • The "uninitialized" data in test is not random • It comes from previous variables and function calls • It may be controlled by the attacker • So the free() leads to a controllable memory write – Arbitrary code execution
  • 49. Use After Free Vulnerabilities • Heap buffers are temporary – Released with free() • But a program may use a pointer after free() – If more than one variable points to the same object • Allows an attacker to write to RAM – Possible arbitrary code execution
  • 50. Multithreaded Issues and 
 Re-Entrant Safe Code • A global variable is used by more than one thread, without proper locking – A variable might be changed unexpectedly by another thread • Such issues won't appear until the server is under heavy load – May remain as intermittent software bugs that are never verified