2. Software Vulnerability
2. Software Vulnerability
Chapter 2. Introduction to
Software Vulnerability
Bug
Vulnerability
(a.k.a security bug)
2
How does a bug occur?
■ Usually, programmers implicitly assume that users will
provide plain and benign inputs to the program
■ However, hackers provide creative and malicious inputs
that programmers did not expect
Program
Input Output
3
Example #1
■ Consider the python code below for bank application
▪ Takes in the amount of money you want to transfer
▪ Your balance and the recipient’s balance will be updated
my_balance = 1000
def send(recipient):
print("How much do you want to send?")
val = read_int()
if (val <= my_balance):
my_balance = my_balance – val
... # Increase the balance of recipient
def service():
username = read_from_packet()
logdir = "./log/" + username
cmdline = "mkdir %s" % logdir
os.system(cmdline)
int main(void) {
char buf[32];
printf("Input your name: ");
scanf("%s", buf);
printf("Your name: %s\n", buf);
return 0;
}
start end
CPU Memory:
Register large array
Register of bytes
...
11
In the next chapter, we will
review Intel x86-64 assembly
12