1_Introduction
1_Introduction
Introduction
Erik Poll
Digital Security
Radboud University Nijmegen
1
Admin
2
Goals of this course
3
Practicalities: prerequisites
4
The kind of C(++) code you will see next week
6
implements java.io.Serializable
protected A ShallowClone(Object o)
throws ClassCastException {
a = new(A);
x.b1 = ( (A) o).b1; // cast o to class A
x.b2 = ( (A) o).b2;
return a;
}
}
7
Exam material
8
Not exam material
9
Not exam material (yet…)
See https://owasp.org/www-chapter-belgium/
10
Practicalities: form & examination
• project work
– PREfast for C++ (individual or in pairs)
– group project (with 4 people) on fuzzing
– project on static analysis with Semmle (individual or in
pairs)
• written exam
11
Today
• Organisational stuff
12
Motivation
13
Quiz
Why can websites, servers, browsers, laptops, mobile
phones, wifi access points, network routers, mobile
phones, cars, pacemakers, the electricity grid, uranium
enrichment facilities, ... be hacked?
14
Why a course on software security?
• Software is a MAJOR source of security problems
and plays MAJOR role in providing security
15
How do computer systems get hacked?
By attacking
• software
• humans
• crypto
• hardware
• …
16
Fairy tales
Many discussions about security begin with Alice and Bob
Eve
Alice Bob
How can Alice communicate securely with Bob,
when Eve can modify or eavesdrop on the communication?
17
This is an interesting
problem,
but it is not the biggest
problem
18
The really big problem
Alice & her computer are communicating with another computer
possibly malicious
input
19
The problem
20
25th January 2003, 5:29 AM
21
25th January 2003, 6:00 AM
22
Slammer Worm
23
Security problems nowadays
To get an impression of the problem, have a look at
US-CERT bulletins
https://us-cert.cisa.gov/ncas/bulletins
CVE (Common Vulnerability Enumeration)
https://cve.mitre.org/cve/
NIST’s vulnerability database
https://nvd.nist.gov/vuln/search
24
Changing nature of attackers
Traditionally, hackers were amateurs motivated by ‘fun’
• by script kiddies & more skilled hobbyists
• NB if you like that, join the RU-CTF team!
25
Prices for 0days
26
Prices for 0days
27
Software security: crucial facts
28
security software ≠ software security
Adding security software can make a system more secure
i.e. software specifically for security, such as
– network-level protection with TLS, IPSEC, firewall, VPN, …
– AV (AntiVirus), WAF (Web Application Firewall)
– access control, with eg 2FA, logging, monitoring, …
– NIDS (Network Intrusion Detection System)
– EDR (Endpoint Detection and Response)
– …
BUT
All software must be secure, not just the security software
• That buffer overflow in your PDF viewer will still kill you…
• Adding security software may add software bugs and make
things less secure:
Check out https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=firewall
https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=VPN
29
Root causes
30
Quick audience polls
• Did you ever take a course on C(++) programming ?
• Were you taught C(++) as a first programming language?
• Did this these courses
• warn about buffer overflows?
• explain how to avoid them?
31
Quick audience poll
• Did you ever build a web-application?
– in which programming languages?
• Do you know the secure way of doing a SQL query in this
language (to prevent SQLi)?
32
More root causes
33
Functionality vs security: Lost battles?
• Operating systems (OSs)
– with huge OS, with huge attack surface
• Programming languages
– with easy to use, efficient, but very insecure and error-
prone mechanisms
• Web browsers
– with JavaScript and Web APIs to access microphone,
web cam, location, …
• Email clients
– which automatically cope with all sorts of formats &
attachments
34
Functionality vs security : PHP
"After writing PHP forum software for three years now,
I've come to the conclusion that it is basically impossible
for normal programmers to write secure PHP code.
It takes far too much effort. ....
PHP's raison d'etre is that it is simple to pick up and make
it do something useful. …."
[Source http://www.greebo.cnet/?p=320]
35
More root causes: Weakness in depth
37
Recap
Problems are due to
• lack of awareness
– of threats, but also of what should be protected
• lack of knowledge
– of potential security problems, but also of solutions
• people choosing functionality over security
• compounded by complexity
– software written in complex languages, using large complex
APIs, and running on complex platforms
38
Types of software security problems
39
Weaknesses vs vulnerabilities
Terminology can be messy & confusing
security weakness, flaw, vulnerability, bug, error, coding defect, ..
Important distinction:
1. (potential) security weaknesses
Things that could go wrong & could be better
2. (real) security vulnerabilities
Flaws that can actually be exploited by an attacker
Requires flaw to be
accessible: attacker has to be able to get at it
exploitable: attacker has to be able to do some damage with it
40
Typical software security flaws
0%
17%
buffer overflow
37%
input validation
code defect
design defect
26%
crypto
20%
41
‘Levels’ at which security flaws can arise
1. Design flaws
introduced before coding
2. Implementation flaws aka bugs aka code-level defects
introduced during coding
42
Types of implemention flaws
43
Bug vs features, yet again
Attacks can not only exploit bugs, but also features
44
The dismal state of software security
45
Spot the security flaws!
what if amount
void decreaseBankBalance(int amount)
is negative?
{ if (balance <= amount)
{ balance = balance – amount; }
else { println(”Insufficient funds\n”); }
}
46
Different kinds of implementation flaws
47
Security in the
Software Development Life Cycle
(SDLC)
48
How can we make software secure?
49
How can we make software more secure?
50
Security in Software Development Lifecycle
Security-by-Design
Privacy-by-Design
Evolution of Security Measures
51
“Shifting left”
Organisations always begin tackling security at the end of
the SDLC, and then slowly evolve to tackle it earlier
For example
1. first, do nothing
– some problems may happen & then you patch
2. then, implement support for regular patching
3. then, pre-emptively have products pen-tested
– eg. hire pen-testers or set up bug bounty program, ...
4. then, use static analysis tools when coding
5. then, train your programmers to know about common problems
6. then, think of abuse cases, and develop security tests for them
7. then, start thinking about security before you even start
development
52
DAST, SAST, RASP
Security people keep inventing trendy new acronyms
• DAST
– Dynamic Application Security Testing
– ie. testing
• SAST
– Static Application Security Testing
– ie. static analysis
• RASP
– Run-time Application Security Protection
– ie. monitoring
53
Security in the software development life cycle
McGraw’s Touchpoints
54
Methodologies for secure software development
• Microsoft SDL
with extension for Secure DevOps (DevSecOps)
• Open SAMM (Software Assurance Maturity Model)
• OWASP SAMM
• BSIMM
• Grip op SSD (Secure Software Development)
Ongoing initiative by Dutch government organisations
https://www.cip-overheid.nl/en/category/products/secure-software/
• …
55
Microsoft’s SDL Optimisation Model
56
OpenSAMM
57
BSIMM (Building Security In Maturity Model)
Framework to compare your software security efforts with
other organisations
https://www.bsimm.com/framework/
58
BSIMM: comparing your security maturity
59
But first…
60
Crucial first steps in any security discussion!
62
For you to read & do
63