infosec
infosec
• Economy of mechanism
Trusted Systems
• Open design
• We say that software is trusted
• Complete mediation software if we know that the code
• Permission based has been rigorously developed and
analyzed, giving us reason to trust
• Separation of privilege that the code does what it is
• Least common mechanism expected to do and nothing more.
TCB DESIGN:
TCB Functions
o Process activation:
Changing from one process
to another requires a
complete change of
registers, relocation maps,
file access lists, process
status information, and
other pointers, much of
which is security sensitive
information.
o Execution domain
switching: Processes TCB Design
running in one domain often • The division of the OS into TCB and
invoke processes in other non-TCB aspects is convenient for
domains to obtain more or designers and developers because
less sensitive data or all security-relevant code is in one
services. (logical) part.
o Memory protection: • To ensure that the security
Because each domain enforcement cannot be affected by
includes code and data
stored in memory, the TCB
non-TCB code, TCB code must run
in some protected state.
Attacker Perspective
Phone Rootkit
• Attack should be difficult to detect
• The OS of a mobile phone is rather so your victim cannot find and try to
simple, although smartphones with eradicate your code.
their rich functionality demand a
more complex operating. • Two conditions can help you remain
undiscovered:
o Your code executing before • These functions in turn call NT
other programs that might Kernel “native mode” system
block your execution. functions, such as
NTQueryDirectoryObject. At the end
o You're not being detected as
of this call chain is a simple function
a file or process.
call: Load a number into a register
• If your code is introduced early to represent the specific system
enough, it can override other normal function to perform, and execute a
system functions that would detect call instruction to the operating
its presence. system kernel. The operating
system returns descriptive
information, and the higher-level
Rootkit Evades Detection functions format and present that
information.
• Malicious code consists of
executable files. To be able to
execute, malicious code must Rootkit Evades Detection
locate and invoke its pieces.
• The utility to present a file listing Rootkit Filtering File Description Result
uses primitives such as
FindNextFile() and
NTQueryDirectoryObject.
Other Rootkits
Rootkit Operates Unchecked • Not every rootkit is malicious.
• One objective of malicious code • Suppose you are a manager of a
authors is to escalate privilege, that company that handles very sensitive
is, to run with the greater privileges information (intellectual property,
of an administrator or more or the medical records of some
powerful user. high-profile patients).
o Your employees need this detection and prevention systems,
information internally for sometimes operate in a stealthy
ordinary business functions, and hard to-disable manner, just
but there is almost no like rootkits.
reason such information
• The two vulnerabilities that
should ever leave your
contribute to installation of rootkits
company.
are that the operating system is
o Because the value of this complex and not transparent.
information is so high, you
want to be sure nothing
sensitive is included in email
sent by your employees or
by a malicious process
acting under the name of an CHAPTER
employee.
FIREWALLS
WHAT IS A FIREWALL?
POLICY
• Because a firewall is executable
• A firewall implements a security
code, an attacker could
policy, i.e., a set of rules that
compromise that code and execute
determine what traffic can or
from the firewall’s device.
cannot pass through the firewall.
• A firewall system typically does not
• Network administrator should
have compilers, linkers, loaders,
determine what traffic to allow into
general text editors, debuggers,
a particular network.
programming libraries, or other
tools an attacker might use to • An example of a simple firewall
extend an attack from the firewall configuration is shown in Table. The
computer. table is processed from the top
down, and the first matching rule
• Firewalls implement a security
determines the firewall’s action.
policy that is specifically designed
to address what bad things might
happen.
• Disadvantages:
• Advantages:
Stateful Inspection Firewall
o Easy to set up and manage.
• Consider a probe against port 1: It
o Easy to block most traffic as
might be a legitimate attempt to
only requested transactions
connect to the service of port 1 OR a
are processed.
mistake, OR the start of a port scan
o Lower in cost and do not attack.
impact system
• The firewall records the address
performance.
100.200.3.4 that sent a connection
• Disadvantages: packet to port 1 at 01:37:26.
• Disadvantages:
o Cannot provide
authentication capabilities,
leaving networks vulnerable
to potentially spoofed traffic
sources.
4. Application Proxy
Stateful Inspection Firewall
• Also called as bastion host.
• Attackers try to break an attack into
• Applications are complex and
multiple packets by forcing some
sometimes contain errors.
packets to have very short lengths
so that a firewall cannot detect the • A flawed application, running with
characteristic of an attack split all-users privileges, can cause
across two or more packets. much damage. e.g., email delivery
agent to store incoming mail
• A stateful inspection firewall would
messages so that inside users can
track the sequence of packets and
read them.
conditions from one packet to
another to thwart such an attack. • Use: To protect organizations from
web application threats. These
firewalls can block access to
Stateful Inspection Blocking Multiple harmful sites and can prevent
Probes sensitive information from being
leaked from within a firewall.
Application Proxy
Personal Firewalls
Types of IDSs
• file hashes
• malicious domains
• Model-based IDS:
• If an attacker is instructing a
compromised internal machine to
initiate a DOS attack against other
• Think of an IDS as a state machine,
hosts on that network, a front-end
with a state for each of these steps
IDS will not notice that attack.
• The IDS needs to record which state
• But if one computer begins sending
it is in. Now multiply the number of
threatening packets to another
states to account for hundreds of
internal computer, the internal IDS
thousands of concurrent
can detect that.
connections by many users. The
logic of the IDS is complicated: • An internal IDS is also more
Many handshakes may be in protected from outside attack.
progress at any time, and the IDS
must maintain the state of each of • An internal IDS can learn typical
them. behavior of internal machines and
users so that if, for e.g., user A
suddenly started trying to access
protected resources after never
IDS State Machine
having done so previously, the IDS
could record and analyze that
anomaly.
Front End vs Internal IDSs
o No IP Address Assigned
Stealth Mode
o Polymorphic attacks:
Malicious software can
IDS Strengths and Limitations change its appearance
• An IDS that is not well defended is (code) frequently to bypass
useless. signature-based detection
methods.
Chapter-4 suppose the banking system
is designed so that a
Security Requirements of DB
message is generated in a
1. Integrity of the Database log each time a transaction
is processed.
• If a database is to serve as a central
repository of data, users must be o At system failure, the
able to trust the accuracy of the system can obtain accurate
data values. account balances by
reverting to a backup copy
• Assure that updates are done only of the database and
by authorized individuals. reprocessing all later
• Data must be protected from transactions from the log.
corruption by outside illegal 2. Element Integrity
program action and by outside force
such as a power failure. • The integrity of DB elements is their
correctness or accuracy.
• Integrity of a DB is affected:
• DBMSs sometimes take special
o when the whole database is action to help catch errors as they
damaged or are made and to correct errors after
o when individual data items they are inserted.
are unreadable. • This corrective action can be taken
• Integrity is the responsibility of the in three ways: by field checks,
DBMS, the OS, and the (human) through access control, and with
computing system manager. change log.
4. Access Control
• Access Control:
• Access Control:
5. User Authentication
▪ Consequently, the
DBMS locks any read
requests until a write
has been
completed.
• Probable Value
o It may be possible to
determine the probability
that a certain element has a
certain value.
2. Example Query: List NAME where • For example, with the sample
GENDER=M ∧ DRUGS=1 database, it might seem safe to
report student aid total by gender
3. This is clearly an attack because it
and dorm.
directly queries DRUGS.
• This seemingly innocent report
4. This query discloses that for record
reveals that no female living in Grey
ADAMS, DRUGS=1.
is receiving financial aid.
5. The DBMS might reject the query
• Thus, we can infer that any female
because it selects records for a
living in Grey (such as Liu) is
specific value of the sensitive
certainly not receiving financial aid.
attribute DRUGS.
This approach often allows us to
Inference: Direct Attack determine a negative result.
Tracker Attacks
• For example, to know how many 1. With a little logic, algebra, and luck
female Caucasians live in Holmes in the distribution of the database
Hall: count((GENDER=F) ∧ contents, it may be possible to
(RACE=C) ∧ (DORM=Holmes)). construct an algebraic linear
system of equations that returns
Tracker Attacks results relating to several different
• The DBMS finds the answer is 1 and sets.
blocks the answer to the query 2. For example, q1 – q2 = c3 + c5 and
because one record dominates the q3 – q4 = c3 – c5. Then, subtracting
result of the query. these two, we get c5 = ((q1 – q2) –
• Query: q = count((GENDER =F) ∧ (q3 – q4))/2.
(RACE=C) ∧ (DORM=Holmes)) 3. We can derive the others.
• This is of the form q = count(a ∧ b ∧ 4. Inference is difficult to control
c). because it can occur from algebraic
• Using rules of logic and algebra, we calculations beyond the scope of
can transform this query to: DBMS.
o q = count(a ∧ b ∧ c) = Aggregation
count(a) - count(a ∧ ¬(b ∧ • Building sensitive results from less
c)). sensitive inputs.
• So, the original query is equivalent • By knowing either the latitude or
to nonsensitive queries: longitude of a gold mine does you
o count(GENDER =F) minus no good. But if you know both
latitude and longitude, you can
o count((GENDER =F) ∧ pinpoint the mine.
((RACE≠C) ∨
(DORM≠Holmes))). • Think of police investigation as
starting with the entire population
• Because count(a) = 6 and count(a ∧ and narrowing the analysis to a
¬(b ∧ c)) = 5, we can determine the single person.
suppressed value easily: 6 – 5 = 1.
• If the police officers work in parallel,
• Neither 6 nor 5 is a sensitive count. one may have a list of possible
suspects, another may have a list
Linear System Vulnerability
with possible motive, and another
may have a list of capable persons.
• When the intersection of these lists friends can turn up in anybody’s
is a single person, the police have searches.
their prime suspect.
Geotagging
Aggregation
• Between 1 percent and 5 percent of
• Aggregation is nearly impossible for photos at sites such as Flickr,
a database management system to YouTube, and Craigslist contain
control because combining the data header data that gives the location
can occur outside the system, even where the picture was taken.
by multiple colluding users.
Tracking Devices
• For example, suppose the security
• Cell phones continually search for a
policy is that anyone can have either
nearby tower, RFID tags for
the latitude or longitude of the mine,
transportation or identification can
but not both.
be read by off-the-shelf devices,
• Nothing prevents you from getting and GPS navigation devices both
one, your friend from getting the send and receive position data.
other, and the two of you talking to
• Although we use these technologies
each other.
for good, we should be aware that
Analysis on Data they can be used to build a relatively
complete trail of our movements
Hidden Data Attributes
throughout the day.
• Objects such as pictures, music
• The problem with metadata is that it
files, and documents are complex
is not obvious to the object’s owner,
data structures having properties or
but it is well structured and readily
attributes that add meaning to the
available to anyone who wants to
data.
use it.
• These properties, called metadata,
Preventing Disclosure
are not displayed with the picture or
document, but they are not Data Suppression and Modification
concealed.
• There are no perfect solutions to the
• Numerous applications support inference and aggregation
selecting, searching, sorting, and problems.
editing based on metadata.
• Three methods to control them:
File Tags
o Suppress obviously
1. One use of attributes is tags for sensitive information,
pictures. thereby restricting the
usefulness of the database.
2. You might organize your photo
collection with tags telling who or o Track what the user knows.
what landmarks are in each photo.
▪ Extremely costly.
3. With Facebook, Picasa, Dropbox,
▪ Information must be
and hundreds of sharing sites,
maintained on all
photos intended for a few close
users.
▪ Does not check what must be withheld to
any two people may maintain security.
know together and
3. Concealing: The answer is close to
cannot address what
but not exactly the actual value.
a single user can
accomplish by using o It releases part or an
multiple IDs. approximation of sensitive
data.
o Disguise the data.
o More results can be given,
▪ Random
but their precision is lower.
perturbation and
rounding can inhibit 4. The choice between suppression
statistical attacks and concealing depends on the
that depend on exact context of the database.
values for logical
and algebraic Security Versus Precision
manipulation.
Statistical Suppression
•
• Government statistics show this
well: Census data, labor statistics,
and school results show trends and
patterns for groups (such as a
neighborhood or school district),
but do not violate the privacy of any
single person.
Multilevel Database
Confidentiality
Partitioning
Encryption
But a user can mount a chosen plaintext • Each field must be decrypted when users
attack. E.g., party affiliation of REP or DEM perform DB operations such as "select all
is stored in encrypted form in each record. records with SALARY > 10,000."
A user who achieves access to these
encrypted fields can easily decrypt by • Decrypting the SALARY field, even on
creating a new record with party=DEM and rejected records, increases the time to
comparing the resulting encrypted version process a query. • Thus, encryption is not
to that element in all other records. often used to implement separation in
databases.
Worse, if authentication data are
encrypted, the malicious user can Integrity Lock
substitute the encrypted form of his or her The lock is a way to provide both integrity
own data for that of any other user. and limited access for a database.
Using a different encryption key for each Each data item has three pieces:
record can solve this.
Checksum is computed across both data A sensitivity lock is a combination of a
and sensitivity label to prevent unique identifier (record number) and the
unauthorized modification of the data item sensitivity level.
or its label.
Each lock relates to one particular record.
Data item is stored in plaintext for
A malicious subject should not be able to
efficiency.
identify two elements having identical
sensitivity levels or identical data values
just by looking at the sensitivity level of the
lock.
Commutative Filters
Front end verifies user's authorization to When used at the record level, the filter
data. requests desired data plus cryptographic
checksum information; it then verifies the
Front end issues a query to the DB
accuracy and accessibility of data to be
manager.
passed to the user.
DB manager performs I/O access,
At the attribute level, the filter checks
interacting with low-level access control to
whether all attributes in the user's query are
achieve access to actual data.
accessible to the user and, if so, passes the
DB manager returns the query result to the query to the database manager. On return,
trusted front end. it deletes all fields to which the user has no
access rights.
The front end analyses the sensitivity levels
of the data items in the result and selects At the element level, the system requests
those items consistent with the user's desired data plus cryptographic checksum.
security level. When these are returned, it checks the
classification level of every element of every
Front end transmits selected data to the record retrieved against the user's level.
untrusted front end for formatting.
by the front-end filter, invisible to the
user.
Distributed Databases
• Although even this simple query Each user is restricted to a picture of the
becomes complicated because of the data reflecting only what the user needs to
added terms, these terms are all added see.
e.g., the registrar may see only the class
assignments and grades of each student at
a university, not needing to see
extracurricular activities or medical
records.
Window/View
Enforce technical measures, effective Implement procedures for auditing the data
logging, and monitoring to detect abuse. collected so you know when something is a
miss.
User access to data should be limited. E.g.,
limiting the number of records accessible in Consider whether you could justify
a day, access location restrictions, time of implementing network-based audit
day restrictions, etc. appliances which monitor all database
requests at a granular level and are
If there is a business need to perform
independent of all users.
arbitrary queries on data, access to and use
of this interface should be logged, regularly Denial of service (DoS)
audited, and limited to as few people as
Network-level Denial of Service (DoS)
possible.
attacks from the internet can overwhelm
Excessive privileges your system regardless of the capacity of its
internet connection.
If users hold privileges that exceed the
requirements of their job function, these Cloud-based DoS protection services.
privileges may be abused by the individual,
Resource consumption-based attacks,
or an attacker who compromises their
such as repeatedly sending complex search
account.
queries to exhaust server resources, require
When people move roles, they may be given a different approach, such as request rate
the new privileges they need. limiting.
Procedures which ensure that when staff Operating vulnerable unpatched services
change roles, their permissions are will significantly increase the likelihood of
updated to reflect this, with those no longer being compromised.
required being removed.
Make sure you maintain a complete and up-
Reviews of who holds which roles to to-date inventory of the software
confirm the procedures are working. components in your systems, including
third-party and open-source libraries in use.
Inadequate logging and weak auditing
Establish a vulnerability management
Logging and auditing are key to deterring
process which enables you to ascertain, on
and detecting misuse and enabling
a regular basis, what vulnerabilities are
investigation of suspected data
present within your systems and prioritize
compromise.
remediation.
Logging is the collection of data and
Insecure system architecture
auditing is someone actually looking at it.
While controls against specific DB threats
When considering your logging and auditing
are important, they must form part of a
requirements:
design that is secure overall.
If your DB contains mostly data used Impact of an SQL injection attack
internally but has a subset of data available
A successful SQL injection attack can result
externally, consider pushing the external
in unauthorized access to sensitive data,
data to an entirely separate database with
such as:
its own external application. That prevents
compromise of the public interface Passwords.
impacting internal data.
Credit card details.
Internet-facing remote access services
must be properly designed and robust. Personal user information.
This modifies the original query to: If this query is executed in the application
using simple string concatenation, the
SELECT product_name, price FROM
query becomes respectively:
products WHERE category = '' UNION
SELECT username, password FROM users - SELECT * FROM products WHERE id = 42
-'; and 1=1
The UNION SELECT part combines the SELECT * FROM products WHERE id = 42
result of the second query (from the users and 1=0
table) with the first query (from the products
If the application behaves differently in
table). The -- comments out the rest of the
each case, it is susceptible to boolean-
original query to prevent syntax errors.
based blind SQL injections.
Types of SQL injection attacks 2.
For Microsoft SQL Server, the attacker can
Inferential (Blind) SQLi
now supply the following value for
The attacker sends data payloads to the product_id:
server and observes the response and
42 AND (SELECT TOP 1 substring(name, 1,
1) FROM sysobjects WHERE id=(SELECT
TOP 1 id FROM (SELECT TOP 1 id FROM AND ascii(lower(substring(name, 1, 1))) =
sysobjects ORDER BY id) AS subq ORDER 'a')) WAITFOR DELAY '0:0:10'
BY id DESC)) = 'a'
If the name of the first table in the DB
The sub-query after 42 AND checks whether structure begins with the letter a, the
the name of the first table in the DB starts second part of this query will be true, and
with the letter a. the application will react with a 10-second
delay.
If true, the application will behave the same
as for the payload 42 AND 1=1. Rest of it like Boolean-based blind SQL
injections
If false, the application will behave the
same as for the payload 42 AND 1=0. Types of SQL injection attacks
java
Copy code
PreparedStatement statement =
connection.prepareStatement("SELECT *
FROM products WHERE category = ?");
statement.setString(1, input);
ResultSet resultSet =
statement.executeQuery();