ch11 2025
ch11 2025
Chapter 11
Software Security
Information Security
2025 Fall Semester
Younho Lee
Learning Objective (1/2)
❖ Describe how many computer security vulnerabilities are a result of poor
programming practices
2
Learning Objective (2/2)
❖Describe problems that occur in implementing some algorithms
3
Software Security Issues (1/7)
4
CWE/SANS Top 25 Most Dangerous Software Errors (2022)
5
Software Security Issues (1/7)
❖ It recommends:
▪ Stopping vulnerabilities before they occur by using improved methods for
specifying, designing, and building software
6
Software Security Issues (3/7)
7
Software Security Issues (4/7)
❖ Key rule is to never assume anything, check all assumptions and handle
any possible error states
8
Software Security Issues (5/7)
9
Software Security Issues (6/7)
10
Software Security Issues (7/7)
Security by Design
❖ Security and reliability are common design goals in most engineering
principles
▪ Society is intolerant of bridge collapsing, building falling down, or airplanes
crashing
❖ Software development not as mature
▪ Society tolerates far higher levels of failure in software
❖ Recent years have seen increasing efforts to improve secure software
development processes
▪ SAFECode (Software Assurance Forum for Excellence in Code)
11
Handling Program Input (1/15)
Explicitly validate
Must identify all assumptions on size
data sources and type of values
before use
12
Handling Program Input (2/15)
13
Handling Program Input (3/15)
14
Handling Program Input (4/15)
Injection Attacks
❖ Flaws relating to invalid handling of input data,
specifically when program input data can accidentally or
deliberately influence the flow of execution of the program
15
Handling Program Input (5/15)
❖ Finger form
16
Handling Program Input (6/15)
17
Handling Program Input (7/15)
18
Handling Program Input (8/15)
19
Handling Program Input (9/15)
Commonly seen
in scripted Web XSS reflection
applications Exploit vulnerability
• Vulnerability involves assumption that • Attacker includes the
Attacks where the inclusion of script all content from malicious script
code in the HTML
input provided by content one site is content in data
equally trusted supplied to a site
one user is • Script code may need
subsequently to access data and hence is
output to associated with other permitted to
pages
another user • Browsers impose interact with
security checks and other content
restrict data access from the site
to pages originating
from the same site
20
Handling Program Input (10/15)
21
Handling Program Input (11/15)
22
Handling Program Input (12/15)
23
Handling Program Input (13/15)
24
Handling Program Input (14/15)
25
Handling Program Input (15/15)
Input Fuzzing
❖ Developed by Prof. Barton Miller at the University of
Wisconsin Madison in 1989
❖ Software testing technique that uses randomly generated
data as inputs to a program
▪ Range of inputs is very large
▪ Intent is to determine if the program or function correctly handles abnormal
inputs
▪ Simple, free of assumptions, cheap
▪ Assists with reliability as well as security
❖ Can also use templates to generate classes of known-
problem inputs
▪ Disadvantage is that bugs triggered by other forms of input would be missed
▪ Combination of approaches is needed for reasonably comprehensive
coverage of the inputs
26
Writing Safe Program Code (1/6)
❖ Processing of the input data according to some algorithm
→ the 2nd component of our model of computer program
Security issues:
• Correct algorithm implementation
• Correct machine instructions for algorithm
• Valid manipulation of data
27
Writing Safe Program Code (2/6)
28
Ensuring Machine Language Corresponds to
Algorithm
❖ Issue is ignored by most programmers
▪ Assumption is that the compiler or interpreter generates or executes code
that validly implements the language statements
29
Writing Safe Program Code (4/6)
30
10.1 Stack Overflows - Stack Buffer Overflow (11/15)
NOP
JMPSHORT POPA %esi
(Go ahead by 26 XOR From mov %al,
(0x58+0x06)
byte addresses) eax to 0x7(%esi)
eax
31
Writing Safe Program Code (5/6)
❖ Memory leak
▪ Steady reduction in memory available on the heap to the point where it is
completely exhausted
Race Conditions
❖ Without synchronization of accesses it is possible that values may be
corrupted or changes lost due to overlapping access, use, and
replacement of shared values
❖ Arise when writing concurrent code whose solution requires the correct
selection and use of appropriate synchronization primitives
❖ Deadlock
▪ Processes or threads wait on a resource held by the other
▪ One or more programs has to be terminated
*Example of race
condition
33
Interacting with The operating system and Other Programs (1/15)
34
Interacting with The operating system and Other Programs (2/15)
Environment Variables
❖ Collection of string values inherited by each process from
its parent
▪ Can affect the way a running process behaves
▪ Included in memory when it is constructed
▪ E.g.> LD_LIBRARY_PATH, PATH
35
Interacting with The operating system and Other Programs (3/15)
36
Interacting with The operating system and Other Programs (4/15)
37
Interacting with The operating system and Other Programs (5/15)
Privilege escalation
•Exploit of flaws may give attacker greater privileges
Least privilege
•Run programs with least privilege needed to complete their
function
38
Interacting with The operating system and Other Programs (6/15)
Root/Administrator Privileges
39
Interacting with The operating system and Other Programs (7/15)
Programs use system calls and standard library functions for common
operations
40
Interacting with The operating system and Other Programs (8/15)
❖ Standard recommendation
▪ Repeatedly overwrite the data contents with several distinct bit
patterns to minimize the likelihood of the original data being
recovered
Problems?
→ Buffering, File I/O scheduling
41
Interacting with The operating system and Other Programs (9/15)
42
Interacting with The operating system and Other Programs (10/15)
43
Interacting with The operating system and Other Programs (12/15)
44
Interacting with The operating system and Other Programs (13/15)
45
Interacting with The operating system and Other Programs (14/15)
▪ Once the program finishes using the file, it should be closed and kept unlinked
46
Interacting with The operating system and Other Programs (15/15)
47
Handling Program Output
❖ Final component is program output
▪ May be stored for future use, sent over net, displayed
▪ May be binary or text
❖ Programs must identify what is permissible output content and filter any
possibly untrusted data to ensure only valid output is displayed
▪ E.g.> removing all HTML markup, identifying the character set
48
Summary
❖ Software security issues ❖Handling program input
▪ Input size and buffer overflow
▪ Introducing software security and
▪ Interpretation of program input
defensive programming
▪ Validating input syntax
❖ Writing safe program code ▪ Input fuzzing
▪ Correct algorithm implementation ❖ Interacting with the
▪ Ensuring that machine language operating system and other
corresponds to algorithm programs
▪ Environment variables
▪ Correct interpretation of data
▪ Using appropriate, least
values
privileges
▪ Correct use of memory ▪ System calls and standard
▪ Preventing race conditions with library functions
shared memory ▪ Safe temporary file use
❖ Handling program output ▪ Preventing race conditions with
shared system resources
▪ Interacting with other programs
49