Application Security
Application Security
1
Scope & Learning Objectives
This presentation:
• won't teach you everything you need to
know
• will present an overview of the subject
area
» this will help you prepare your plan of
study and identify areas you need to
strengthen
What is in this domain?
Software Engineering
Threats and Countermeasures
Database Systems security
Web Application Security
CISSP Prep Guides
Software controls
• vs environment
Software lifecycle
• Change control
Object-oriented components
Some technologies
• Java, etc...
Why Secure Software?
(Motivation)
Appliances (e.g., firewalls) do not
provide complete security
• Insider attacks
• Bypassed by proxy servers, VPNs
Same software can be used by
different users with different
privileges
Many security layers help
Security Approaches
Black Lists
• Forbid known bad things (or look for
them)
• Always one step behind
• Prone to failure as attackers figure out
ways around the blocks
White Lists
• Allow only what's known to be safe
• Make it provably safe
Software Engineering Areas
Requirements
Design
Construction
Testing
Maintenance
See: “Software Engineering Body of Knowledge”
a.k.a. “SWEBOK”
Requirements
Security functional
• Logging
• Password quality checks
Security Assurance
• Testing
• Code audits
» Code checking tools
Policies
Procedures
Standards
Guidelines
e.g., must get approval to make a
code change
Physical Controls
Security vs functionality
Threats, Vulnerabilities and
Attacks
Vulnerabilities and the Software
Development Life Cycle
• Object-Oriented Programming
• Capability-Maturity Model
Malware definitions
Detecting attacks
• Expert systems and artificial intelligence
Software Development Life
Cycle (SDLC)
Feasibility study
Requirements definition
Design
Implementation
Integration and testing
Operations and maintenance
Simplified SDLC
“Construction” in SWEBOK
corresponds to which SDLC phase?
Vulnerabilities & Flaws
Input validation
• Boundary identification and formation
• Input awareness
• Taint tracking
Secure programming principles
Code checkers
Code integrity with formal methods
Principles
Least privilege
Economy of mechanism
Complete mediation
Open design
Separation of privilege
Psychological acceptability
Instance
Inheritance
Polymorphism
• Common methods defined by a common
parent class (superclass)
Polyinstantiation
Object Request Brokers (ORB)
Capability Maturity Model
Attack code
• Attack code aims at exploiting vulnerabilities, and
is commonly found in the form of attack scripts
or proof-of-concept exploits. Worms are another
example of attack code. Malicious code isn’t
necessarily attack code, but its mere presence
may imply that the system was compromised by a
prior attack. Malicious code resident on a victim
computer and performing an undesirable
function, such as spyware, rootkits or backdoors,
is to be differentiated from attack code that
exploits vulnerabilities.
Definitions
Parasitic code
• Parasitic code is code that is attached or included
in another document or executable and violates
its integrity. Intended or original properties of
the document or executable must be identifiable
in order to determine the presence, nature and
extent of the parasite. Parasitic code is not
necessarily attack code.
Definitions
Back-Door
• A back-door is code bypassing policy-approved user
authentication mechanisms. Back-doors are usually
hidden, hard to discover, and inserted and used for
malicious purposes. For example, a remote user may
issue commands as root through a previously installed
back-door. Some back-doors are created by
programmers for reasons of convenience (e.g., remote
maintenance) and so the original intent may not be
malicious. However, back-doors that violate security
policies must be considered malicious, based on their
behavior alone. Remote access mechanisms operating
within policy are not to be confused with back-doors.
Definitions
Trojan
• Code that gets executed by deceiving a user is a
trojan (the deception aspect implies
maliciousness, even if it is a mild prank). Trojans
can carry and be the initial entry mechanism for
malicious code of another nature (e.g., a back-
door or keylogger).
Definitions
Code Red
Blaster
SQL Slammer
Nachi (Welchia)
Be prepared to answer a few
questions about viruses and worms
Definitions
Spyware
• Spyware is code that reports user activities and
system information to “unauthorized” parties
(who is “unauthorized” may depend on
perspective). An example is an “unauthorized”
keylogger. Spyware could also take “interesting”
forms such as being a virus, and reporting when a
certain type of document is opened.
Definitions
Rootkit
• A rootkit is a set of software artifacts that
attempts to conceal its existence and execution
(and possibly that of other malicious software as
well) from the rest of the operating system, other
processes or security tools, and consequently
from users and administrators. Typically a
rootkit subverts or replaces the utilities included
with an operating system for the purposes of
hiding a compromise and a back-door. A rootkit
may include attack code as one of its components
and may resist removal.
Definitions
Distributed code
• Distributed code has coordinated copies of itself on
many hosts. By acting in a coordinated fashion, the
distributed code attempts goals that would likely be
unreachable for a single copy. The coordination
mechanism may be the reception of commands, or
interactions between copies or with a controller.
Blindly following specially crafted rules of conduct
may also result in the overall desired behavior. Worms
have been known to include a time bomb for attacking
a pre-determined target at a given time, resulting in a
distributed attack.
Distributed Code: Botnets
e.g., Tripwire
Database Security
Database types
Database access control mechanisms
Database integrity
Database attacks and
countermeasures
Relational Databases
Views
• Only provide the data needed
Stored Procedures
• Code executed in the database
Roles
• Avoid errors in the repetitive assignment
of permissions to users
• Reason about types of users
Stored Procedures
Transactions
• Transactions are groups of database
operations that either fail or succeed as
a group
» e.g., read value A, calculate A-X, store
new value
– If A changes after reading and before
storing the new value, bad things could
happen
• Transactions preserve invariants
Database Attacks and
Countermeasures
Attack: SQL injection
• Uses meta-characters such as ' ” ; in
data to change the meaning of
commands sent to the database
Countermeasure: Parameterized
Queries
• Send the commands and data separately
so there can be no confusion
Web Application Security
Trust Analysis
Polluted web sites
• Cross-site scripting
• Malicious ads
Malicious web sites
Client-side scripting as an attack
vector
Trust Analysis
XSS
• Strong input validation
» White list approach: define what's
allowed and reject everything else
CSRF
• Every form should contain a secret value
set for each user at every session
» Receiving script should check that this
secret is present
Session Fixation
Wikipedia
CISSP prep guide (Krutz and Vines)
My secure programming materials
(CS390S)
• www.cs.purdue.edu/homes/cs390s
Matt Bishop's “Computer Security: Art
and Science”