Docsity

Buffer Overflow Protection & Secure Software Development: Computer & Network Security, Study notes of Computer Science

Partial preview of the text

Download Buffer Overflow Protection & Secure Software Development: Computer & Network Security and more Study notes Computer Science in PDF only on Docsity!

CIS 551 / TCOM 401

Computer and Network

Security

Spring 2010

Lecture 3

Last Time: Buffer Overflows

  • Buffer overflows
    • Failure to protect the integrity of the processor’s memory.
    • Typically overwrite a code pointer: return address, callback handler, function pointer.
  • Root cause of many security problems
    • Spam, worms, root kits, botnets, etc.
  • Best protection:
    • Modern programming languages. (Java, C#, scripting languages, etc.)

Building Secure Software

  • Source: book by John Viega and Gary McGraw
    • Copy on reserve in the library
    • Strongly recommend buying it if you care about implementing secure software.
  • Designing software with security in mind
  • What are the security goals and requirements?
    • Risk Assessment
    • Tradeoffs
  • Why is designing secure software a hard problem?
  • Design principles
  • Implementation
  • Testing and auditing

Security Goals

  • Prevent common vulnerabilities from occurring
    • (e.g. buffer overflows)
  • Recover from attacks
    • Traceability and auditing of security-relevant actions
  • Monitoring
    • Detect attacks
  • Privacy, confidentiality, anonymity
    • Protect secrets
  • Authenticity
    • Needed for access control, authorization, etc.
  • Integrity
    • Prevent unwanted modification or tampering
  • Availability and reliability
    • Reduce risk of DoS

Risk Assessment

  • Identify:
    • What needs to be protected?
    • From whom?
    • For how long?
    • How much is the protection worth?
  • Refine specifications:
    • More detailed the better (e.g. "Use crypto where appropriate." vs. "Credit card numbers should be encrypted when sent over the network.")
    • How urgent are the risks?
  • Follow good software engineering principles, but take into account malicious behavior.

Principles of Secure Software

  • What guidelines are there for developing secure software?
  • How would you go about building secure software? Class answers:

#2: Practice Defense in Depth

  • Layers of security are harder to break than a single defense.
  • Example: Use firewalls, and virus scanners, and encrypt traffic even if it's behind firewall

#3: Fail Securely

  • Complex systems fail.
  • Plan for it:
    • Aside: For a great example, see the work of George Candea whose Ph.D. research is about something called "microreboots"
  • Sometimes better to crash or abort once a problem is found. - Letting a system continue to run after a problem could lead to worse problems. - But sometimes this is not an option.
  • Good software design should handle failures gracefully
    • For example, handle exceptions

#5: Compartmentalize

  • As in software engineering, modularity is useful to isolate problems and mitigate failures of components.
  • Good for security in general: Separation of Duties
    • Means that multiple components have to fail or collude in order for a problem to arise.
    • For example: In a bank the person who audits the accounts can't issue cashier's checks (otherwise they could cook the books).
  • Good examples of compartmentalization for secure software are hard to find. - Negative examples?

#6: Keep it Simple

  • KISS: Keep it Simple, Stupid!
  • Einstein: "Make things as simple as possible, but no simpler."
  • Complexity leads to bugs and bugs lead to vulnerabilities.
  • Failsafe defaults: The default configuration should be secure.
  • Ed Felten quote: "Given the choice between dancing pigs and security, users will pick dancing pigs every time."

#8: Hiding Secrets is Hard

  • The larger the secret, the harder it is to keep
    • That's why placing trust in a cryptographic key is desirable
  • Security through obscurity doesn't work
    • Compiling secrets into the binary is a bad idea
    • Code obfuscation doesn't work very well
    • Reverse engineering is not that difficult
    • Software antipirating measures don't work
    • Even software on a "secure" server isn't safe (e.g. source code to Quake was stolen from id software)

#9: Be reluctant to trust

Trusted Computing Base : The set of components that must function correctly in order for the system to be secure.

  • The smaller the TCB, the better.
  • Trust is transitive
  • Be skeptical of code quality
    • Especially when obtained from elsewhere
    • Even when you write it yourself
  • Eliminate trust by verification

#10: Use Community Resources

  • Software developers are not cryptographers
    • Don't implement your own cryptography
    • (e.g., bugs in Netscape's storage of user data)
  • Make use of CERT, Bugtraq, developer information, etc.

Malicious code

  • Attackers can remotely exploit buffer overflow vulnerabilities - Any program that allows remote connections is potentially a target. - Example: Web server processes HTTP requests taken from the network - Example: Mail client receives SMTP messages
  • Many other forms of 'malicious' code:
    • Viruses, worms, trojan horses, Javascript on web pages, plugins or extensions for any extensible system,…