122
D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Embed Size (px)

Citation preview

Page 1: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

D u k e S y s t e m s

Threats and defenses

Jeff ChaseDuke University

Page 2: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Protection: abstract concept

• Running code can access some set of data.– Code == program, module, component, instance,

– Data == objects, state, files, VM segments…

• We call that set a domain or protection domain.– Defines the “powers” that the running code has available to it.

– Determined by context and/or identity (label/attributes).

– Protection domains may overlap (data sharing).

Domain: a set of accessible names bound to objects. Accesses are checked by a reference monitor.

Yes, this is verrry abstract. code

datadomain

Page 3: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Breaking the lockbox

• If any part of a domain is tainted…

• Then all of the domain is tainted.

• Attacks propagate: the attacker modifies a program or uses an identity that another victim trusts.

• An attacker with root controls the machine and anyone who uses it.

A Bwrite exec

Page 4: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Rootkit

• If an attacker subverts/compromises the kernel (TCB), then all bets are off.

• The machine is “rooted”: the attacker has full control.

• Attacker may install a rootkit: software that maintains continuous and/or undetectable control.

• A rootkit can:– Log keystrokes

– Hook system APIs

– Open attacker backdoor

– Subvert (re)boot

– Etc….

Page 5: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Enterprise security

• How to gain access to an enterprise?– Compromise a user with access (e.g., admin).

– Attack across the boundary, i.e., over the net.

Page 6: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 7: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

2/19/13Advanced Persistent Threat

Page 8: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 9: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Typically open with a spear phishing

attack containing a trojan horse

Privilege escalationto compromise trusted software or accounts

(e.g., buffer overflow or password crack)

Spread to other users or

machines.

Page 10: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

The Initial Compromise stage represents the methods that intruders use to

penetrate a target organization’s network. APT intruders frequently target

individual users within a victim environment. As such, the most commonly

observed method of initial compromise is spear phishing. Spear phishing

messages may contain malicious attachments, a link to a malicious file, or a link to

a malicious website. Less commonly, APT intruders may attempt to contact

potential victims and send malicious content via social networking sites or instant

messaging. Another common tactic is strategic web compromise, in which the

attacker places malicious code on websites that people in targeted organizations

will likely visit. When they visit these websites in the course of their normal duties,

they will be compromised if their computer is vulnerable to the attacker’s exploit

code. APT groups may also look for vulnerable Internet-facing web servers and

upload webshells in order to gain access to a target’s internal network, or look for

other technical vulnerabilities in public-facing infrastructure.

P63 appendix

Page 11: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Phishing, password attacks, and other “social” attack vectors.

Page 12: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

technology

people

Where are the boundaries of the “system” that you would like to secure?

Where is the weakest link?What happens when the weakest link fails?

Page 13: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

The First Axiom of Security

• “Security is at least as much a social problem as it is a technical problem.”– Translation: humans are the weak link.

• Never lose sight of the social dimension. – Keys left in lock

– Phishing

– Executable attachments

– Trojan software

– Post-it passwords

– Bribes, torture, etc.

– Etc.

Page 14: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Phishing

Page 15: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 16: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

[wikipedia]

Page 17: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Spear phishing

Spear phishing is a social engineering attack.

It is a phishing attack targeted at a specific individual.

E.g., the attack message is designed to look like a communication from a trusted associate of the victim.

Page 18: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 19: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

How not to authenticate an e-mail

Page 20: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Click on it?

Page 21: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 22: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 23: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Gathering secrets

Mandiant discovered that APT1 used a common technique to expand their foothold on a compromised target:

1. Harvest hashed passwords. See Mandiant’s list of privilege escalation tools used.

2. Crack the passwords offline. Most likely a dictionary attack.

Easy to parallelize.

Easy to defeat, but requires good security practices.

3. Use the stolen passwords to get more.And/or harvest encryption keys stored in private files.

Page 24: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Crypto: The Basics

Jeff ChaseDuke University

Page 25: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Principals in a networked system

Alice

BobMallory

attack

Principals are users or organizations, or

software entities acting on their behalf.

How can principals communicate securely?

How do they decide whom to trust?

Page 26: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 27: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Hashed password file

This is a line from /etc/passwd for user Fred Flintstone.login uses this record to validate the user’s password.The file is public, but Fred’s password is secret.Or is it?

hashed

#

Page 28: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Cryptographic hashes

• Also called a secure hash or one-way hash– E.g., SHA0, MD5, SHA1, SHA2, SHA3

• Result called a hash, checksum, fingerprint, digest

• Very efficient

• SHA-x: Secure Hashing Algorithm

SHA1 hash

160 bitsArbitrarily large

“Hash digest”#

Page 29: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Properties of Secure Hashing

• Collision-resistant– There exist distinct M1 and M2 such that h(M1) == h(M2).

– Such collisions are “very hard” to find.

• One way– Given digest, cannot generate an M with h(M) == digest.

– Such collisions are “very hard” to find.

• Secure– The digest does not help to discover any part of M.

SHA1 SHA1X X# #Cheap “Computationally infeasible”

Page 30: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Using hashed passwords

• This protocol takes place over an encrypted connection. The connection is established first, e.g., using SSL/TLS. (later)

• Threat model: attacker steals stored password from server.

• Defense: the server stores a hash of the password, and not the password itself. So an attacker cannot steal the password.

“I’m fflintstone. Password: yabbadabbado.”

Fred

Server

…“Hi Fred. Welcome back.”

“Hi, this is server. Login please.”

Server code:phash = SHAx(“yabbadabbado”);shash = getStoredHash(“fflintstone”);verify shash == phash;

Page 31: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Let’s get this right

• Hashing is not encryption.– “One way” No way to decrypt!

– No keys!

• Client uses password to login, and not the hash. – If the hash alone is sufficient to log in, then an attacker who

gains access to the hashed password file can compromise all accounts, even without knowing the “real” passwords!

– The goal is not to protect the password in transit: we use encryption for that. We want to protect it on the server.

– Server must remember something about a password so that it can verify it, but a hash is “good enough”: the server doesn’t need to remember the password itself.

– So: server stores the hash, and forgets the password.

Page 32: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

abstrusegoose.com

Page 33: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Dictionary attack

Just to spell it out…

1. Pick a candidate password P.

2. Compute H(P) or look it up in a table of precomputed hashes such as a “rainbow table”.

3. Compare H(P) to the hashed password.

4. If it’s a match, then you win: the victim’s “secret” password is P. Use P to masquerade as the victim. The victim loses.

5. Else go to step 1. Repeat as necessary.

Defenses:

(1) Pick a secret P that is “hard to guess”. (2) Add “salt”.

Page 34: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Obviously these passwords are not “hard to guess”. No meaningful password is hard to guess, because there is a limited number of meaningful passwords to choose from.

Page 35: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Cryptography for Busy People

• Standard crypto functions parameterized by keys.– Fixed-width “random” value (length matters, e.g., 256-bit)

– Symmetric (DES: fast, requires shared key K1 = K2)

– Asymmetric (RSA: slow, uses two keys)

• “Believed to be computationally infeasible” to break

E

D

Encrypt

Decrypt

K1

K2

M

M

[Image: Landon Cox]

Page 36: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Symmetric Crypto

• “Secret key” or “private key” cryptography.– DES, 3DES, DESX, IDEA, AES

• Sender and receiver must possess a shared secret

– Shared key K [a random bit string of chosen length]

– K = K1 = K2

• Message M, Key K{M}K = Encrypt(M, K)

M = Decrypt({M}K , K)

Page 37: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Symmetric crypto

Borrowed from https://spideroak.com/blog/20130523083520-drink-your-ovaltine-intro-to-encryption-101

Page 38: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Example: Java Cipher class

Symmetric crypto is easy to use from (e.g.) your Java code.“The Cipher class provides the functionality of a cryptographic cipher used for encryption and decryption. Encryption is the process of taking data (called cleartext) and a key, and producing data (ciphertext) meaningless to a third-party who does not know the key. Decryption is the inverse process: that of taking ciphertext and

a key and producing cleartext.” [oracle.com]

Page 39: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Symmetric crypto: keys

• Anyone can generate a key. Functions are available or common programming languages.– A key is just a random bit string. Choose length wisely: short

keys are cheaper to generate and use, but easier to crack.

– Generators need a good random number generator, with a good seed for randomness. Clock? Timing of a burst of keystrokes?

• The hard part is sharing the key securely.– We need secure communication with the partner to transfer the

key, but the whole point of the key is to enable secure communication!

– This is the key distribution problem.

– Asymmetric crypto can help, as we shall see.

Page 40: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Example: Java KeyGenerator class

“A key generator is used to generate secret keys for symmetric algorithms.” [oracle.com]

But how to share the secret securely? This is the key distribution problem.

Page 41: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Asymmetric (public key) crypto

• Each subject/principal possesses a keypair. – Decrypt(K, Encrypt(K-1, M)) = M

• Keep one key private; the other is public.

• Either key can be used to encrypt/decrypt.

If we know one another’s public keys

then we can communicate securely.

Anyone can mint a keypair.

Page 42: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

E

D

Crypt

Crypt

Asymmetric crypto works both ways

[Landon Cox]

A’s private keyor

A’s public key A’s public keyor

A’s private key

Page 43: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

How to use asymmetric crypto?

• A can send a message to B, encrypted with A’s private key.

• B can send a message to A, encrypted with A’s public key.

• Benefits? Other possibilities?

Page 44: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

abstrusegoose.com

Page 45: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Spelling it out

• Do encrypt message M with your private key to authenticate it, i.e., to convince the recipient that M really came from you.– Better yet, digitally sign M: that’s faster (next).

• Do encrypt M with the recipient’s public key to keep it secret: only the intended recipient can decrypt it.

• Don’t encrypt M with your public key: it’s just weird and pointless, since nobody else can read the encrypted message. Bob probably blew his chances with Alice.

• Don’t encrypt M with the recipient’s private key: if you know someone’s private key then you should not use it! Forget it and don’t tell anyone.

Page 46: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Hybrid cryptosystems

• Symmetric crypto is much cheaper than asymmetric (10Kx).

• But asymmetric is useful to “bootstrap” communication.– All it takes is knowledge of another party’s public key, and it is not

necessary to keep the public keys secret.

• These properties motivate hybrid cryptosystems that use asymmetric in combination with cheaper techniques.

• Digital signatures combine asymmetric with hashing.

“As for SpiderOak, our old clients used a combination of 2048 bit RSA and 256 bit AES. Now new clients use 3072-bit RSA combined with 256 bit AES to meet industry recommendations. We use this mixture of techniques where each is best suited: asymmetric encryption for communications channel setup and key exchange, and symmetric encryption for internal data structures and improved client performance.”

August 2013: https://spideroak.com/blog/20130523083520-drink-your-ovaltine-intro-to-encryption-101

Page 47: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Digital Signature

• A hash digest of message M encrypted with principal B’s private key is called a digital signature

– Unforgeable. “Proves” that B sent M.

– Certified. “Proves” M has not been tampered.

– Non-repudiable. B cannot deny sending M.

– But not private.

Alice,Will you marry me? Signed, Bob

Page 48: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

http://pst.libre.lu/mssi-luxmbg/p1/04_auth-art.html

Page 49: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

The importance of authentication

EMLX

This is a picture of a $2.5B move in the value of Emulex Corporation, in response to a fraudulent press release by short-sellers through InternetWire in 2000. The release was widely disseminated by news media as a statement from Emulex management, but media failed to authenticate it.

[reproduced from clearstation.com]

Page 50: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Digitally signed code

• We have talked about the problem of verifying that programs originate from some trusted/trustworthy source, and are not hacked.

– Where did you get those tools?

• It is common for software updates and other code to be digitally signed by the originator.

• It works if you think you can trust the originator, and you know the originator’s public key.

Page 51: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Two “key points”

• Digital signatures are “stronger” than physical signatures, because they are bound to the document contents.– Attacker cannot change the document contents without

invalidating the signature.

• To verify a signature, the receiver must already know the public key of the signer.– And it must be right.

– But how to know for sure?

Page 52: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Can an attacker break the crypto?

This slide is a dated cultural reference to the 1987 film The Princess Bride, which has some blood and cruelty and uncommonly large rodents but is otherwise recommended for grownup children of all ages, and is delightful not least for its music by Mark Knopfler. Names and images are used without permission for educational purposes.

Page 53: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Cryptographic Key Management Project

Cryptographic Key Management (CKM) is a fundamental part of cryptographic technology and is considered one of the most difficult aspects associated with its use. Of particular concern are the scalability of the methods used to distribute keys and the usability of these methods. NIST has undertaken an effort to improve the overall key management strategies used by the public and private sectors in order to enhance the usability of cryptographic technology, provide scalability across cryptographic technologies, and support a global cryptographic key management infrastructure.

[http://csrc.nist.gov/groups/ST/key_mgmt/]

Follow best practices for crypto, from authoritative sources. Best practices change frequently! Key sizes must grow as computational power increases.

Page 54: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Cryptosystems in Practice

Jeff ChaseDuke University

Page 55: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Principals in a networked system

Alice

BobMallory

attack

Principals are users or organizations, or

software entities acting on their behalf.

How can principals communicate securely?

How do they decide whom to trust?

Page 56: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Crypto primitives

Encrypt/Decrypt

Signing

Secure hashing

Use a shared secret key(symmetric)

oruse a keypair

one public, one private(asymmetric)

useful forfingerprinting data

Page 57: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Alice and Bob

• Alice and Bob want to communicate securely.• How can they authenticate one another?

• How can Alice verify that each message from Bob is not modified in transit by an adversary? (integrity)

• How can Bob send private messages that Alice can read?

• What assumptions must we rely on?

Page 58: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

“Key points” about basic cryptosystems

• Anyone can generate a key or a keypair. It’s cheap enough to be practical. (But generating keypairs is costly enough to try to avoid.)

• Choose your key length wisely. Smaller keys are cheaper to generate and use, but also easier to break.

• All cryptosystems rely on two basic assumptions: the parties know their shared keys, and nobody else knows their secret keys.

– Never forget it: crypto is only as secure as the keys. A well-resourced adversary can penetrate your system to “recover” stored keys.

• Change (rotate) keys as appropriate. The longer they are in use, the more likely they are to be compromised.

• Protocols must be designed to prevent replay attacks, in which an attacker can subvert the protocol without breaking the crypto!

Page 59: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Simple shared-secret based cryptographic authentication

[email protected]

Page 60: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Add mutual authentication

[email protected]

Page 61: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Two “Key points”

• The random challenge is a nonce.– “number used once”

– It generates a new random challenge each time.

• Understand why the protocol uses a nonce.

• In order for this protocol to work, Alice and Bob need a shared secret.

• How can they establish this shared secret safely?

Page 62: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Note on noncesA nonce is just a unique value we put into a message to distinguish it from all other messages: we use each nonce value at most once: nonce means "number used once”. A timestamp is an example of a nonce: the current time is different from all previous times.

The purpose of a nonce is to defend against a replay attack, in which the attacker replays a previous signed or encrypted message that is still meaningful. Even if an attacker lacks the keys to inject a valid message into a security protocol, it might be able to replay an old message to subvert the protocol somehow. A nonce defends against that because it allows the receiver to determine if a message is fresh, i.e., to detect a replayed message as invalid.

For example, in the classic challenge-response authentication protocol (similar to the military Identify Friend or Foe protocol), the challenge value is a nonce. The protocol is: I make up a nonce and send it to you as a challenge, and you decrypt it and/or encrypt/sign it and send it back, thereby proving that you possess a necessary key. The challenge value must be a nonce: if I use the same challenge repeatedly, then an attacker could overhear a valid response to an earlier challenge, and then replay the response for a future challenge.

Nonces are important. A formal analysis of the classic Needham-Schroeder authentication protocol found it to have a crucial flaw due to lack of a nonce in one step of the protocol. Note: this protocol addresses the problem raised in the challenge-response slides: it establishes a shared secret between two parties via brokering by a trusted intermediary. It is similar to the protocol used in Shibboleth Web Single Sign On (e.g., for Duke NetIDs): the trusted intermediary is a Shibboleth identity provider.

Page 63: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Finding the right key

• If either Alice or Bob knows the other’s public key, they can share any secret.

• How does Alice know Bob’s public key?

Alice,Will you marry me? Signed, Bob

Page 64: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Endorsements: certificates

• A principal may endorse another’s key.

• Issue a signed statement containing the key, and some statement about the key or the key holder (subject).

• We call the signed statement a certificate.

• But how does anyone know the endorser’s key?

CertificateTerm of validity

Issuer’s name (or key)

Signature

Bob’s key is 247E6F1A…

Page 65: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Certificates: a general view • A principal A delegates trust to another (B) by endorsing its

public key as bound to a global name (or any other attribute).

• A delegation is an assertion of fact by the issuer A, and is commonly issued as a certificate that is digitally signed by A.

• In a standard x.509 identity cert (e.g., issued by a PKI CA for Web), the attribute is a distinguished name.

– e.g., “Bob” or “amazon.com”

– PKI- CA: Public Key Infrastructure, Certifying Authority

CertificateTerm of validity

Issuer’s name (or key)

Signature

Payload: statement

Because the certificate is signed, a third party C can validate and use A’s statement about B, if C knows A’s public key and if C trusts A.

Trust management systems use certificates to encode other kinds of attributes and statements, e.g., arbitrary logic statements about B.

Page 66: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

A Digital Certificate (X.509)

Page 67: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

“It’s not hard”

public Identity(String cn) throws CertificateException,

NoSuchAlgorithmException,InvalidKeyException, NoSuchProviderException, SignatureException, IOException {X509V1CertificateGenerator gen = new X509V1CertificateGenerator();kp = KeyPairGenerator.getInstance("RSA").genKeyPair();

gen.setIssuerDN(new X500Principal("CN=" + cn));gen.setSubjectDN(new X500Principal("CN=" + cn));gen.setNotAfter(new Date(System.currentTimeMillis()

+ 3600 * 1000 * 24 * 365));gen.setNotBefore(new Date(System.currentTimeMillis()));gen.setSerialNumber(BigInteger.valueOf(System.currentTimeMillis()));gen.setPublicKey(kp.getPublic());gen.setSignatureAlgorithm("SHA256WithRSAEncryption");X509Certificate a = (X509Certificate) gen.generate(kp.getPrivate(),

"BC");init(a);

}

Page 68: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Clients and servers

“GET /images/fish.gif HTTP/1.1”

sd = socket(…);connect(sd, name);write(sd, request…);read(sd, reply…);close(sd);

s = socket(…);bind(s, name);sd = accept(s);read(sd, request…);write(sd, reply…);close(sd);

request

reply

client (initiator) server

Page 69: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Mallory-in-the-Middle attack

“GET fish.gif…”request

reply

client (initiator) server

“GET fish.gif …”request

reply

If an attacker can interpose between two interacting entities, she can read and modify the messages at will without detection by either victim.

Page 70: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Hijacking a connection

sd = socket(…);connect(sd, name);…

client (initiator)The adversary must be able to “take over” the name, so that resolving the name redirects the connection request to some computer controlled by the adversary.

For the connect and bind system calls, the name is an IP address (if IP networking is being used). But to get the server’s IP address, the client first performs a lookup in the Domain Name Service for a DNS name of the server (such as www.cs.duke.edu). This step may be vulnerable.

Page 71: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

DNS and the Web

DNS

IP addr

a.comBrowser

HTTP GET: /dog.jpg

http://<A HREF=http://a.com/dog.jpg>Spot</A>

Web Page

[Michael Walfish]

www

Page 72: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Subdomains, authority, and delegation

root

.com .edu

stuff.com

shop.stuff.com

apps1.shop.stuff.com www.cs.duke.edu

duke.edu

cs.duke.edu

The DNS name space is a hierarchy of naming domains.

A domain is a zone of administrative control.

A domain is authoritative for the names in its part (zone) of the tree.

A domain can delegate control of a subtree to a subdomain.

Page 73: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Domain name hierarchy

http://technet.microsoft.com/en-us/magazine/2005.01.howitworksdns.aspx

top-leveldomains(TLDs)

Page 74: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

DNS as a distributed service

• DNS is a “cloud” of name servers

• owned by different entities (domains)

• organized in a hierarchy (tree) such that

• each controls a subtree of the name space.

Page 75: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

DNS Roots

There are 13 root “clusters”, each with its own IP address.Each cluster replicates the root domain, and can serve queries.Most root clusters have multiple instances (replicas).Queries to a cluster are routed to the “closest” instance by IP anycast.

Page 76: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

http://www.internic.net/zones/named.root

Page 77: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

DNS Lookup

Page 78: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

DNS Lookup

Page 79: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 80: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

DNSSECCan DNS itself be made more secure? Yes!• Each DNS domain/subdomain (or “zone”) server has a keypair.

• Each server signs entries in its zone database (“Resource Records”)

• Return signed lookup results: in effect, sign all DNS responses

• Each parent domain endorses the public key of each child: in effect, each parent issues certificate for each child zone in the hierarchy.

• Can validate the whole response chain, all the way back to the root…

• IF DNSSEC is fully deployed. (it’s not…yet)

Page 81: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

DNSSEC

[http://www.nlnetlabs.nl/publications/dnssec_howto/][Osterweil; Massey; Zhang]

https://www.iana.org/dnssec

Page 82: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Secure DNS (DNSSEC) Threat Model

• DNSSEC defends against:– DNS spoofing, cache poisoning

– man-in-middle attacks on DNS requests/responses

• What DNSSEC cannot do– Defend against rogue domain administrators

– Defend against denial-of-service attacks

– Defend against compromise of a DNS server or its key

– Protect users who don’t check that they are talking to nicebank.com or n1cebank.com (pharm attack)

– Protect communication between the named endpoints.

– And how does client know the public key of DNS root?

Page 83: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

End-to-end security: HTTPS

• How to authenticate shop.com, even if DNS is insecure?

• How to assure integrity/privacy of communications, even if the net is insecure?

• How to prevent man-in-the-middle attacks?

• Answer: Secure Sockets (SSL) or Transport-Layer Security (TLS), e.g., as used by HTTPS.

https://www.shop.com/shop.html

Page 84: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Symmetric and Asymmetric Crypto: Better Together

• Use asymmetric crypto to “handshake” and establish a secret session key (slow, but allows for key distribution).

• Then use the key to talk with symmetric crypto (fast and cheap)

• Example: Secure Sockets Layer (SSL) or Transport-Layer Security (TLS), used in HTTPS (Secure HTTP), SSH, SCP, etc.

“TCP SYN, etc.”

“My public key is K.”

Client Server“Let’s establish a session key: {S}K .”

{M}S

[encrypted data or content]

Page 85: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

What are we missing?

• This approach solves the “key distribution problem” for symmetric crypto.– And we want to use symmetric crypto because it

is fast and cheap.

• But it presumes that a participant knows the public key of another.– Does C know (believe) that K really is the public

key of S? It better be, or all bets are off!

• How to authenticate S?

Page 86: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

How does C know the public key of S?

Page 87: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 88: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 89: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Take a breath

• Your browser can verify the server identity if it knows the “real” server’s public key.

• The server presents a certificate endorsed by a third party (CA).

• Your browser can verify the certificate if it knows the CA’s public key.

• How does your browser know the CA’s public key?

Page 90: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

The CA’s public key is “baked into your browser”. You trust your browser provider to install a list of CAs that you can trust. Any CA on the list can issue a certificate for any name and any public key, and your browser will believe the asserted binding.

What could go wrong?

Reference: “Certified Lies”, e.g., see the 2010 paper by Soghoian and Stamm.

Page 91: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Spelling it out: HTTPS/SSL(1) When the server passes its public key K to the client, it also passes a certificate issued by

a CA. The certificate endorses the key K and binds K to a DNS name (e.g., amazon.com). The server’s DNS name is listed as the “distinguished name” in its identity certificate.

(2) The client’s browser validates the server’s certificate and checks to verify that the DNS name matches the DNS name in the https URL that the client is fetching. I.e., the certificate "proves" that the server is the "right" server for the requested URL.

(3) The client can validate the server's certificate iff the client (browser) trusts the issuing CA. How does the client know if it trusts the issuing CA? Answer: the browser has a "baked in" list of trusted CAs and their public keys. The set of CAs and signing protocols and certificate standards (x.509 identity certificates) is called Public Key Infrastructure or PKI.

(4) The client generates a session key and encrypts it with the server’s public key K, which it obtains from the cert. The session key is a secret shared by the client and server: the server can decrypt it (since it has the corresponding private key), but nobody else can.

(5) Now the client and server have a shared secret session key: they can communicate using symmetric crypto, which is fast and cheap.

Page 92: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

PKI: What could go wrong?

Who decides if a CA is “trustworthy”? Should you believe them? Should you trust your browser provider to make the list of trusted CAs? Who tells you a CA is trustworthy? Are you sure it’s someone you trust? How can you can be sure that you have the "true" browser code with the "true" list?

What if they’re wrong? What if a CA is subverted or goes rogue? Or loses its private key in an attack?

We can learn about keys from a chain of endorsements rooted in some trust anchor, whose key we “just know”.

Example: root certifying authorities (CAs) whose keys are baked into your Web browser.

Page 93: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 94: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 95: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 96: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 97: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 98: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Reuters, June 2012

wired.com, June 2012

Page 99: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Also in the news

See also epic.org

Page 100: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

http://www.propublica.org/article/the-nsas-secret-campaign-to-crack-undermine-internet-encryption

Page 101: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 102: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Where did you get those tools? 11/1/13

Page 103: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Also in the news, the Snowden NSA leak for Hallowe’en 2013. Scary?

Page 104: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

We stopped here

Page 105: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Authentication for Secure HTTP

• Browser always authenticates the server.– Server presents certificate signed by a valid PKI CA.

– Domain name must match the name in certificate, etc.

• Server optionally requests to authenticate the browser (client, user or user agent).– Browser presents a user certificate, OR

– Password authentication is much more common. (why?)

• Server may authenticate client using a web sign on protocol, also called single sign on (SSO).

Page 106: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

IdentityProvider(IdP)

ServiceProvider(SP): the web server

Directory

1. I’d like access

2. Please login to your home IdP, which I trust.

3. I’d like to login for SP.

User4. Login

5. Here are your session attributes to send to SP.

6. Here are my attributes.

8a. Access granted

8b. Access Denied Policy

SSO 101 (e.g., Shibboleth)

Page 107: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

SSO: high-level view

• The point of SSO: a user logs into a single account at the IdP, with a single password. The IdP can authenticate the logged-in user to any number of SPs. The IdP does not have to tell the SP who the user is (“alice”), but may instead reveal other attributes (“a student”).

• Left as an exercise: how to use crypto to authenticate the parties and protect the communications in this SSO protocol? How does SP know the attributes really came from the IdP? How does SP know that it can trust the IdP? How does IdP know that it is OK to reveal user attributes to the SP?

• Short answer: a trusted intermediary, whose public key is known to all SPs and IdPs, endorses the parties to one another. Each IdP pre-approves the SPs it trusts, and pre-negotiates shared secret keys with each SP.

Page 108: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

SSL is not so simple…

• How do we know who we are talking to?– Do we care? Somebody does…

– In SSL, either party MAY present a certificate.

– At least one MUST (e.g., server to validate key K).

• How to prevent replays of encrypted content?– Nonces, serial numbers, timestamps

• SSL/TLS uses this basic handshake protocol, but there are some subtleties:– Hashes and MACs

Page 109: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

SSL in detail

http://docs.oracle.com/javase/7/docs/technotes/guides/security/crypto/CryptoSpec.html

Page 110: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Public Key Infrastructure (PKI)

• Assumption: everyone trusts some root CAs.

• Institutions/organizations set up their own CAs, and the root CAs endorse them to issue certificates for their members.– $$$

• Recursively, to form a hierarchy like DNS.– Delegation of Authority

• Network applications will have access to the keypairs and certificates of their users, and will validate the certificates of servers.

– Any day now…

Page 111: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Security, an overview

We reduce it to three intertwined issues:

1. What program am I running?– Can this program be trusted? Who says?

– Can I be sure that the program has not been tampered?

2. Who am I talking to? – Can this entity be trusted?

– Can I be sure the communication has not been tampered?

3. Should I approve this request? R(op, subject, object)

– Who is the requester? (subject)

– What program is speaking for the requester?

– Does the subject have the required permissions?

Page 112: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Elements of security

• Isolation/protection– Sandboxes and boundaries prevent unchecked access.

• Integrity– Fingerprint data to detect tampering.

– Encrypt data to prevent access or tampering.

• Authentication– Identify a peer by proof that it possesses a secret.

• Identity and attributes– Identities have credentials: names, tags, roles...

• Authorization == access control– Guard checks credentials against an access policy.

Page 113: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Protection: concept

Examples

• A Unix program running in a process (VM/VAS). – The machine checks address references against the VAS maps.

– The kernel checks references to files, ports, etc.

• A web script running in a browser.– Browser checks access to data, cookies, server URLs.

• A Java procedure.– JVM+libs check all accesses.

– Java Security Architecture

code

datadomain

Java bytecode can access nothing more than the object references passed to it, because Java is type-safe: e.g., no pointer arithmetic.This a form of language-based protection.

Page 114: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Concept: enforced modularity

pipe(or other channel)

An important theme By putting each program or module instance in a separate process, or (more generally) protection domain, we can enforce modularity boundaries. Each module runs in a sandbox: they can interact only through pipes or some other communication channel (e.g., a network

socket). Neither can access the internals of the other.

domain (“context”)

domain (“context”)

Page 115: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Sandbox vs. lockbox

• Consider two program instances A and B, each instance running within its own protection domain (e.g., process).– Domain is a sandbox: “can’t get out”.

• If all code runs in a sandbox, then we can think of domain (loosely) as a lockbox: “can’t get in”.– It is my sandbox that stops me from nosing into your data.

– Lockbox what we mean by isolation boundary.

A B

Page 116: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Abstract concept:Trusted Computing Base (TCB)• The OS kernel sees everything.

– No sandbox: it can access anything on the machine.

– There is nothing to protect your “lockbox” from it.

• Everybody trusts the kernel: Trusted Computing Base

• TCB is the software that implements/enforces the sandboxes.

• TCB defines everything you can see or do.

A B

Kernel (TCB)

Page 117: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

[microsoft.com]

Page 118: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

Browser as TCB?

• Web scripting is a potential attack vector.– E.g., Javascript

– Java applets

• If a script can subvert your browser, how much damage can it do?

Page 119: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 120: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 121: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University
Page 122: D u k e S y s t e m s Threats and defenses Jeff Chase Duke University

What to Know about DNS

• Root of hierarchy– “Bottleneck, single point of failure, single point of attack”

– Recognize governance issue: administration of a global name space (yes, ICANN)

• What if DNS lies to you or is compromised/spoofed?• HTTPS/SSL/SSH offers end-to-end integrity as a “fallback”.

• Understand how.

• Hierarchical signing can be used to assure integrity within DNS (DNSSEC).

• What is the “right” layer to address the security issues?