Syssec 01
Syssec 01
Syssec 01
Aurlien Francillon
francill@eurecom.fr
Administrativa...
About me
Recent Assistant professor at Eurecom
Doing security research
About
Security Mindset
The goal of this course is not ( only ) to stuff your
brains with lots of technical attacks
But to teach you to think as an attacker
This is a necessary state of mind in security
One can't secure a system without being aware of ways to
break it...
B. Schneier Law
Any person can invent a security system so clever that he
or she can't imagine a way of breaking it.
See also:
http://www.schneier.com/blog/archives/2008/03/the_security_mi_1.html
Administrative Issues
Mode
Lectures covering different practical security aspects
Security challenges (e.g., cracking web applications, using
security tools, stack-based buffer overflows,...)
Ideally one challenge every 2 weeks
The challenge system will be deployed soon
There will be one Lab session to help you to start/setup
Challenges will be part of the final grade, do them !
Written final exam (February)
Lectures in SysSec
Topics we will likely cover
1. Host security
Unix / Windows / OSX security overview (3h)
Smartphone security (3h)
Race conditions, memory corruption exploitation (2*3h)
Trusted computing (3h)
2. Network security (2*3h)
Wired / wireless
Protection
3. Web security and vulnerabilities (2*3h)
4. Software testing (i.e., finding vulnerabilities) (3h)
5. Malware overview (3h)
6. Guest lectures TBD
12
SysSec Lab
Assignments
Starting date 24/10
5 challenges (expected, maybe more)
5 points per challenge solved
Environment
One lab session on 24/10, TA (Onur, Florian) will help
setting up ssh and help with the challenge
In general assignments should be mostly solved at home /
any computer with Internet connection and ssh enough
Submission
Automatic checking with immediate feedback
Everything you do is monitored
Cheating will be detected and sanctionned
13
Printouts ?
No printouts
I'll put the final slides on-line the evening after the
lecture
I'll try sometimes in advance but no promises
e.g., Thursday evening
#!/bin/bash
One vulnerability fuond in bash
Does not parses environemnt variables
Allows command/code injection
Especially bad when the
#!/bin/bash
One vulnerability found in bash
Does not parses environment variables properly
Allows command/code injection
Vulnerabilities
7000
6000
5000
4000
3000
2000
1000
0
1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010
http://web.nvd.nist.gov/view/vuln/statistics
24
30
31
Klikparty, 2007
32
http://nakedsecurity.sophos.com/koobface/
33
Terminology
Black Hat: a cracker, someone bent on breaking into
the system you are protecting
White hat: usually associated to friendly security
specialists
Script Kiddie: lowest form of cracker; script kiddies do
mischief with scripts and programs written by others,
often without understanding the exploit they are using
Terminology
What is an attack?
no easy answer, it depends
36
Terminology
What you want to protect?
defines assets
Terminology
What do you want to protect against?
threat model
risk analysis
Attack
any maliciously intended act against a system or a
population of systems
any action that violates a given security policy
38
Threats vs Vulnerabilities
A Threat defines who might attack against what assets,
using what resources, with what goal in mind,
when/where/why, and with what probability
Vulnerabilities are specific weakness in security that could
be exploited by adversaries with a wide range of
motivations and interest in a lot of different assets
Threat: Thieves could break into our facility and steal our equipment
Vulnerability: The lock we are using on the building doors is easy to pick
or bump
Threat: Adversaries might install malware in the computer so they can
steal social security numbers for purposes of identity theft.
Vulnerability: The computer do not have up to date virus signatures
awareness
A full disclosure policy has been advocated by many
respected researchers, provided that...
The information disclosed has been already distributed to
the parties that may provide a solution to the problem (e.g.,
vendors)
See: Responsible vulnerability disclosure process
(IETF Internet Draft)
Security Overview
Security Threats
Information Domain
Leakage
acquisition of information by unauthorized recipients, e.g.,
Password sniffing
Tampering:
unauthorized alteration/creation of information (including
programs)
e.g., change of electronic money order, installation of a
rootkit
42
Security Threats
Operation Domain
Resource stealing
(ab)use of facilities without authorization
Vandalism
interference with proper operation of a system without gain
43
Security Overview
Security issues at various stages of application life-cycle
mistakes, vulnerabilities, and exploits
avoidance, detection, and defense
Architecture
security considerations when designing the application
Implementation
security considerations when writing the application
Operation
security considerations when the application is in production
44
Security Overview
Architecture and design
validation of requirements (building the right model)
verification of design (building the model right)
Common problems
authentication and privileges
session replay
principle of least privilege
denial of service
45
Security Overview
Implementation
verification of implementation
classic vulnerabilities (often programming-language-specific)
Common problems
buffer overflows
Static: stack-based buffer overflows
Dynamic: heap-based buffer overflows
input validation
URL encoding
document root escape
SQL injection
back doors
46
Security Overview
Operation
decisions made after software is deployed
often not under developers control
Common problems
denial of service (DOS)
network DOS
distributed DOS, zombies
administration problems
weak passwords
password cracking
unsafe defaults
47
Insecure Software
.or, why good people write bad code
Technical factors
complexity of task
Economic factors
deadlines
insufficient funding
Human factors
mental models
social factors
48
Technical Factors
Complexity
algorithmic complexity
parallel processes, threads
multi-user
Indeterminism
Composition
incorrect assumptions
surprising interactions
Changes
consequences are hard to predict
example: Sun tarballs
Small change leads to leaking password hashes
Debian RNG: remove unintialized read
49
Economic Factors
Production pressure
not enough time
not enough manpower for testing
Legacy software
50
Human Factors
Poor risk assessment
invisible enemy
Mental models
only check for errors that are understood
assume software is used for a specific task
51
Improvement
Tools
detect mistakes and vulnerabilities
support programmer
formal verification
Education
thats what we are trying to do here ;-)
52
Methods of attacking
Eavesdropping
getting copies of information without authorization
Masquerading (impersonating)
sending messages with others identity
Message tampering
change content of message
53
Methods of attacking
Replaying
store a message and send it again later, e.g., resend a
payment message
Exploiting
using bugs in software to get access to a host
Combinations
Man in the middle attack
emulate communication of both attacked partners (e.g., cause
havoc and confusion)
54
Social Engineering
The art and science of getting someone to comply to
your wishes
Security is all about trust.
Unfortunately, the weakest link, the user, is often the target
57
Password Examples
The Bad
acmilan1
mymusic2
bermuda6
konrad4868
The Good
#bdiBuM1a
Qa56Fge(/
sdFOiKqw=
58
Password managers
Design and
Architectural Principles
Overview
Architecture
security considerations when designing the application
Implementation
security considerations when writing the application
Operation
security considerations when the application is in use
61
Microsoft SDL
Software architecture
A representation of an engineered software system, and the
process and discipline for effectively implementing the design(s)
for such a system
Representation
architecture concerned with components and their relationships
Process
steps are provided that describe how to change design
within set of constraints
Discipline
set of principles how to design system within constraints
63
Security Architecture
What is a security architecture?
A body of high-level design principles and decisions that
allow a programmer to say "Yes" with confidence and "No" with
certainty.
A framework for secure design, which embodies the four classic
stages of information security: protect, deter, detect, and react.
66
Vasa Today
67
Architecture is Important
Cost of fixing security flaws during different development phases
(cost = 60)
(cost = 15)
Cost
(cost = 6.5)
(cost = 1)
Design
Testing
Implementation
Post-Release
Time
68
69
Design Principles
Design is a complex, creative process
No standard technique to make design secure
But general rules derived from experience
Economy of Mechanism
Fail-safe defaults
Complete mediation
Open design
Separation of privilege
Least privilege
Least common mechanism
Psychological acceptability
70
Economy of Mechanism
Design should be as simple as possible
KISS -- keep it simple, stupid
Brian W. Kernighan
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.
71
Fail-safe Defaults
Allow as default action
Fail-safe Defaults
Configuration
secure initial configuration
easy (re)configuration
Error messages
should be very generic
additional information in log files
73
Complete Mediation
Complete access control
check every access to every object
include all aspects (normal operation, initialization,
maintenance, ...)
caching of checks is dangerous
identification of source of action (authentication) is crucial
Trusted path
make sure that user is talking to authentication program
important for safe login (thwart fake logins)
Windows control-alt-delete sequence
74
Complete Mediation
Secure interface
minimal
narrow
non-bypassable (e.g., check at server, not client)
Input validation
Trust input only from trustworthy channels
any value that can be influenced by user cannot be trusted
do not authenticate based on IP source addresses / ports
E-mail sender can be forged
hidden fields or client side checks are inappropriate
Open Design
Design must not be secret
76
Open Design
Kerckhoff's principle for cryptography:
A cryptosystem should be secure even if everything about
the system, except the key, is public knowledge
77
Separation of Privilege
Access depends on more than one condition
for example, two keys are required to access a resource
two privileges can be (physically) distributed
more robust and flexible
Classic examples
launch of nuclear weapons requires two people
bank safe
Related principle
compartmentalization
78
Separation of Privilege
Compartmentalization
break system in different, isolated parts and minimize
privileges in each part
dont implement all-or-nothing model
minimizes possible damage
Sandbox
traditional compartmentalization technique
examples
Java sandbox (bytecode verifier, class loader, security
manager)
virtual machines
Rendering in google Chrome
System jails (chroot)
79
Least Privilege
Operate with least number of rights to complete task
minimize damage
minimize interactions between privileged programs
reduce unintentional, unwanted use
Least Privilege
Minimize granted privileges
database restrictions
limit access to needed tables
use stored procedures
Least Privilege
Minimize modules that are granted privilege
optimally, only single module uses privileges and
drops them
two separate programs
one can be large and untrusted
other is small and can perform critical operations
important for GUI applications that require privileges
Least Privilege
Do not use setuid scripts
race condition problems
Linux drops setuid settings
Problems
beware of race conditions
avoid temporary files in global directories
84
Psychological Acceptability
Easy-to-use human interface
easy to apply security mechanisms routinely
easy to apply security mechanisms correctly
interface has to support mental model
do what is expected intuitively (e.g., personal firewalls)
Authentication
passwords
enforce minimum length (what is the minimum length?)
enforce frequent changes
85
Problematic
with automatically executing code in data files
JavaScript in web pages (eval)
automatic preview of web pages in emails
macros in Word
Retrofitting Applications
Applying security techniques to existing applications
element of overall system design
when no source code available or
complete redesign too complicated
Wrappers
move original application to new location and replace it with
small program or script that
checks (and perhaps sanitizes) command-line
parameters,
prepares a restricted runtime, and
invokes the target application from its new location
can provide logging
can provide possibility for prologue and epilogue code
90
Retrofitting Applications
Example wrappers
AusCERT Overflow Wrapper
exits when any command line argument exceeds a certain
length
TCP Wrappers
replaces inetd (for telnet, ftp, finger, )
access control
logging
Retrofitting Applications
Interposition
insert program that we control between two pieces of
software that we do not control
filtering of data
add security checks and constraints
network proxy
application policy enforcement
SYN flood protection
input sanitization
92
Bad Practice
Being too specific too soon
without having a design, solve technical problems and start
implementation
93
Bad Practice
Not considering the human factor
propose solutions that users strongly dislike
biometric scanners instead of passwords
94
Conclusion
We looked at introductory topics
Social engineering, passwords, importance of security
95