Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Pki 2

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 84

COMP3355 Cyber Security (2023 Fall) PKI

Public Key Infrastructure (PKI)

Chenxiong Qian
cqian@cs.hku.hk
COMP3355 Cyber Security (2023 Fall) PKI

Previously on Crypto
 Symmetric crypto
 DES, AES, etc.
 One secret key
 Fast
 Asymmetric crypto
 RSA
 One public key and one private key
 Slow
 Key exchange, signing, authentication
COMP3355 Cyber Security (2023 Fall) PKI

In This Class
 What is public key infrastructure (PKI)?

 What is the purpose of PKI?

 How does PKI work?

 How to secure PKI?


COMP3355 Cyber Security (2023 Fall) PKI

Man-in-the-middle (MITM) Attack


 Alice and Bob want to establish a communication channel with a symmetric key

Encrypt

Decrypt
Alice Bob
COMP3355 Cyber Security (2023 Fall) PKI

Man-in-the-middle (MITM) Attack


 Eve pretends to be Bob
Hi Alice, I am
Bob, here is my
public key.

Encrypt

Decrypt
Alice Eve
COMP3355 Cyber Security (2023 Fall) PKI

Man-in-the-middle (MITM) Attack


File File
Alice Bob
SHA-256
File is not
modified.
Message
SHA-256 Digest Yes
Alice’s private key Alice’s public key
Equal?
No
Encrypt Decrypt
File is
Message Encrypted Encrypted Decrypted Message modified.
Digest Message Message Digest
Digest Digest
COMP3355 Cyber Security (2023 Fall) PKI

Man-in-the-middle (MITM) Attack


Hi Bob, I am Alice, I
File will send you a file. File
Eve Bob
SHA-256
File is not
modified.
Message
SHA-256 Digest Yes
Eve’s private key Eve’s public key
Equal?
No
Encrypt Decrypt
File is
Message Encrypted Encrypted Decrypted Message modified.
Digest Message Message Digest
Digest Digest
COMP3355 Cyber Security (2023 Fall) PKI

Man-in-the-middle (MITM) Attack


 Eve controls the communication channel

Alice Bob
COMP3355 Cyber Security (2023 Fall) PKI

Problem
 How can we verify the identify in the digital world?
COMP3355 Cyber Security (2023 Fall) PKI

Digital Certificate
 A certificate is an electronic document that is used to identify an
individual, a server, a company, or some other entity, and to associate
that identity with a public key
COMP3355 Cyber Security (2023 Fall) PKI

Digital Certificate
 A certificate is an electronic document that is used to identify an
individual, a server, a company, or some other entity, and to associate
that identity with a public key
COMP3355 Cyber Security (2023 Fall) PKI

Digital Certificate
 A certificate is an electronic document that is used to identify an
individual, a server, a company, or some other entity, and to associate
that identity with a public key
COMP3355 Cyber Security (2023 Fall) PKI

Digital Certificate
 A certificate is an electronic document that is used to identify an
individual, a server, a company, or some other entity, and to associate
that identity with a public key
COMP3355 Cyber Security (2023 Fall) PKI

Digital Certificate
 A certificate is an electronic document that is used to identify an
individual, a server, a company, or some other entity, and to associate
that identity with a public key
COMP3355 Cyber Security (2023 Fall) PKI

Digital Certificate
 A certificate is an electronic document that is used to identify an
individual, a server, a company, or some other entity, and to associate
that identity with a public key
COMP3355 Cyber Security (2023 Fall) PKI

Digital Certificate
COMP3355 Cyber Security (2023 Fall) PKI

Digital Certificate
COMP3355 Cyber Security (2023 Fall) PKI

Digital Certificate
 Check a website’s certificate
COMP3355 Cyber Security (2023 Fall) PKI

Digital Certificate
 Check a website’s certificate
COMP3355 Cyber Security (2023 Fall) PKI

Public Key Infrastructure (PKI)


 Public Key Infrastructure (PKI) is a set of hardware, software, people,
policies, and procedures needed to create, manage, distribute, use,
store, and revoke digital certificates
COMP3355 Cyber Security (2023 Fall) PKI

Public Key Infrastructure (PKI)


 Public Key Infrastructure (PKI) is a set of hardware, software, people,
policies, and procedures needed to create, manage, distribute, use,
store, and revoke digital certificates

 Certificate Authority
 Sign and issue
certificates

PKI Overview
COMP3355 Cyber Security (2023 Fall) PKI

Public Key Infrastructure (PKI)


 Public Key Infrastructure (PKI) is a set of hardware, software, people,
policies, and procedures needed to create, manage, distribute, use,
store, and revoke digital certificates

 Certificate Authority
 Sign and issue
certificates

 Registration Authority
 Identify and authenticate PKI Overview
certificate applicants
COMP3355 Cyber Security (2023 Fall) PKI

Public Key Infrastructure (PKI)


 Public Key Infrastructure (PKI) is a set of hardware, software, people,
policies, and procedures needed to create, manage, distribute, use,
store, and revoke digital certificates

 Certificate Authority
 Validation Authority
 Sign and issue
 Verify the validity of
certificates
a certificate

 Registration Authority
 Identify and authenticate PKI Overview
certificate applicants
COMP3355 Cyber Security (2023 Fall) PKI

Registration Authority
 A gatekeeper of CA
 Does not sign or issue certificates
 Checks applicants’ IDs and paperwork
 Forwards the request to CA
COMP3355 Cyber Security (2023 Fall) PKI

Certificate Authority
 CA receives the request from RA

Name: Peter Parker


Organization: The Avengers
Address: New York, USA
…….

Request from RA
COMP3355 Cyber Security (2023 Fall) PKI

Certificate Authority
 Signs the applicant’s entity info and public key
 Generates the signature
 Signs the signature using its private key

CA’s Private Key

Name: Peter Parker Hash & Sign


Organization: The Avengers
Address: New York, USA
…….

Request from RA
COMP3355 Cyber Security (2023 Fall) PKI

Certificate Authority
 Issues the certificate that contains
 The entity info and public key
 The signature (encrypted using CA’s private key)
 Etc.
CA’s Private Key

Name: Peter Parker


Organization: The Avengers
Address: New York, USA
Name: Peter Parker Sign
…….
Organization: The Avengers
Address: New York, USA
…….

Digital Signature

Request from RA
Certificate
COMP3355 Cyber Security (2023 Fall) PKI

Certificate
 X.509 is an International Telecommunication Union (ITU) standard
defining the format of public key certificates

HKU’s Wi-Fi

Issued by DigiCert Inc

Will be expired on Aug 19th, 2023

Public key
Signature
COMP3355 Cyber Security (2023 Fall) PKI

CA’s Private Key

Name: Peter Parker


Organization: The Avengers
Address: New York, USA
Name: Peter Parker Sign
…….
Organization: The Avengers
Address: New York, USA
…….

Digital Signature

Request from RA
Certificate
COMP3355 Cyber Security (2023 Fall) PKI

Use the Certificate

I am Peter, this
is my
certificate

Name: Peter Parker


Organization: The Avengers
Address: New York, USA
…….

Digital Signature
COMP3355 Cyber Security (2023 Fall) PKI

Use the Certificate

I need to validate
it before using the
public key

Name: Peter Parker


Organization: The Avengers
Address: New York, USA
…….

Digital Signature
COMP3355 Cyber Security (2023 Fall) PKI

Use the Certificate


 Calculates the certificate’s hash

SHA-256 Signature

Name: Peter Parker


Organization: The Avengers
Address: New York, USA
…….

Digital Signature
COMP3355 Cyber Security (2023 Fall) PKI

Use the Certificate


 Gets CA’s public key

SHA-256 Signature

Name: Peter Parker


Organization: The Avengers
Address: New York, USA
…….

CA’s public key


Digital Signature
COMP3355 Cyber Security (2023 Fall) PKI

Use the Certificate


 Uses CA’s public key to decrypt the encrypted signature in the
certificate

SHA-256 Signature

Name: Peter Parker Signature


Organization: The Avengers
Address: New York, USA
…….

CA’s public key


Digital Signature

Decryption
COMP3355 Cyber Security (2023 Fall) PKI

Use the Certificate


 Compares two signatures
He is Peter.

Yes
SHA-256 Signature Equal?
No
He is not
Name: Peter Parker Signature Peter.
Organization: The Avengers
Address: New York, USA
…….

CA’s public key


Digital Signature

Decryption
COMP3355 Cyber Security (2023 Fall) PKI

Public Key Infrastructure (PKI)


 Trusted parties
 CA, RA, VA
 Top popular CAs

Most of time, we use “CA” to refer all


three parties: CA, RA, and VA.
COMP3355 Cyber Security (2023 Fall) PKI

Public Key Infrastructure (PKI)


 Trusted parties
 CA, RA, VA
 Top popular CAs
COMP3355 Cyber Security (2023 Fall) PKI

CA Hierarchy
 Root CA
 Issues certificates to
intermediate CAs
 Intermediate CA
 Issues certificates to
end users
COMP3355 Cyber Security (2023 Fall) PKI

Single/One-Tier Hierarchy
 The single CA is both a root CA
and an issuing CA
 Security risks
 The only CA is online
 If the CA is compromised:
 Cannot quickly distribute a new
root CA
 Cannot revoke the CA
 Management issues
 Not flexible
 Not scalable
COMP3355 Cyber Security (2023 Fall) PKI

Two-Tier Hierarchy
 Separate the root CA and
issuing CA
 Root CA is offline
 Issuing CAs are online
 Benefits:
 Security
 Scalability
 Flexibility
 Manageability cost
increases
COMP3355 Cyber Security (2023 Fall) PKI

Three-Tier Hierarchy
 The second tier CAs
 Policy CAs
 Revoke CAs
 Benefits:
 Security
 Scalability
 Flexibility
 Manageability cost
increases
COMP3355 Cyber Security (2023 Fall) PKI

Certificate Path
Reference
Root CA’s Certificate
Intermediate CA Intermediate CA’s Certificate
Private Key Root CA Private Key Root CA
Distinguished Name
Intermediate CA
Distinguished Name
Self-Sign
Sign Root CA Public Key
Intermediate CA Root CA
Public Key
Root CA Signature
Sign Intermediate CA
Signature

End User Root CA


Distinguished Name Distinguished Name
Intermediate
Ender User
Public Key CA

End User Signature

Intermediate CA Reference
Distinguished Name
End User
End User’s Certificate
COMP3355 Cyber Security (2023 Fall) PKI

Certificate Verification
Root CA’s Certificate
Intermediate CA’s Certificate
Root CA
Distinguished Name
Intermediate CA
Distinguished Name Verify
Root CA Public Key
Verify Intermediate CA
Public Key
Root CA Signature
Intermediate CA
Signature

End User Root CA


Distinguished Name Distinguished Name Reference
Ender User
Public Key

End User Signature

Intermediate CA
Distinguished Name
Reference
End User’s Certificate
COMP3355 Cyber Security (2023 Fall) PKI

Demo
 https://stackexchange.com
COMP3355 Cyber Security (2023 Fall) PKI

Demo
COMP3355 Cyber Security (2023 Fall) PKI

Demo
 https://stackoverflow.com
 Why does “stackoverflow” use
“*.stackexchange” certificate?
COMP3355 Cyber Security (2023 Fall) PKI

Demo
 http://google.com
 Big techs self-sign certificates
COMP3355 Cyber Security (2023 Fall) PKI

Questions
 Who is responsible to generate keys?

 How to protect CAs from attacks?

 How to update/revoke certificates?


COMP3355 Cyber Security (2023 Fall) PKI

Key Generation
 Basic approach:
 Alice generates her own key pair
 The CA signs a statement about Alice’s public key and issues a public key
certificate (PKC)
 Bob knows Alice’s public key from verifying the PKC

 What’s the problem?


 Neither Bob nor the CA know that Alice has the private key
COMP3355 Cyber Security (2023 Fall) PKI

Key Generation
 Improved approach (Most common)
 Alice generates her own key pair
 Alice brings the public key and a signed request showing that she knows the
private key
 CA verifies the signed request and the public key
 The CA signs a statement about Alice’s public key and issues a PKC
 Bob knows Alice’s public key from verifying the PKC

 What is the problem?


 What if Alice lost her private key?
 Revoke and issue a new certificate
COMP3355 Cyber Security (2023 Fall) PKI

Key Generation
 Improved approach
 CA generates the key pair for Alice and then issues the key pair to Alice

 What’s the problem?


 Alice worries that CA may store or disclose the private key
COMP3355 Cyber Security (2023 Fall) PKI

How to enforce the security of CA?


 Physical Security
 Doors requiring multiple verifications
 A proximity card, a PIN pad, biometric scanners, security guards
 Put servers in cages
 Closed-circuit surveillance
 Use Multiple Person Control
 No single person can gain access to sensitive assets
 Keep root CA and higher-level CAs offline
 Etc.
COMP3355 Cyber Security (2023 Fall) PKI

Symantec Example

One of many fingerprint scanners at the entrance to a Inside these security cabinets are the hardware security modules
data center at Symantec's SSL certificate vault. that safeguard millions credentials used to authenticate the
websites of Symantec customers.
COMP3355 Cyber Security (2023 Fall) PKI

Symantec Example

The digital assets for Symantec can be accessed The key-ceremony room.
only when three separate employees insert a
USB-looking key and enter a corresponding PIN.
COMP3355 Cyber Security (2023 Fall) PKI

Key Ceremony Video

The Internet Corporation for Assigned Names and Numbers (ICANN)


COMP3355 Cyber Security (2023 Fall) PKI

DigiNotar Story
 Aug. 27th, 2011
 An Iranian man “Alibo” couldn’t connect to Gmail
 He switched to a virtual private network that disguised his location, and he
can access Gmail
 Posted a question about the issue on the Gmail Help Forum
 Two days later
 Google issued a public statement
COMP3355 Cyber Security (2023 Fall) PKI

DigiNotar Story
COMP3355 Cyber Security (2023 Fall) PKI

DigiNotar Story
 Aug. 27th, 2011
 An Iranian man “Alibo” couldn’t connect to Gmail
 He switched to a virtual private network that disguised his location, and he
can access Gmail
 Posted a question about the issue on the Gmail Help Forum
 Two days later
 Google issued a public statement
 Within a month
 The Dutch government took over DigiNotar
 Within two months
 DigiNotar declared bankruptcy and dissolved
COMP3355 Cyber Security (2023 Fall) PKI

DigiNotar Story
 On July 19th, DigiNotar found some signed certificates not listed in the
logs, and DigiNotar launched an internal investigation
 Aug. 27th, 2011
 An Iranian man “Alibo” couldn’t connect to Gmail
 He switched to a virtual private network that disguised his location, and he
can access Gmail
 Posted a question about the issue on the Gmail Help Forum
 Two days later
 Google issued a public statement The attacker accessed 300,000
Gmail accounts
 Within a month
 The Dutch government took over DigiNotar
 Within two months
 DigiNotar declared bankruptcy and dissolved
COMP3355 Cyber Security (2023 Fall) PKI

How did the attack happen?


COMP3355 Cyber Security (2023 Fall) PKI
COMP3355 Cyber Security (2023 Fall) PKI

Certificate Revocation
 Key leaked
 CA went wrong
 Certificate went wrong
 The world went wrong
COMP3355 Cyber Security (2023 Fall) PKI

Demo
 https://revoked.badssl.com

This demo was shown in Sep 2022 when the


certificate was not expired.
COMP3355 Cyber Security (2023 Fall) PKI

Demo
 https://www.digicert.com/kb/digicert-root-certificates.htm
  Demo Sites for Root  revoked
COMP3355 Cyber Security (2023 Fall) PKI

Validation Authority

He is Peter.

Yes
SHA-256 Signature Equal?
No
He is not
Name: Peter Parker Signature Peter.
Organization: The Avengers
Address: New York, USA
…….

CA’s public key


Digital Signature

Decryption
COMP3355 Cyber Security (2023 Fall) PKI

Validation Authority
 Verify the validity of a certificate
 Expired? He is Peter.
 Revoked?
Yes
SHA-256 Signature Equal?
No
He is not
Name: Peter Parker Signature Peter.
Organization: The Avengers
Address: New York, USA
…….

CA’s public key


Digital Signature

Decryption
COMP3355 Cyber Security (2023 Fall) PKI

Validation Authority
 Verify the validity of a certificate
 Expired?
 The certificate contains the expiration status
 Revoked?
 The certificate has no information indicating revocation status
COMP3355 Cyber Security (2023 Fall) PKI

Certification Revocation List (CRL)


 Create a metadata record about the unusable status of the certificate
in a special list of revoked certificates (CRL)
 The revoked certificate itself won’t change
 A CRL is generated and published periodically
 Daily, hourly, etc.
COMP3355 Cyber Security (2023 Fall) PKI

Certificate Revocation Check (CRL)


 Check a certificate’s revocation status using a CRL
COMP3355 Cyber Security (2023 Fall) PKI

Certificate Revocation Check (CRL)


 Check a certificate’s revocation status using a CRL
COMP3355 Cyber Security (2023 Fall) PKI

Demo
 https://www.apple.com
COMP3355 Cyber Security (2023 Fall) PKI

Demo
 https://www.apple.com
 Fetch the CRL
 wget http://crl.apple.com/apevsrsa2g1.crl
 Dump the CRL
 openssl crl -inform DER -in apevsrsa2g1.crl -text -out crl.txt
 Search the serial number:
 2A 70 C0 82 19 20 B6 96 FD 26 B7 5A 72 B8 EC E4
COMP3355 Cyber Security (2023 Fall) PKI

Demo2
 https://digicert-tls-ecc-p384-root-g5-revoked.chain-demos.digicert.co
m
COMP3355 Cyber Security (2023 Fall) PKI

Demo2
 https://digicert-tls-ecc-p384-root-g5-revoked.chain-demos.digicert.co
m
 Fetch the CRLs
 wget http://crl3.digicert.com/DigiCertG5TLSECCSHA3842021CA1-1.crl -O 1.crl
 wget http://crl4.digicert.com/DigiCertG5TLSECCSHA3842021CA1-1.crl -O 2.crl
 Dump the CRLs
 openssl crl -inform DER -in 1.crl -text -out crl1.txt
 openssl crl -inform DER -in 2.crl -text -out crl2.txt
 Search the serial number:
 05 9C B6 7A C3 33 6F EE E8 56 B2 72 86 3C 6F 53
COMP3355 Cyber Security (2023 Fall) PKI

Certificate Revocation Check (CRL)


 Check a certificate’s revocation status using a CRL
 The checking workload is significant
 A CRL is large
 The revocation status may lag
 CRL’s publication interval
 Can check offline
COMP3355 Cyber Security (2023 Fall) PKI

Certificate Revocation Check


 Check a certificate’s revocation status using OCSP (online certificate
status protocol)
COMP3355 Cyber Security (2023 Fall) PKI

Certificate Revocation Check


 Check a certificate’s revocation status using OCSP (online certificate
status protocol)
 Response
 Good
 The certificate is not revoked
 Revoked
 The certificate is revoked
 Unknown
 Does not recognize the serial number
COMP3355 Cyber Security (2023 Fall) PKI

Certificate Revocation Check


 Check a certificate’s revocation status using OCSP (online certificate
status protocol)
 Response
 Good
 The certificate is not revoked
 Revoked
 The certificate is revoked
 Unknown
 Does not recognize the serial number
 Faster, more up-to-date information
 The OCSP server may go down
 Privacy
 The CA/OCSP server will know the websites being visited
COMP3355 Cyber Security (2023 Fall) PKI

Demo
 www.hku.hk
 Get the certificate
 openssl s_client -connect www.hku.hk:443 2>&1 < /dev/null | sed -n '/-----
BEGIN/,/-----END/p' > hku.pem
 Get the intermediate certificates
 openssl s_client -connect www.hku.hk:443 -showcerts 2>&1 < /dev/null
 Copy and paste the intermediate certificates in “chain.pem”
 Get the OCSP URI
 openssl x509 -text -noout -in hku.pem
 Or openssl x509 -noout -ocsp_uri -in hku.pem
 Send the OCSP request
 openssl ocsp -issuer chain.pem -cert hku.pem -text -url
http://status.geotrust.com
COMP3355 Cyber Security (2023 Fall) PKI

Crypto Review
 Symmetric Key
 Alice and Bob share a secret key
 They encrypt and decrypt messages using the same secret key
COMP3355 Cyber Security (2023 Fall) PKI

Crypto Review
 Asymmetric Key
 Bob generates a key pair: a public key and a private key
 Alice gets Bob’s public key
 Alice encrypts the message with the public key
 Alice sends the encrypted message to Bob
 Bob uses his private key to decrypt the message
COMP3355 Cyber Security (2023 Fall) PKI

Crypto Review
 Digital Certificate
 Bob generates a key pair: a public key and a private key
 CA issues a certificate for Bob’s public key
 Alice gets Bob’s certificate
 Alice walks through the certificate path to verify Bob’s certificate
 Alice gets Bob’s public key from the certificate
 Alice encrypts the message with the public key
 Alice sends the encrypted message to Bob
 Bob uses his private key to decrypt the message
COMP3355 Cyber Security (2023 Fall) PKI

Crypto Review
 Digital Certificate with CRL Check
 Bob generates a key pair: a public key and a private key
 CA issues a certificate for Bob’s public key
 Alice gets Bob’s certificate
 Alice checks the CRL to make sure Bob’s certificate is not revoked
 Alice walks through the certificate path to verify Bob’s certificate
 Alice gets Bob’s public key from the certificate
 Alice encrypts the message with the public key
 Alice sends the encrypted message to Bob
 Bob uses his private key to decrypt the message
COMP3355 Cyber Security (2023 Fall) PKI

Q&A about Crypto?

You might also like