Secure Software Development
Ulf Kargén Institutionen för Datavetenskap (IDA) Avdelningen för Databas- och Informationsteknik (ADIT)
Original slides by Marcus Bendtsen
TDDC90 – Software Security
Secure Software Development TDDC90 Software Security Ulf Kargn - - PowerPoint PPT Presentation
Secure Software Development TDDC90 Software Security Ulf Kargn Institutionen fr Datavetenskap (IDA) Avdelningen fr Databas- och Informationsteknik (ADIT) Original slides by Marcus Bendtsen Agenda Securing the software
Ulf Kargén Institutionen för Datavetenskap (IDA) Avdelningen för Databas- och Informationsteknik (ADIT)
Original slides by Marcus Bendtsen
TDDC90 – Software Security
2
3
For non-functional requirements such as quality and security, the same logic applies: We do not patch a piece of code to ensure it fulfills a non-functional requirement.
requirements, but activities are required.
software development life cycle.
4
5
Requirements Gather requirements and use cases Architecture and Design Plan how the system shall work and how code should be written Implementation Code and make test plans Verification Test and ensure that requirements and design are fulfilled Release & Maintenance Release, patch, release, patch, …
6
Requirements Gather requirements and use cases Architecture and Design Plan how the system shall work and how code should be written Implementation Code and make test plans Verification Test and ensure that requirements and design are fulfilled Release & Maintenance Release, patch, release, patch, … Security requirements Risk analysis Risk-based security tests Static analysis Risk analysis and penetration testing
7
Requirements Gather requirements and use cases Architecture and Design Plan how the system shall work and how code should be written Implementation Code and make test plans Verification Test and ensure that requirements and design are fulfilled Release & Maintenance Release, patch, release, patch, … Security requirements Risk analysis Risk-based security tests Static analysis Risk analysis and penetration testing
8
9
10
Image from Lillian Røstad – An extended misuse case notation: Including vulnerabilities and the insider threat
system and linked to a specific ward – only personnel with access to the patients at this ward can then read the patients records.
an emergency access control function – which gives immediate access to any records needed.
all time. This effectively creates a backdoor in the system that insiders can use to snoop around.
consider proper countermeasures – auditing (enables traceability and detection) and awareness training (making sure that users are aware of consequences of misuse).
11
12
Image from Lillian Røstad – An extended misuse case notation: Including vulnerabilities and the insider threat
13
Image from Lillian Røstad – An extended misuse case notation: Including vulnerabilities and the insider threat
14
Image from Lillian Røstad – An extended misuse case notation: Including vulnerabilities and the insider threat
15
16
Requirements Gather requirements and use cases Architecture and Design Plan how the system shall work and how code should be written Implementation Code and make test plans Verification Test and ensure that requirements and design are fulfilled Release & Maintenance Release, patch, release, patch, … Security requirements Risk analysis Risk-based security tests Static analysis Risk analysis and penetration testing
17
18
Images from Braber et al. – Model-based security analysis in seven steps – a guided tour to the CORAS method
Step 1 – Experts and clients decide upon which system is to be analyzed and what parts of the system that should be focused upon. Step 2 – The system to be analyzed is formalized, assets are identified, high-level risk analysis.
19
Step 3 – Prioritize assets, create scales for consequence and likelihood values, create risk evaluation matrix.
Images from Braber et al. – Model-based security analysis in seven steps – a guided tour to the CORAS method
20
Images from Braber et al. – Model-based security analysis in seven steps – a guided tour to the CORAS method
21
Images from Braber et al. – Model-based security analysis in seven steps – a guided tour to the CORAS method
22
23
Open Safe Pick lock Learn combo Cut open Install improperly Find written combo Get combo from target Threaten Blackmail Eavesdrop Bribe Listen to conversation Get target to state combo
24
Open Safe Pick lock Learn combo Cut open Install improperly Find written combo Get combo from target Threaten Blackmail Eavesdrop Bribe Listen to conversation Get target to state combo and
25
Open Safe Pick lock Learn combo Cut open Install improperly Find written combo Get combo from target Threaten Blackmail Eavesdrop Bribe Listen to conversation Get target to state combo and P I I P I I P I P I I P P
26
Open Safe Pick lock Learn combo Cut open Install improperly Find written combo Get combo from target Threaten Blackmail Eavesdrop Bribe Listen to conversation Get target to state combo and P I I P I I P I P I I P P $20 $40 $60 $20 $100 $60 $75 $20 $20 $30 $10 $100 $10
to bribes? (In reality you need to also consider the probability of success)
27
28
29
Requirements Gather requirements and use cases Architecture and Design Plan how the system shall work and how code should be written Implementation Code and make test plans Verification Test and ensure that requirements and design are fulfilled Release & Maintenance Release, patch, release, patch, … Security requirements Risk analysis Risk-based security tests Static analysis Risk analysis and penetration testing
30
Requirements Gather requirements and use cases Architecture and Design Plan how the system shall work and how code should be written Implementation Code and make test plans Verification Test and ensure that requirements and design are fulfilled Release & Maintenance Release, patch, release, patch, … Security requirements Risk analysis Risk-based security tests Static analysis Risk analysis and penetration testing
31
Requirements Gather requirements and use cases Architecture and Design Plan how the system shall work and how code should be written Implementation Code and make test plans Verification Test and ensure that requirements and design are fulfilled Release & Maintenance Release, patch, release, patch, … Security requirements Risk analysis Risk-based security tests Static analysis Risk analysis and penetration testing
32
33
34
35
Pre-SDL Phase 1 Phase 2 Phase 3 Phase 4 Phase 5
Phase 1: Requirements
run in its planned operational environment.
must be fixed before committing code), these are defined for each phase of the development and are negotiated with a security advisor.
entire project, e.g. no known vulnerabilities in the application with a “critical” or “important” rating at time of release.
36
Pre-SDL Phase 1 Phase 2 Phase 3 Phase 4 Phase 5
before release?
mutually agreed upon group that is external to the project team?
37
Pre-SDL Phase 1 Phase 2 Phase 3 Phase 4 Phase 5
potential weak spot).
meaningful security risks (can be defined by the security risk assessment
during requirements).
38
Pre-SDL Phase 1 Phase 2 Phase 3 Phase 4 Phase 5
39
Pre-SDL Phase 1 Phase 2 Phase 3 Phase 4 Phase 5
40
Pre-SDL Phase 1 Phase 2 Phase 3 Phase 4 Phase 5
24-hours a day.
right to make changes).
41
Pre-SDL Phase 1 Phase 2 Phase 3 Phase 4 Phase 5
Phase 5: Release (cont.)
is not fulfilled or escalate to executive management for decision.
must certify that the privacy requirements are satisfied.
archived so that service can be done on the product at a later stage.
42
Pre-SDL Phase 1 Phase 2 Phase 3 Phase 4 Phase 5
43
Pre-SDL Phase 1 Phase 2 Phase 3 Phase 4 Phase 5
44
45
Requirements Gather requirements and use cases Architecture and Design Plan how the system shall work and how code should be written Implementation Code and make test plans Verification Test and ensure that requirements and design are fulfilled Release & Maintenance Release, patch, release, patch, … Security requirements Risk analysis Risk-based security tests Static analysis Risk analysis and penetration testing
46
between different components and define the interaction between those high- level components.
high-level component.
specific functions or methods in the system.
47
can be separated into separate components, and there is a small amount of interaction between these components
literature) is more appropriate
48
Open socket and listen for connections
49
root
Request from unauthorized user
Spawn a child process that has least possible privilege root Authenticate (complex code) Unprivileged Spawn a child with the privileges of the authorized user root Do some work as user User Return identity
without elevated privileges.
somebody gets control of the process, then they are confined within the same level of privilege.
reviews etc. can be focused on the code that runs with elevated privileges.
50
Authenticate (complex code) Unprivileged Do some work as user User Open socket and listen for connections root Spawn a child process that has least possible privilege root Spawn a child with the privileges of the authorized user root
51
52
AbstractSecureFactory +getInstance() : AbstractSecureFactory +getObject(givenCredentials : SecurityCredentials) : SomeObject ConcreteteSecureFactory1 +getObject(givenCredentials : SecurityCredentials) : SomeObject ConcreteteSecureFactory2 +getObject(givenCredentials : SecurityCredentials) : SomeObject Getting SomeObject is done by making the call:
AbstractSecureFactory.getInstance().getObject(securityCredentials) The returned object, SomeObject, is an object that operates with the correct privileges.
53
1.
Using the current concrete implementation of AbstractSecureFactory
2.
Look at security credentials that were passed in the call
3.
Create an instance of the appropriate concrete version of SomeObject
4.
Further specialise settings in SomeObject
SomeObject LowPrivilegeSomeObject MidPrivilegeSomeObject HighPrivilegeSomeObject
54
SomeObject with correct behavior.
functions that are not callable by the level of privilege to which it is developed.
function.
55
56
Manager Report Generator Sale Analyst Report Generator Sales Intern Report Generator Supply request and user credentials Handle request Handle request Handle or reject request Pass request if credential check fails Pass request if credential check fails
selected based on the user credentials.
Can even be done dynamically at runtime by changing the links.
57
Manager Report Generator Sale Analyst Report Generator Sales Intern Report Generator Supply request and user credentials Handle request Handle request Handle or reject request Pass request if credential check fails Pass request if credential check fails
58
59
60
Application Secure Logger Log Reader Log Viewer Log Protected data Unprotected data
61
62
Return to pool
Do not simply release back
63
ClientInfo::~ClientInfo() { this->ipAddr = 0; this->trustLevel = BOGUS; this->numFaultyRequests = 0; } An example of clearing sensitive information in the destructor of an object. In this way the information stored in memory is made insensitive before destroying the
to mitigate the consequence of vulnerabilities.
Secure Design Patterns. Technical Report CMU/SEI-2009-TR-010.
64
65
Requirements Gather requirements and use cases Architecture and Design Plan how the system shall work and how code should be written Implementation Code and make test plans Verification Test and ensure that requirements and design are fulfilled Release & Maintenance Release, patch, release, patch, … Security requirements Risk analysis Risk-based security tests Static analysis Risk analysis and penetration testing