CH11
CH11
Software Security
Table
11.1
CWE/
SANS TOP
25 Most
Dangerous
Software
Errors
(2011)
(Table is on page
359 in the textbook)
Security Flaws
• Critical Web • These flaws occur as a
consequence of
application insufficient checking and
security flaws validation of data and
include five related error codes in programs
to insecure • Awareness of these issues
software code is a critical initial step in
• Unvalidated input writing more secure
• Cross-site scripting program code
• Buffer overflow • Emphasis should be
• Injection flaws placed on the need for
• Improper error software developers to
handling address these known
areas of concern
Reducing Software
Vulnerabilities
• The NIST report NISTIR 8151 presents a range
of approaches to reduce the number of software
vulnerabilities
• It recommends:
• Stopping vulnerabilities before they occur by using
improved methods for specifying and building
software
Explicitly
validate
Must identify all assumptions on
data sources size and type of
values before
use
Input Size & Buffer
Overflow
• Programmers often make assumptions
about the maximum expected size of input
• Allocated buffer size is not confirmed
• Resulting in buffer overflow
• Testing may not identify vulnerability
• Test inputs are unlikely to include large enough
inputs to trigger the overflow
Disadvantage is that
Range of inputs is bugs triggered by
very large other forms of input
would be missed
Developed by Professor
Barton Miller at the
University of Wisconsin Combination of
Madison in 1989 Intent is to approaches is
determine if the needed for
program or function reasonably
correctly handles comprehensive
abnormal inputs coverage of the
inputs
Simple, free of
assumptions, cheap
Assists with
reliability as well as
security
Writing Safe Program
Code
• Second component is processing of data by some
algorithm to solve required problem
• High-level languages are typically compiled and
linked into machine code which is then directly
executed by the target processor
Security issues:
• Correct algorithm implementation
• Correct machine instructions for
algorithm
• Valid manipulation of data
Correct Algorithm Implementation
Another variant is
Initial sequence when the
Issue of good program numbers used by programmers
development many TCP/IP deliberately include
technique implementations are additional code in a
too predictable program to help test
and debug it
Often code remains in
production release of a
program and could
Algorithm may not inappropriately release
correctly handle all Combination of the information
problem variants sequence number
as an identifier and May permit a user to
authenticator of bypass security checks
packets and the and perform actions
failure to make they would not
them sufficiently otherwise be allowed to
perform
Consequence of unpredictable
deficiency is a bug enables the attack
in the resulting to occur
This vulnerability was
program that could exploited by the Morris
be exploited Internet Worm
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
• Requires comparing machine code with
original source
• Slow and difficult
• Development of computer systems with very
high assurance level is the one area where
this level of checking is required
• Specifically Common Criteria assurance level of EAL
7
Correct Data
Interpretation
• Data stored as • Different languages
bits/bytes in provide different
computer capabilities for
restricting and
• Grouped as words or validating
longwords interpretation of
• Accessed and data in variables
manipulated in
memory or copied into • Strongly typed languages
processor registers are more limited, safer
before being used • Other languages allow
• Interpretation more liberal
depends on machine interpretation of data and
instruction executed permit program code to
explicitly change their
interpretation
Correct Use of
Memory
• Issue of dynamic memory allocation
• Unknown amounts of data
• Allocated when needed, released when done
• Used to manipulate Memory leak
• Steady reduction in memory available on the heap to
the point where it is completely exhausted
Least privilege
• Run programs with least privilege needed to
complete their function