Software Flaws
Short Description
Download Software Flaws...
Description
SOFTWARE FLAWS
Examples • A NASA Mars Lander costing around a $165 million , crashed into Mars due to a software error in converting between different Metrics in Measurement. • Baggage handling system at the Denver airport was closed for 11 months costing a million dollars a day due to a Bug in the Software
• In 1996, the European Space agency’s US$1 billion prototype Ariane 5 rocket was destroyed less than a minute after launch, due to a Bug in the on‐board guidance computer program. • In June 1994, a Royal Air Force Chinook crashed into the Mull of Kintyre, killing 29. An investigation into the matter attributed it to a software Bug in the Aircrafts Engine Control Computer.
How Widespread is a Flaw • A Conservative estimate places the number of Bugs in a Software at 5 per 1000 lines of code(LOC). A typical computer might have 3000 executable files each of which contains approximately 100,000 LOC. Then on an average each executable file has 50 bugs, which implies about 150,000 bugs for a single computer!
Definition A Software Flaw is the common term used to describe an error, bug, mistake, failure or fault in a computer program that produces an incorrect or unexpected result or causes it to behave in an unintended way.
What causes Flaws • Most Bugs arise from errors in the source code or the design. • Errors may also creep in because of compilers producing incorrect code.
Classes of Software Flaws Broadly there are 3 classes of Software Flaws: • Buffer Overflow • Race condition • Incomplete mediation
Buffer Overflow • A Buffer Overflow is an anomaly where a program, while writing data to a buffer, overruns the buffer's boundary and overwrites adjacent memory. Consider an Example: A program has defined two data items which are adjacent in memory: an 8‐byte‐long string buffer, A, and a two‐byte integer, B. Initially, A contains nothing but zero bytes, and B contains the number 1979. Characters are one byte wide.
Buffer Overflow… varia ble name
A
B 1979
value [null string] hex 00 value
00
00
00
00
00
00
00
07
BB
Buffer Overflow… • Now, the program attempts to store the null‐ terminated string "excessive" in the A buffer. By failing to check the length of the string, it overwrites the value of B: varia ble name
A
B
value 'e'
'x'
'c'
'e'
's'
's'
'i'
'v'
25856
65
78
63
65
73
73
69
76
65
hex
00
Buffer Overflow… Although the programmer did not intend to change B at all, B's value has now been replaced by a number formed from part of the character string. In this example, on a big‐endian system that uses ASCII, "e" followed by a zero byte would become the number 25856. If B was the only other variable data item defined by the program, writing an even longer string that went past the end of B could cause an error such as a segmentation fault, terminating the process.
Protective Measures • Choice of programming language C and C++ provide no built‐in protection against accessing or overwriting data in any part of memory. More specifically, they do not check that data written to an array (the implementation of a buffer) is within the boundaries of that array.
Protective Measures… Many other programming languages provide runtime checking and in some cases even compile‐ time checking which might send a warning or raise an exception when C or C++ would overwrite data and continue to execute further instructions until erroneous results are obtained which might or might not cause the program to crash. Ex: Ada, Eiffel, Lisp, Modula‐2, Smalltalk, OCaml and such C‐derivatives as Cyclone and D. The Java and .NET bytecode environments also require bounds checking on all arrays.
• Use of safe libraries It is recommended to avoid standard library functions which are not bounds checked, such as gets, scanf and strcpy. Instead strlcpy, strlcat function should be used.
Race Condition A race condition occurs when multiple processes access and manipulate the same data concurrently, and the outcome of the execution depends on the particular order in which the access takes place.
Race Condition…
mkdir 2.Transfer Ownership
1.Allocate space
Race Condition
mkdir 3.Transfer Ownership
1.Allocate space
2. Create Link to password file
Incomplete Mediation • Inputs to programs are often specified by untrusted users. ‐Web‐based applications are a common example. • The web application needs to ensure that what the user has entered constitutes a meaningful request. This is called mediation.
• Incomplete mediation occurs when the application accepts incorrect data from the user • Sometimes this is hard to avoid – Phone number: 519-886-4567 – This is a reasonable entry, that happens to be wrong
• We focus on catching entries that are clearly wrong – Not well formed • DOB: 18-13-1988
– Unreasonable values • DOB: 12-10-1876
• What's the security issue here? • What happens if someone fills in: – DOB: 98764874236492483649247836489236492 • Buffer overflow?
– DOB: DROP DATABASE clients -• SQL injection?
• We need to make sure that any user‐supplied input falls within well‐specified values, known to be safe
Client‐side mediation • You've probably visited web site with forms that do client‐side mediation – When you click “submit”, Javascript code will first run validation checks on the data you entered – If you enter invalid data, a popup will prevent you from submitting it
• Related issue: client‐side state – Many web sites rely on the client to keep state for them – They will put hidden fields in the form which are passed back to the server when the user submits the form
Client‐side mediation • Problem: what if the user – Turns off Javascript? – Edits the form before submitting it? (Greasemonkey) – Writes a script that interacts with the web server instead of using a web browser at all? – Connects to the server “manually”? (telnet server.com 80)
• Note that the user can send arbitrary (unmediated) values to the server this way • The user can also modify any client‐side state
Example • At a bookstore website, the user orders a copy of the course text. The server replies with a form asking the address to ship to. This form has hidden fields storing the user's order –
• What happens if the user changes the “unitprice” value to “50.00” before submitting the form?
Defences against incomplete mediation • Client‐side mediation is an OK method to use in order to have a friendlier user interface, but is useless for security purposes. • You have to do server‐side mediation, whether or not you also do client‐side. • For values entered by the user: – Always do very careful checks on the values of all fields – These values can potentially contain completely arbitrary 8‐bit data (including accented chars, control chars, etc.) and be of any length
• For state stored by the client: – Make sure the client has not modified the data in any way
THANK YOU! PRESENTED BY: PRASHANT KUMAR ANOOP P. RAMACHANDRA CHANDRASHEKHAR B.
View more...
Comments