Midterm Review
Midterm Review
Midterm Review
Other terminologies
System integrity: assures that a system performs its intended function in
an unimpaired manner, free from deliberate or inadvertent unauthorized
manipulation of the system.
Data integrity: assures that data received are exactly as sent by an
authorized entity.
Message integrity: Insuring that the message received by the recipient is
identical to the message transmitted by the sender.
Privacy: assures that individuals control or influence what information
related to them may be collected and stored and by whom and to whom
that information may be disclosed.
SECURITY MINDSET
Threats
A potential violation of security (the attack may not have been carried
out)
1. Unauthorized disclosure —— gains access to data for which the entity
is not authorized (passive attack)
Exposure: directly release sensitive data
Interception: an unauthorized entity directly accesses sensitive data traveling
between authorized sources and destinations (在正当传输中阻截).
Inference: indirectly accesses sensitive data by reasoning from characteristics or
byproducts of communications.
Intrusion: gain access to sensitive data by circumventing a system's security
protections.
SECURITY MINDSET
Shellcode
A small piece of code used as the payload in the exploitation of a software vulnerability
that can be executed once the code is injected into a running application. Stack and heap-
based buffer overflows are the most popular way of doing so.
The term shellcode literally refers to written code that starts a command shell.
However, Because the function of a payload is not limited to merely spawning a shell, some
have suggested that the name shellcode is insufficient.
Most shellcode is written in machine. Shellcode is therefore often created to target one
specific combination of processor, operating system and service pack, called a platform.
For some exploits, due to the constraints put on the shellcode by the target process, a very
specific shellcode must be created. However, it is not impossible for one shellcode to work
for multiple exploits, service packs, operating systems and even processors.
SOFTWARE SECURITY
So, for example, if you're reading your Yahoo mail but haven't done anything in a
while to load more information, your web browser might send a signal to Yahoo's
servers saying: "This is a 40 KB message you're about to get. Repeat it all back to me.
The Heartbleed vulnerability arose because OpenSSL's implementation of the
heartbeat functionality was missing a crucial safeguard: the computer never checks
to make sure the heartbeat was actually as long as it claimed to be. So if a request
said it was 40 KB long but was actually only 20 KB, the receiving computer would set
aside 40 KB of memory buffer, then store the 20 KB it actually received, then send
back that 20 KB plus whatever happened to be in the next 20 KB of memory. That
extra 20 KB of data is information that the attacker has now extracted from the web
server.
Even when a computer is done with information, it persists in memory buffers until
something else comes along to overwrite it. If you're the attacker, you have no way to
know in advance what might be lurking in that 20, but there are a number of
possibilities: SSL private keys, usernames and passwords (more commonly)
SOFTWARE SECURITY
Run-time defense
Executable address space protection: use virtual memory support to make some
regions of memory non-executable, requires support from memory management unit
(MMU)
Address space layout randomization (ASLR): a memory-protection process for
operating systems that guards against buffer-overflow attacks by randomizing the
location where system executables are loaded into memory.
Manipulate location of key data structures (stack, heap, global data), using random
shift for each process.
Randomize location of heap buffers
Randomize location of standard library functions
• Guard pages: If a program attempts to access an address within a guard page, the
system raises a STATUS_GUARD_PAGE_VIOLATION (0x80000001) exception.
OPERATING SYSTEM
Trusted computing base (what are they, what criteria should be met)
TCB requirements
1. tamper-proof
2. complete mediation
3. correct
TPM
A Trusted Platform Module is a microchip that is often built into a computer to
provide hardware-based security. It provides safe storage of encryption keys,
certificates and passwords.
It is the hardware module at heart of hardware/software approach to trusted
computing
OPERATING SYSTEM
Complete mediation
TCB
No protected resource (memory page or file) could be accessed without going through the TCB
TCB acts as a reference monitor that cannot be bypassed
User code
Cannot access OS part of address space without changing to system mode
Cannot access physical resources because they require privileged instructions which can only
be executed in system mode
OS
Virtualizes physical resources and provides an API for virtualized resources
File for storing persistent data on disk
Translation from virtual resource to physical resource can only be done by OS
Compromise of OS (TCB) impacts all applications, means attacker has access to everything!
OPERATING SYSTEM
Virtualization
Limiting the damage of a hacked OS: compromising of OS in VM1 only
impacts applications running on VM1
Meet the requirement of small and simpler: hypervisor partitions
physical resources and let guest OS handle management
Virtualization security concerns
Guest OS isolation -> ensures programs executing within a guest OS may only access
and use the resources allocated to it
Guest OS monitoring by the hypervisor -> hypervisor has privileged access to the
programs and data in each guest OS
Virtualized environment security -> particularly image and snap shot management
which attackers may attempt to modify
AUTHENTICATION
What is authentication
Authentication answers the question: on whose behalf the requesting
process runs?
Includes claims about an identity (who are you?) and verification of the
claimed identity (Are you who you say you are?) of the user who wants
to gain access to system and resource.
Methods (how is authentication implemented?)
Something a user knows —— knowledge factors (passwords, answers)
Something a user has —— possession factors (tokens, smart cards)
Something a user is —— inherence factors (static biometric: fingerprint,
retina, face)
Something a user does —— dynamic biometric (voice pattern, typing rhythm)
AUTHENTICATION
Authentication process
identification step
presenting an identifier to the security system
verification step
presenting or generating authentication information that corroborates the binding
between the entity and the identifier
Password selection strategy
Goal: choose non-guessable passwords, but still memorable
User education: Users can be told the importance of using hard-to-guess
passwords and can be provided with guidelines for selecting strong passwords.
>_<: Many users will simply ignore the guidelines.
>_<: Users may not be good judges of what is a strong password.
Computer-generated password
Quite random in nature.
>_<: Hard to remember. Even if the password is pronounceable, the user may have difficulty
remembering it and so be tempted to write it down
AUTHENTICATION
Reactive Password Checking: the system periodically runs its own
password cracker to find guessable passwords. The system cancels any
passwords that are guessed and notifies the user.
>_<: source intensive, because a determined opponent who is able to steal a
password file can devote full CPU time to the task for hours or even days.
>_<: any existing passwords remain vulnerable until the reactive password checker
finds them.
Proactive Password Checking: a user is allowed to select his or her own
password. However, at the time of selection, the system checks to see if
the password is allowable and if not, rejects it.
>_<: difficult to strike a balance between user acceptability and strength.
If the system rejects too many passwords, users will complain that it is too hard to
select a password. If the system uses some simple algorithm to define what is
acceptable, this provides guidance to password crackers to refine their guessing
technique.
AUTHENTICATION
4. Adding salt
One-way hash function is deterministic. Two users with the same password will have the
same hashes.
Salt: a fixed-length cryptographically-strong random value that is added to the input of has
functions to create unique hashes for every input.
Store salt along with username. When the user logs in , we can lookup the username, append
the salt to the provided password, hash it and verify the stored hash wit computed hash.
Prevent duplicate passwords from being visible in the password file.
Become nearly impossible to find out whether a person uses the same password on two or
more different systems.
Increase the difficulty of attacks: has to compute a rainbow table for each password
appended with a salt. Ideally, we want the salt to be truly random and unpredictable to bring
the attacker to a halt.
AUTHENTICATION
Other authentication methods
Something you have (Tokens, smart cards)
May require additional hardware (eg: readers)
Something you are (biometrics)
Do you get the same biometric measurement every time? —— probability distribution or a range for
feature values.
Threats:
Inherent imprecision (e.g., two people may have their fingerprints digitally interpreted as the same)
Impersonation (e.g., use a voice recording, take photo of a face)
Coercion (e.g., force the user to put his finger on the fingerprint reader)
Multi-factor authentication
Use more than on method (eg: type password but also send a code via SMS; other things like your
location)
Attacker must defeat both to compromise authentication
Network authentication
Send username and password to a server in a network
Introduces new problems: need crypto to secure network communication
ACCESS CONTROL
ACL vs C-List
ACL (access control list): for each object Oi -> [ (subject S1, rwx), (subject
S2, r), ... ]
C-list: for each subject Si -> [ (object O1, w), (object O2, r), ... ]
Discretionary access control (DAC) —— control access based on the
identity of the requestor.
Often provided using an access control matrix
>_<: so many entries in the matrix because you define access right for each
individual
>_<: cannot control if someone you share a file with will not further share the
data -> cannot control information flow
ACCESS CONTROL
RBAC vs ABAC
RBAC —— based on the roles that users have within the system
Role: abstraction of a group of individual.
In enterprise setting, access may be based on job function or role of a user
Users authenticate themselves to the system, can activate one or more roles for themselves
^_^: policy need not be updated when an individual leaves the organization
>_<: lack of context -> unable to model policies that depend on contextual details, such as
time, location, relationship between users.
>_<: role explosion ->each user often needs unique access rights. An ever-increasing
number of users requires an exponentially increasing number of roles to accommodate
various permission combinations
>_<: toxic combination -> various roles assigned to the same user could contain conflicting
data (eg: one role allows you to create new policy and another role allows you to approve it)
>_<: management nightmares -> with exponentially more roles, role engineering becomes
an increasing difficult task. Any attempts to audit or certify such an environment would be
fraught with management nightmares
ACCESS CONTROL
ABAC —— based on attributes of the user, the resource to be accessed and current
environmental conditions
Adding context by specifying individual attributes using natural language.
The context surrounding the user, their data and the interaction between the two are important to
provide access to the right user, at the right time and location, when certain regulation is met
Adopts a policy driven approach.
Attributes of subjects, objects and the environment are used to express rich policies.
SetUID
stands for set user ID on execution, a special type of file permission in Unix and
Unix-like operating systems. It is a security tool that permits users to run certain
programs with escalated privileges.
When an executable file's setuid permission is set, users may execute that program
with a level of access that matches the user who owns the file. For instance, when a
user wants to change their password, they run the passwd command. The passwd
program is owned by the root account and marked as setuid, so the user is
temporarily granted root access for that very limited purpose.
MANDATORY ACCESS CONTROL
Inference attacks and defenses (what are they, why are they bad, how to
defense against them)
Inference is the process of performing authorized queries and deducing
unauthorized information (based on premises known or assumed to be
true) from the legitimate responses received
DATABASE SECURITY
Eg: Consider a student grade database with ID, student standing, exam
score. Any student should be able to compute average score. The
attacker wants to find exact score of some student.
Inference attack when target takes the exam late -> compare average before target
takes the exam with average after target takes the exam.
Inference attack when only one student has junior standing in a senior class ->get
average score of students who have junior standing.
Defenses
Do not allow aggregate query results when the set of tuples selected is either too
small or too large.
Transform data by removing identifying information: Deidentification,
Anonymization, Perturbation (perturb the values of the database by a small error.
Statistical measures such as sum and mean will not be affected).
MALICIOUS CODE
Trojan horses
Hidden in an apparently useful host program
Performs unwanted/harmful function when the host program is executed
Viruses
Infect a program by modifying it
Self-copy into the program to spread
Four stages of viruses: dormant, propagation, triggering, execution
Rootkit
Resides in operating systems, modifies OS code and data structure
Helps user-level malware (hide from users <- not listed in “ls” command)
Worms
A worm virus is a malicious, self-replicating program that can spread throughout a
network without user intervention.
Worms cause damage similar to viruses, exploiting holes in security software and
potentially stealing sensitive information, corrupting files and installing a back door
for remote access to the system, among other issues.
MALICIOUS CODE
Ransomware
a type of malicious software that threatens to publish the victim‘s data or
perpetually block access to it unless a ransom is paid.
Crimeware
any computer program designed for the express purpose of conducting malicious
and illegal activities online. 主要目的是经济犯罪或窃取机密资料.
Keylogger
a type of malware that records every keystroke made by the user and saves that
information locally.
Spear phishing
an email or electronic communications scam targeted towards a specific
individual, organization or business. Although often intended to steal data for
malicious purposes, cybercriminals may also intend to install malware on a targeted
user‘s computer. (目标并非一般个人,针对特定公司、组织)
MALICIOUS CODE
Polymorphic
a type of malware that constantly changes its identifiable features in order
to evade detection. Many of the common forms of malware can be
polymorphic, including viruses, worms, bots, trojans, or keyloggers.
Macro virus
A virus that is written in a macro language: a programming language which is
embedded inside a software application, such as Microsoft Office, Excel,
PowerPoint. A macro virus infects documents but not the executable
portions of the code and executes each time a document is opened.
A machine executable virus code is attached to the beginning or end of an
executable program. When initiated, the infected program will first execute
the virus code and then the original code of the program. Since the virus
finally changes possession of control to the original program, if the harmful
action is performed quickly, a user is unlikely to notice any difference.
MALICIOUS CODE
Botnets
Bot: a compromised computer under the control of an attacker
Bot code (malware) on the computer communicates with the attacker’s
server (“botmaster”) and carries out malicious activities
Botnet: a net of bot controlled by an attacker to perform coordinated
malicious activities
DDoS attack
In DoS (denial-of-service) attack, the perpetrator seeks to make a machine or network
resource unavailable to its intended users by temporarily or indefinitely disrupting
services of a host. Typically accomplished by flooding the targeted machine with
superfluous requests in an attempt to prevent legitimate requests from being fulfilled
In DDoS (distributed denial-of-service) attack, the incoming traffic flooding the victim
originates from many different resources, making it impossible to stop the attack
simply by blocking a single source.
MALICIOUS CODE
UDP flood: an DDoS attack that floods a target with User Datagram Protocol (UDP)
packets. The goal of the attack is to flood random ports on a remote host. This causes
the host to repeatedly check for the application listening at that port, and (when
no application is found) reply with an ICMP ‘Destination Unreachable’ packet. This
process saps host resources, which can ultimately lead to inaccessibility.
SYN flood: an DDoS attack which exploits a known weakness in the TCP
(transmission control protocol) connection sequence (the “three-way handshake”),
wherein a SYN request to initiate a TCP connection with a host must be answered by a
SYN-ACK response from that host, and then confirmed by an ACK response from the
requester. In a SYN flood scenario, the requester sends multiple SYN requests, but
either does not respond to the host’s SYN-ACK response, or sends the SYN requests
from a spoofed IP address. Either way, the host system continues to wait for
acknowledgement for each of the requests, binding resources until no new
connections can be made, and ultimately resulting in denial of service
MALICIOUS CODE
Payload
In the world of malware, payload is used to describe what a virus, worm or
trojan horse is designed to do on a victim’s computer. Eg: damage to data, theft
of confidential information, damage to computer-based systems or processes.
“有效负载”, 病毒代码中实现恶性动作功能的部分
Malware analysis
Static analysis: attempts to understand what a malware instance would
do if executed (do not run program)
Dynamic analysis: attempts to understand what a program does when
executed (run program and exam the behavior)
FIREWALLS
Design goals
Enforcement of security policies
All traffic from internal network to the Internet, and vice versa, must pass through the firewall
Only traffic authorized by policy is allowed to pass
Dependable
The firewall itself is immune to subversion
Attack Countermeasure
IP address spoofing: the creation of IP packet with a false Discard packet with an inside source
source IP address for the purpose of impersonating another address if the packet arrives on an
computer. (the sender’s address in the header can be external interface.
altered, so that to the recipient it appears that the packet
came from another source)
Source routing attack (aka path addressing attack): the Discard all packets that use the option of
attacker specifies the route to be taken by the packet with a source routing.
hope to fool the firewall.
Tiny fragment Enforcing the rule that the first fragment
of a packet must contain a predefined
minimum amount of the transport header.
FIREWALLS
Application-level gateway
An application program that runs on a firewall system between two networks
Implemented through a proxy server, which acts as an intermediary between a client
and a server.
Consists of security components that augment a firewall
>_<: additional processing overhead on each connection
Bastion hosts
Serves as a platform for an application-level gateway
System identified as a critical strong point in the network’s security
A bastion host is a special purpose computer on a network specifically designed and
configured to withstand attacks.
Runs secure OS and only essential services -> the computer generally hosts a single
application, for example a proxy server, and all other services are removed or limited
to reduce the threat to the computer.
FIREWALLS