20 secure coding principles.pptx

16
Secure Coding Principles Building it to support security

Upload: rap-payne

Post on 18-Dec-2014

105 views

Category:

Technology


4 download

DESCRIPTION

Part of the Web Application Security Course

TRANSCRIPT

Page 1: 20 secure coding principles.pptx

Secure Coding Principles

Building it to support security

Page 2: 20 secure coding principles.pptx

Don’t settle for “what”, ask “why”.

Page 3: 20 secure coding principles.pptx

There are core pillars…

Page 4: 20 secure coding principles.pptx

… and there are more specific ones.

o  Minimal attack surface area o  Secure defaults o  Principle of least privilege o  Principle of defense in depth o  Fail securely o  External systems are insecure o  Separation of duties o  No security by obscurity o  Simplicity o  Fix security issues correctly

Page 5: 20 secure coding principles.pptx

Minimize attack

surface area

o  Fewer features mean fewer attack vectors.

o  Example: Eliminate the search function by making the site easier to use.

Page 6: 20 secure coding principles.pptx

Use secure defaults

o  Better to start with high security options and allow the user to lower it than vice-versa.

o  Example: Passwords expire in 90 days.

Page 7: 20 secure coding principles.pptx

Principle of least privilege

o  All user accounts should have the least privilege we can afford. •  User rights •  CPU •  Memory •  Database authority •  File permissions •  … and the like

Page 8: 20 secure coding principles.pptx

Defense in depth

o  If one control is good, two are better.

o  Makes attacks very tough to carry out.

Page 9: 20 secure coding principles.pptx

Fail securely

o  Failures should not break security. o  Example isAdmin = true; try { doStuff(); isAdmin = isUserInRole("Administrator"); } catch (Exception ex) { … }

o  If doStuff() fails, the user is an admin always.

Page 10: 20 secure coding principles.pptx
Page 11: 20 secure coding principles.pptx

Separation of duties

o  Example: an admin can add/remove users but shouldn’t be able to buy goods for others.

Page 12: 20 secure coding principles.pptx

Security by obscurity isn’t

Must rely on other measures as well.

Page 13: 20 secure coding principles.pptx

Simplicity

o  Complex code and systems tend to have security holes.

o  The simpler the code, the fewer holes.

Page 14: 20 secure coding principles.pptx

Fix security issues correctly

o  After a hole has been found, find the root cause.

o  Don’t patch the hole. o  Fix the real cause.

Page 15: 20 secure coding principles.pptx

Summary

o  Security can only be valid if it is backed by principles.

o  Learn the tasks, but more importantly learn the "whys" behind the tasks.

o  Extrapolate them in all areas.

Page 16: 20 secure coding principles.pptx

Further study

o  Microsoft's Security Development Lifecycle: •  http://www.microsoft.com/security/sdl

o  OWASP Secure Coding Principles: o  http://bit.ly/OWASPSecureCodingPrinciples