Top Banner
Bernard Menezes Department of Computer Science IIT Bombay
70

Bernard Menezes Department of Computer Science IIT Bombay.

Dec 23, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Bernard Menezes Department of Computer Science IIT Bombay.

Bernard MenezesDepartment of Computer Science

IIT Bombay

Page 2: Bernard Menezes Department of Computer Science IIT Bombay.

Goals

• To put cryptography, network security, system security and application security in perspective

• To sample trends and/or challenges in cryptography and network security

Page 3: Bernard Menezes Department of Computer Science IIT Bombay.

Computer Security in perspective

• Information Security• Network Security• System Security• Application Security• Operating System Security• Database Security• Language Security

Page 4: Bernard Menezes Department of Computer Science IIT Bombay.

Cryptography

• Generally considered part of Network Security

• Vast and intense subject and has emerged as a course/research area in its own right

• Requires mathematical prerequisites – Number Theory, Discrete math (groups, rings, fields, etc.)

Page 5: Bernard Menezes Department of Computer Science IIT Bombay.

Pursuit of Mathematics• One may develop mathematical theory with no

apparent goal in mind (math for math sake)

• Decades/centuries later, scientists and engineers may stumble upon some excellent applications of mathematical theories

• Examples – the use of differential equations in the analysis of electrical circuits, the use of number theory and discrete math in cryptography

Page 6: Bernard Menezes Department of Computer Science IIT Bombay.

Useful math background for cryptography

• Modulo arithmetic and the gcd • Euclid’s algorithm• Euler’s Theorem and Fermat’s Little Theorem• Lagrange’s Theorem• Chinese Remainder Theorem • Theorems related to subgroups, generators,

etc.

Page 7: Bernard Menezes Department of Computer Science IIT Bombay.

Security, Mathematics, Security

• Is Cryptography = Security?

• Is Cryptography a subset of Applied Mathematics?

Page 8: Bernard Menezes Department of Computer Science IIT Bombay.

But, a word of caution!

“ Whoever thinks his problem can be solved using cryptography, doesn’t understand his problem and doesn’t understand cryptography ”

- Source unknown

Page 9: Bernard Menezes Department of Computer Science IIT Bombay.

What is Security about (in the technical sense)

• (Goals of the hacker/attacker/adversary)

• Attacks

• Vulnerabilities

• Defences

Page 10: Bernard Menezes Department of Computer Science IIT Bombay.

Some Attack Goals

• Theft of sensitive information (example, credit card information)

• Disruption of service (rendering a service inaccessible or unavailable)

• Information Warfare (attacking infrastructure of an “enemy” country)

• Illegal access to or use of resources (circumventing controls so as to gain unauthorized access)

Page 11: Bernard Menezes Department of Computer Science IIT Bombay.

Attacks, Attacks, Attacks!

Page 12: Bernard Menezes Department of Computer Science IIT Bombay.

Who commits what?

Page 13: Bernard Menezes Department of Computer Science IIT Bombay.

“ Once we know our weaknesses, they cease to do us any harm”

- Georg Christoph Lichtenberg

Page 14: Bernard Menezes Department of Computer Science IIT Bombay.

Vulnerabilities

• A vulnerability is a weakness or lacuna in a policy, procedure, protocol, hardware or software within an organization that has the potential to cause it damage or loss.

Page 15: Bernard Menezes Department of Computer Science IIT Bombay.

Vulnerability Types

• Human Vulnerabilities– Induced by careless/unthinking human behaviour– Ex. clicking on a link in an e-mail message from a

questionable source– Related to phishing and cross-site scripting attacks

Page 16: Bernard Menezes Department of Computer Science IIT Bombay.

Vulnerability Types (contd.)

• Protocol Vulnerabilities – Attacks on commonly used networking protocols such as

TCP, IP, ARP, ICMP and DNS – Ex. Connection hijacking caused by ARP spoofing, etc.– Denial of Service Attacks (DoS) which exploit the 3-way

TCP handshake– Pharming attacks exploit vulnerabilities in DNS

Page 17: Bernard Menezes Department of Computer Science IIT Bombay.

Vulnerability Types (contd.)

• Software Vulnerabilities

– Caused by sloppy software

– Software may perform as expected under normal conditions but when provided with a specific input, it turns malicious

– Examples include Buffer Overflow vulnerability, Cross-site Scripting (XSS) vulnerability and SQL Injection vulnerability

Page 18: Bernard Menezes Department of Computer Science IIT Bombay.

Vulnerability Types (contd.)

• Configuration Vulnerabilities– relate to settings on system/application software, on files,

etc. – Read-write-execute (and other) permissions on files (and

other objects) may be too generous. – Privilege level assigned to a process may be higher than

what it should be to carry out a task. – Often lead to “privilege escalation” attacks.

Page 19: Bernard Menezes Department of Computer Science IIT Bombay.

Advice to a Security Designer

“ You can’t make something secure if you don’t know how to break it”

- Marc Weber Tobias

Page 20: Bernard Menezes Department of Computer Science IIT Bombay.

Defence Strategies

Prevention

Detection

Recovery

Forensics/Traceback

Page 21: Bernard Menezes Department of Computer Science IIT Bombay.

Examples of Preventive Strategies

• Code Auditing and Testing (against software flaws)– Blackbox– Whitebox

• Access Control (against unauthorized access)– Authentication– Authorization

• Encryption (against eavesdropping)

Page 22: Bernard Menezes Department of Computer Science IIT Bombay.

Examples of Detection

• Integrity checks on messages, files– Simple CRC-type checksums not effective for security

applications– Use of the Message Authentication Code (MAC)

• Intrusion detection systems based on– Anomaly detection– Signature detection

Page 23: Bernard Menezes Department of Computer Science IIT Bombay.

Trends and Challenges in Cryptography

– Identity-based Cryptography

– Secure Group Communication

– Green Cryptography

– Quantum Cryptography

Page 24: Bernard Menezes Department of Computer Science IIT Bombay.

Trends and Challenges in Security

•Defense against botnets

•Application software security

•Web services security

•Electronic payment

•Electronic passports

Page 25: Bernard Menezes Department of Computer Science IIT Bombay.

Web Services Security

Page 26: Bernard Menezes Department of Computer Science IIT Bombay.

Web apps versus web services

• Many of the earlier web applications (such as internet banking) involved human-to-program interaction. However, applications such as supply chain management differ from traditional web applications in several significant respects:

• Programs communicate with each other over the web with little or no human intervention.

Page 27: Bernard Menezes Department of Computer Science IIT Bombay.

Web apps versus web services (contd.)

• Services might have a composite nature. Such “composite services” necessitate the involvement of multiple providers, each providing an “atomic service”.

• There are potentially a large number of “atomic service” providers offering a given service. So clients have a choice and can dynamically change providers.

Page 28: Bernard Menezes Department of Computer Science IIT Bombay.

Web Services

The World-wide Web Consortium, W3C, defines a web service as “a software system identified by a URI whose public interfaces and bindings are defined and described using XML. Its definition can be discovered by other software systems. These systems may then interact with the web service in a manner prescribed by its definition using XML-based messages conveyed by internet protocols”.

Page 29: Bernard Menezes Department of Computer Science IIT Bombay.

Entities involved in a web service

Page 30: Bernard Menezes Department of Computer Science IIT Bombay.

Security Challenges Specific to Web Services

• SSL/TLS, IPSec are some of the common ways of securing web communication

• However, these are point-to-point protocols.• Web services require fine-grained security• SSL does not support non-repudiation• SSL operates at the transport level. What we

need is a protocol that understands a message.

Page 31: Bernard Menezes Department of Computer Science IIT Bombay.

Standards for Web Services Security

• XML Digital Signature• XML Encryption• WS-Sec• SAML (Secure Assertion Markup Language)• XACML (eXtensible Access Control Markup

Language)

Page 32: Bernard Menezes Department of Computer Science IIT Bombay.

Standards for Web Services Security (contd.)

• WS-Policy• XKMS (XML Key Management Specification)• WS-Trust• WS-Federation

Page 33: Bernard Menezes Department of Computer Science IIT Bombay.

XML Digital Signature

• Provides authentication, data integrity (tamperproofing) and non-repudiation

• Very flexible– Can sign one or more items within an XML document– Supports multiple signers (ex. business partners)– Can sign both local and remote objects, XML and non-XML

content– Support for multiple signing algos + digest algos +

canonicalization methods.

Page 34: Bernard Menezes Department of Computer Science IIT Bombay.

WS-Sec Defines XML elements that are used to communicate

security tokens in the header of a SOAP message within the <Security> header.

A security claim is a statement made about a subject’s identity, signing key, etc.

One or more claims is/are represented by a security token.

Common examples of security tokens are a username + password, an X.509 certificate, a Kerberos ticket or a SAML assertion.

Page 35: Bernard Menezes Department of Computer Science IIT Bombay.

WS-Sec Token Example

< UsernameToken > < Username > Shivani < /Username > < Password Type = “PasswordDigest” > 4u%h&+q:L < /Password > < Nonce > . . . < /Nonce > < Created > . . . < Created >< /UsernameToken >

Page 36: Bernard Menezes Department of Computer Science IIT Bombay.

WS-Sec Binary Token

< BinarySecurityToken ValueType = “ . . . X509v3”EncodingType = “ . . . Base64Binary” >

Lp9tba4Pc7G . . .< / BinarySecurityToken >

Page 37: Bernard Menezes Department of Computer Science IIT Bombay.

Security Assertion Markup Language (SAML)

• designed to support single sign-on and propagate authorization information

• SAML defines three basic components: • Assertions– Authentication– Attribute– Authorization

Page 38: Bernard Menezes Department of Computer Science IIT Bombay.

SAML Authenticating Assertion

<saml:Assertion . . . <saml:AuthenticationStatement AuthMethod=“password” AuthInstant=“2008- . . . <saml:Subject> <saml:NameID SecurityDomain=“iitb.ac.in” Name=“Rajesh” />……

Page 39: Bernard Menezes Department of Computer Science IIT Bombay.

WS-Security Specifications

Page 40: Bernard Menezes Department of Computer Science IIT Bombay.

Application Security

Page 41: Bernard Menezes Department of Computer Science IIT Bombay.

Attacks that exploit software vulnerabilities

• Buffer Overflow • Cross-site Scripting • SQL Injection • Format String . . .

Some of these are on the Top-10 list of risks brought out by OWASP

What about malware attacks?

Page 42: Bernard Menezes Department of Computer Science IIT Bombay.

Buffer Overflow (BOF)

• The BOF vulnerability is one of the oldest and, by far, the most common of software vulnerabilities.

• As early as 1988, the Morris worm was one of the first to exploit this vulnerability.

• Since then, many creative ways of converting such a vulnerability into an exploit have been devised.

Page 43: Bernard Menezes Department of Computer Science IIT Bombay.

Buffer Overflow (BOF) contd.• A buffer overflow (BOF) occurs when the space allocated to a

variable (typically an array or string variable) is insufficient to accommodate the variable in its entirety.

• For example, a certain amount of buffer space is allocated for an array. If array bounds are not checked while populating it, the array may overflow into contiguous memory and corrupt it.

• Interestingly, this could cause an attacker to subvert the normal flow of a program. Malicious code supplied by the attacker in the buffer could be executed.

Page 44: Bernard Menezes Department of Computer Science IIT Bombay.

Exploiting Stack Overflows

• Provide input to a buffer on the stack which includes malicious code (often called shellcode)

• Overflow the buffer so that the return address to the calling program is overwritten with the address of the malicious code

• That way, when the called function terminates, it will not return to the calling program. Instead, the malicious code will be executed

Page 45: Bernard Menezes Department of Computer Science IIT Bombay.

Buffer Overflow Defences

There are many defences against BOF. Some of the best known are– Make the stack non-executable. This prevents malicious

code on the stack from being executed. However, exploits like return into LibC are still possible

– Compiler-based option: Place a “canary variable” on the stack between the local variables and the return address. If a BOF modifies the return address, the canary will be corrupted. This will be detected by the compiler and the program will be aborted.

Page 46: Bernard Menezes Department of Computer Science IIT Bombay.

Related Attacks

• Heap Overflow: A program’s dynamically allocated variable are stored on the heap. Buffers in this area may also be overflown leading to Heap buffer overflow attacks.

• Format String Attacks: C language printf( ), for example, uses a format string as function parameter. An attacker may pass a malicious string as input parameter enabling the attacker to read or write arbitrary locations in memory.

Page 47: Bernard Menezes Department of Computer Science IIT Bombay.

Cross-site Scripting Attacks

• A web site is said to have a cross-site scripting vulnerability if it inadvertently includes malicious scripts crafted by an attacker in pages returned by it.

• For example,<SCRIPT> Malicious Code </SCRIPT>

• The malicious code may, for example, read browser cookies on the victim’s machine and ship these off to an attacker’s web server

Page 48: Bernard Menezes Department of Computer Science IIT Bombay.

Persistent XSS Attack

• The malicious code (scripts) on a web page is saved on the web server.

• When an innocent user downloads the web page, the malicious scripts execute on that user’s browser.

• Example: Users update their profile on a social networking site. These profiles may be read (downloaded) by other users through their browsers

Page 49: Bernard Menezes Department of Computer Science IIT Bombay.

Non-persistent XSS Attack• Exploits the fact that some servers echo back certain user

input back to the client without validating it

• For example, a user may be asked for personal details in an HTML form. Suppose he enters his name as “Prashant”. The server then responds with “Hello Prashant”

• Note that the server has echoed back his name

• Now, what would happen if, instead of Prashant, the user enters

<SCRIPT>alert(‘Fire!’)</SCRIPT>

Page 50: Bernard Menezes Department of Computer Science IIT Bombay.

Overcoming XSS• Validate and filter all user input. (Should this be done at the

client or server?)

• One strategy is to make a blacklist of all user input that should be filtered out. For example, single/double quotes, angular brackets, etc. should not appear in an e-mail address input from the user.

• A better solution in most cases is the equivalent of a whitelist approach - specify precisely what user input is expected. This is often accomplished by the use of a regular expression.

Page 51: Bernard Menezes Department of Computer Science IIT Bombay.

SQL Injection (Background)• Form parameters may be passed as a query string in

an extended URL to the server as inwww.iitb.ac.in?s_ID=08935710&passwd=4ep*NdF

• The server application retrieves the form parameters and uses them to build an SQL query such as

select s_ID, gpafrom students09where s_ID = 08935710 and passwd = ‘4ep*NdF’

Page 52: Bernard Menezes Department of Computer Science IIT Bombay.

Constructing an SQL query directly from user input (Example 1)

select s_ID, gpafrom students09where s_ID = 123 and passwd = ‘abc’ or ‘x’ = ‘x’

Page 53: Bernard Menezes Department of Computer Science IIT Bombay.

Constructing an SQL query directly from user input (Example 2)

select s_ID, gpafrom students09where s_ID = 123 or 1=1 - - and passwd = ‘ abc ’

Page 54: Bernard Menezes Department of Computer Science IIT Bombay.

Constructing an SQL query directly from user input (Example 3)

select s_ID, gpafrom students09where s_ID = 123; DROP TABLE students09; - - and

passwd = ‘ abc ’

Page 55: Bernard Menezes Department of Computer Science IIT Bombay.

“ There are two things I am sure after all these years: there is a growing societal need for high assurance software, and market forces are never going to provide it”

- Earl Boebert

Page 56: Bernard Menezes Department of Computer Science IIT Bombay.

Electronic Payment

Page 57: Bernard Menezes Department of Computer Science IIT Bombay.

E-Payment

• Obviates the need to transport, handle, store and dispense physical cash

• Results in enormous savings to banks and merchants.

• Offers unprecedented convenience to the customer who does not need to carry currency notes and coins.

Page 58: Bernard Menezes Department of Computer Science IIT Bombay.

E-Payment – Distinguishing Features

• Real-time, pre-paid, post-paid• Remote versus proximity• E-payment enabling device (cellphone, PC,

smart card)• Communication medium (bluetooth, NFC,

internet, etc.)• On-line versus off-line

Page 59: Bernard Menezes Department of Computer Science IIT Bombay.

CardHolder Present E-Transactions

• Considerable credit card fraud has motivated the use of “Chip N Pin” cards

• Basically a smart card (with an on-card processor)

• Cardholder authenticated using a PIN

• PIN is also securely stored on the card and is securely communicated to the terminal

• Based on the EMV protocol

Page 60: Bernard Menezes Department of Computer Science IIT Bombay.

Mobile Payment Facilities

• Account-related enquiries (for example, account balance)

• Cheque Book Request• SMS alerts • Utility Bill Payment• Purchase of movie tickets, etc.• Funds Transfer

Page 61: Bernard Menezes Department of Computer Science IIT Bombay.
Page 62: Bernard Menezes Department of Computer Science IIT Bombay.

Botnets

Page 63: Bernard Menezes Department of Computer Science IIT Bombay.

Botnets

• A botnet is an army of compromised computers or bots connected to the internet and remotely controlled by a “botmaster”.

• The earliest botnets were a collection of zombies that participated in Distributed Denial of Service (DDoS) attacks.

• Today’s botnets may comprise tens of thousands or even millions of bots.

Page 64: Bernard Menezes Department of Computer Science IIT Bombay.

Botnets (contd.)• The emergence of botnets is closely linked to the motive of

financial gain

• Often used to send spam mail on behalf of third parties.

• Bot programs may contain keyloggers and other forms of spyware that capture sensitive personal information such as passwords and credit card numbers and send these to the botmaster.

• Botnets have also been used as an extortion tool – “Pay up or your web site will be bombarded by a DDoS attack”.

Page 65: Bernard Menezes Department of Computer Science IIT Bombay.

Botnets (contd.)

• One important difference between a bot and a computer infected by a traditional worm/virus or Trojan is that a bot needs to communicate with specific nodes in the botnet to receive fresh commands.

• Early botnets used an IRC server as a Command & Control Server. A channel on such a server was used to convey the botmaster’s commands.

Page 66: Bernard Menezes Department of Computer Science IIT Bombay.

Recent Bots• A more recent trend has been distributed and decentralized

botnet architectures which leverage existing highly scalable and robust P2P networks.

• The connectivity of P2P networks ensures that even if a large number of bots are disabled, the rest of the bots continue to stay connected.

• Moreover, there are no fixed C&C servers making it hard to detect and incapacitate a P2P-based botnet.

Page 67: Bernard Menezes Department of Computer Science IIT Bombay.

The Storm Botnet

• First detected in January 2007. Its other names are Peacomm, Nuwar and Zhelatin.

• Storm bots are infected in stages. The most common vectors for propagating the primary infection appear to be e-mail or infected web sites.

• E-mail was sent with sensational subject lines like “230 die as Storm batters Europe”. Likewise, users were lured into downloading free but infected files from web sites containing music of various pop artists.

Page 68: Bernard Menezes Department of Computer Science IIT Bombay.

A Generic Botnet

Page 69: Bernard Menezes Department of Computer Science IIT Bombay.

Advice to a wannabe Security Analyst

“Security engineering, especially in this third wave, requires you to think differently. You need to figure out not how something works, but how something can be made not to work. You need to imagine an intelligent and malicious adversary inside your system (remember Satan’s computer) constantly trying new ways to subvert it . . .

Page 70: Bernard Menezes Department of Computer Science IIT Bombay.

Advice to a wannabe Security Analyst (contd.)

. . . You have to consider all ways your system can fail, most of them having nothing to do with the design itself. You have to look at everything backwards, upside down, and sideways. You have to think like an alien.”

- Bruce Schneier