24
Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering

Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Embed Size (px)

Citation preview

Page 1: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Secure Software Development

Software Security Touchpoints

Chapter 3Rasool Jalili & M.S. Dousti

Dept. of Computer Engineering

Fall 2010

Page 2: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 2Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• A set of software security best practices that we call touchpoints.• Aim: adopting a straightforward set of engineering best practices,

designed to interleave security into existing development processes.• Have their basis in good software engineering and involve explicitly

the software lifecycle.• understanding common risks, designing for security, and

subjecting all software artifacts, objective risk analyses and testing. • Understanding how to work security engineering into requirements,

architecture, design, coding, testing, validation, measurement, and maintenance.

• Most organizations follow an iterative approach today, which means that touchpoints will be cycled through more than once as the software evolves.

Software Security Touchpoints

Page 3: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 3Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

Touchpoints

Page 4: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 4Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• SWS touchpoints designed to be applied no matter which software process you use to build your software.

• As long as you are producing some minimal set of software artifacts (and every project should at least be producing code!), you can apply the touchpoints.

• a better approach is to order the touchpoints by their natural utility and present them in some sort of ranking.

• Some touchpoints are by their nature more powerful than others, and you should adopt the most powerful ones first.

Page 5: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 5Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• Code review• Architectural risk analysis• Penetration testing• Risk-based security tests• Abuse cases• Security requirements• Security operations

In order of effectiveness

Page 6: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 6Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• The ordering is not a perfect fit for every organization. • The ordering reflects a bias developed in code-o-centric

organizations. • Code review comes before architectural risk analysis. • Both of the top two touchpoints are critical.• Software defects that lead to security problems come in two

varieties: bugs and flaws.• Code review aims at finding the bugs. • Architectural risk analysis aims at finding the flaws. • If you skip one or the other, you're most likely to solve only half

the problem. • This ordering reflects the reactive approach to security!

Page 7: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 7Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• Artifact: Code• Example of risks found: Buffer overflow on line 42• All software projects produce at least one artifact: code.• The focus is on implementation bugs, especially those that static analysis

tools that scan source code for common vulnerabilities can discover.• Several tools vendors now address this space.• Code review is a necessary but not sufficient practice for achieving

secure software. • Doing code review alone is an extremely useful activity.• the best a code review can uncover is around 50% of the security

problems. • Architectural problems are very difficult to find by staring at code.• A comprehensive approach is combining both code review and

architectural analysis.

1. Code Review (Tools)

Page 8: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 8Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• Artifact: Design and specification• Examples of risks:

– Poor partitioning and protection of critical data; – failure of a Web Service to authenticate calling code and its user,

and– Not to make access control decisions based on proper context

• At this level, a system must be coherent and present a unified security front.

• Designers, architects, and analysts should clearly document assumptions and identify possible attacks.

• At this point, security analysts uncover and rank architectural flaws so that mitigation can begin.

2. Architectural Risk Analysis

Page 9: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 9Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• Artifact: System in its environment• Example of risks: Poor handling of program state in Web interface• is extremely useful• The advantage: gives a good understanding of fielded software in

its real environment. • However, doesn't take the software architecture into account

probably won't uncover anything interesting about software risk.• Software fails during such black box testing is truly bad.

– indicates that you're in very deep trouble indeed.• One danger with penetration testing involves who does it. Be very

suspicious of "reformed hackers" whose only claim to being reformed is some kind of self-description.

3. Penetration Testing

Page 10: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 10Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• Artifact: Units and system• Example of risks: Extent of data leakage• two strategies:

– testing of security functionality with standard functional testing techniques, and

– risk-based security testing based on attack patterns, risk analysis results, and abuse cases.

• A good security test plan includes both strategies. • QA is about making sure good things happen. Security

testing is about making sure bad things don't happen. • Thinking like an attacker is essential.

4. Risk-Based Security Testing

Page 11: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 11Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• Artifact: Requirements and use cases• Example of risks: Susceptibility to well-known

tampering attack• Building abuse cases is a great way to get into the

mind of the attacker. • Similar to use cases, abuse cases describe the

system's behavior under attack; • building abuse cases requires explicit coverage of

what should be protected, from whom, and for how long.

5. Abuse Cases

Page 12: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 12Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• Artifact: Requirements• Sample risk: No explicit description of data protection needs• Security must be explicitly worked into the requirements

level. • Good security requirements cover both

– Obvious functional security (say, the use of applied cryptography) and

– emergent characteristics (best captured by abuse cases and attack patterns).

• The art of identifying and maintaining security requirements is a complex job that justifies broad treatment.

6. Security Requirements

Page 13: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 13Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• Artifact: Fielded system• Example: Insufficient logging to prosecute a known attacker.• Well-integrated security operations allow and encourage

network security professionals to get involved in applying the touchpoints,

• Attacks do happen, regardless of the strength of design and implementation understanding software behavior that leads to successful attack is an essential defensive technique.

• Knowledge gained by understanding attacks and exploits should be cycled back into software development.

7. Security Operations

Page 14: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 14Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• This is not really a touchpoint, but it's important enough to emphasize.

• External analysis (i.e., analysis by somebody outside the design team) is often a necessity when it comes to security.

• All software security touchpoints are best applied by people not involved in the original design and implementation of the system.

*. External Analysis

Page 15: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 15Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• The two threads of black hat and white hat activities intertwine to make up software security.

• Black hat: destructive activities as those about attacks, exploits, and breaking software.

• White hat: constructive activities as those about design, defense, and functionality.

• Perhaps a less judgmental way to think about is in terms of defense & offense. • Neither defense nor offense is basically bad or good, and both are necessary

to play almost any sport well. • Code review: a white hat (constructive) activity; to avoid implementation

problems.• Architectural risk analysis: a white hat (constructive) activity; work to avoid

design flaws.• Penetration testing: a black hat (destructive) activity. The best kind of

penetration testing is informed by white hat knowledge of design and risk.

Black and White

Page 16: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 16Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• Risk-based security testing is a mix of constructive and destructive activities that requires a two-hat approach.

• Abuse cases are tricky. – Are abuse cases involve only black hat (destructive)

activities?? – Abuse cases are driven by the two threads.

• White hat (constructive) thinking relies on security requirements, which are a necessary foundation for a goodly percentage of the abuse cases. – Black hat thinking in the form of attack patterns drives the

remaining portion.

Page 17: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 17Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• Though abuse cases clearly involve a mix of both hats, the leading hat is black.

• Security requirements and the resulting security functionality are exactly constructive, ultimate white hat activities.

• These are defined and built as an explicit defense against the black hat world.

• Security operations is a white hat activity, but it is only very weakly constructive.

• Software security requires a matching set of both black hats and white hats, bound together.

Page 18: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 18Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• It is much more economical to find software defects early in the lifecycle than it is to find them later.

• Fixing a problem at the requirements stage is much cheaper than fixing even a simple bug once thousands or millions of copies are installed.

• Early is better

Moving Left

Page 19: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 19Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• If early is better, it seems crazy to focus our attention at the end of the lifecycle!• Hiring reformed hackers to do penetration test or running pentest tools is better than

doing nothing. • A reactive approach doesn't work so well when the problems are deep in the software

itself • The strategy "penetration testing first," is not very clever. Penetration testing can be

very effective in lighting the security fire!! Correct?• The worse strategy is the "panic when attacked" approach. • The answer to both of these strategies is to "push left" in touchpoints.• We know that even the best tool will find only about %50.• We need a wave of architectural risk analysis. This is a much trickier job, best done by

experts. • In absence of in-house experts, start with your existing requirements managers and

enhance them with outside consultants.• Begin moving left as soon as possible • And by all means, get "inside" as quickly as you can. External penetration tests can

help you determine how severe the problem is, but they do little to fix it.

Page 20: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 20Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• Count the problems in the following chunk of code, at different levels;

1 read(fd, userEntry, sizeof(userEntry));2 comparison = memcmp(userEntry, correctPasswd,

strlen(userEntry)); 3 if (comparison != 0) 4 return (BAD_PASSWORD);

Coder's Corner[*]

Page 21: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 21Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• As it stands in many organizations, software security is nobody's job!

• Developers, architects, and other builders are often unaware of security

• When their software suffers from security failure, they don't often feel responsible, arguing that security is up to the people in operations who install and operate the software they create.

• Those software people usually believe that security is IT's job and an infrastructure issue.

• When a security problem happens because of bad software, there really is nobody to hold responsible.

• In the best world, software security would be everybody's job. • In a more realistic world, assigning responsibility to a particular

group can help solve the problem.

Who Should Do Software Security?

Page 22: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 22Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• There is not enough time to wait for academia to produce the solution. Instead, software security people need to be developed inside existing organizations.

• consider the following advices.• Don't start with security people:

– Network security people often don't know enough about software.• Start with software people:

– Security is much easier to learn about than software development is. – Good software people are very valuable, these highly valuable people need to be

repositioned.– Identifying a responsible and dedicated person or two is critical to a successful software

security program. – hire outside consultants to come and help you boot up a group.– Ultimately, you want two types of people to populate your software security group: black

hat thinkers and white hat thinkers. – You may find people who can switch hats.– This matches the distinction between builders and auditors. You need both. Builders are

much more important than the auditors.

Building a Software Security Group

Page 23: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 23Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• The following topics are of particular relevance:– Security requirements engineering– Design for security, software architecture, and architectural

analysis– Security analysis, security testing, and use of the Common Criteria– Guiding principles for software security and case studies in design

and analysis– Auditing software for implementation risks, architectural risks,

automated tools, and technology developments (code scanning, information flow, and so on)

– Common implementation risks (buffer overflows, race conditions, randomness, authentication systems, access control, applied cryptography, and trust management)

A Multidisciplinary Effort

Page 24: Secure Software Development Software Security Touchpoints Chapter 3 Rasool Jalili & M.S. Dousti Dept. of Computer Engineering Fall 2010

Software Security 24Secure SW Development (SSD) Grad. Course (R. Jalili & M.S. Dousti) – Fall 2010

• software security is not security software. • Touchpoints include both security mechanisms (such as

access control) and design for security (such as robust design). These encompass both black hat and white hat activities.

• Touchpoints are one of the three pillars of software security.

• we must face the problem in a more reasonable fashion than simply spray painting cryptography on our code.

• Playing the game of software security requires both good offense and good defense.

Conclusion