The Belgian e-id: hacker vs developer



Similar documents
Web Application Entity Session Management using the eid Card Frank Cornelis 03/03/2010. Fedict All rights reserved

eid Security Frank Cornelis Architect eid fedict All rights reserved

Open Source eid Projects

Digital Signature Service. e-contract.be BVBA 2 september 2015

Enhancing Web Application Security

Computer Systems Security 2013/2014. Single Sign-On. Bruno Maia Pedro Borges

Security Engineering Part III Network Security. Security Protocols (I): SSL/TLS

Transport Level Security

Secure web transactions system

Security Protocols/Standards

Public Key Infrastructure (PKI)

Server based signature service. Overview

Chapter 17. Transport-Level Security

Overview of CSS SSL. SSL Cryptography Overview CHAPTER

Web Security. Mahalingam Ramkumar

Embedded SSL. Christophe Kiennert, Pascal Urien. Embedded SSL - Christophe Kiennert, Pascal Urien 1

Communication Security for Applications

Criteria for web application security check. Version

CS 356 Lecture 27 Internet Security Protocols. Spring 2013

EXPLORING SMARTCARDS: AN INDEPENDENT LOOK TO TECHNOLOGIES AND MARKET

SSL Protect your users, start with yourself

Is Your SSL Website and Mobile App Really Secure?

Introducing etoken. What is etoken?

Outline. Transport Layer Security (TLS) Security Protocols (bmevihim132)

Thick Client Application Security

Standardizing PKI in Higher Education Apple PKI and Universal Hi-Ed Spec proposal

Authenticity of Public Keys

What is Web Security? Motivation

SSL: Secure Socket Layer

Core Feature Comparison between. XML / SOA Gateways. and. Web Application Firewalls. Jason Macy jmacy@forumsys.com CTO, Forum Systems

Moving to Multi-factor Authentication. Kevin Unthank

Web Security (SSL) Tecniche di Sicurezza dei Sistemi 1

Exploring ADSS Server Signing Services

Chapter 7 Transport-Level Security

Enterprise Application Security Workshop Series

LBSEC.

SSL/TLS: The Ugly Truth

Certificates and network security

Contents. Identity Assurance (Scott Rea Dartmouth College) IdM Workshop, Brisbane Australia, August 19, 2008

ISM/ISC Middleware Module

Cisco AnyConnect Secure Mobility Client VPN User Messages, Release 3.1

Network Security Essentials Chapter 5

Web Application Security Assessment and Vulnerability Mitigation Tests

Securing Card-Not-Present Transactions through EMV Authentication. Matthew Carter and Brienne Douglas December 18, 2015

Communication Systems 16 th lecture. Chair of Communication Systems Department of Applied Sciences University of Freiburg 2009

JVA-122. Secure Java Web Development

Ethical Hacking as a Professional Penetration Testing Technique

Security Evaluation CLX.Sentinel

Binding Security Tokens to TLS Channels. A. Langley, Google Inc. D. Balfanz, Google Inc. A. Popov, Microsoft Corp.

CS 665: Computer System Security. Network Security. Usage environment. Sources of vulnerabilities. Information Assurance Module

Apache Server Implementation Guide

Last update: February 23, 2004

Overview. SSL Cryptography Overview CHAPTER 1

How To Understand And Understand The Security Of A Key Infrastructure

A Study of What Really Breaks SSL HITB Amsterdam 2011

SSL Secure Socket Layer

TLS/SSL in distributed systems. Eugen Babinciuc

Web Tracking for You. Gregory Fleischer

ERserver. iseries. Secure Sockets Layer (SSL)

SSL Interception Proxies. Jeff Jarmoc Sr. Security Researcher Dell SecureWorks. and Transitive Trust

Introduction to Cryptography

Real-Time Communication Security: SSL/TLS. Guevara Noubir CSU610

Breaking the Myths of Extended Validation SSL Certificates

Q: Why security protocols?

Implementing Identity Provider on Mobile Phone

EUCIP - IT Administrator. Module 5 IT Security. Version 2.0

SSL implementieren aber sicher!

Secure Socket Layer (SSL) and Transport Layer Security (TLS)

Web application security

Certification Authority. The X.509 standard, PKI and electronic documents. X.509 certificates. X.509 version 3. Critical extensions.

CYBER ATTACKS EXPLAINED: THE MAN IN THE MIDDLE

History of the TLS Authentication Gap Bug. Marsh Ray Steve Dispensa PhoneFactor

INUVIKA OPEN VIRTUAL DESKTOP FOUNDATION SERVER

Authentication. Computer Security. Authentication of People. High Quality Key. process of reliably verifying identity verification techniques

Where every interaction matters.

Network Security Fundamentals

INTEGRATE SALESFORCE.COM SINGLE SIGN-ON WITH THIRD-PARTY SINGLE SIGN-ON USING SENTRY A GUIDE TO SUCCESSFUL USE CASE

Network Security Standards. Key distribution Kerberos SSL/TLS

APNIC elearning: Network Security Fundamentals. 20 March :30 pm Brisbane Time (GMT+10)

Secure Socket Layer (SSL) and Trnasport Layer Security (TLS)

IONA Security Platform

Announcement. Final exam: Wed, June 9, 9:30-11:18 Scope: materials after RSA (but you need to know RSA) Open books, open notes. Calculators allowed.

SSL Secure Socket Layer

Breaking the Security Myths of Extended Validation SSL Certificates

TLS-RSA-PSK. Channel Binding using Transport Layer Security with Pre Shared Keys

Configuring Digital Certificates

CRYPTOGRAPHY AS A SERVICE

Smart Card APDU Analysis

Secure Socket Layer. Security Threat Classifications

WEB Security & SET. Outline. Web Security Considerations. Web Security Considerations. Secure Socket Layer (SSL) and Transport Layer Security (TLS)

Network Security Web Security and SSL/TLS. Angelos Keromytis Columbia University

Using Entrust certificates with VPN

SBClient SSL. Ehab AbuShmais

Overview SSL/TLS HTTPS SSH. TLS Protocol Architecture TLS Handshake Protocol TLS Record Protocol. SSH Protocol Architecture SSH Transport Protocol

Digital Certificates (Public Key Infrastructure) Reshma Afshar Indiana State University

Communication Systems SSL

The Top Web Application Attacks: Are you vulnerable?

CSA SDP Working Group

ARCHIVED PUBLICATION

Enabling SSL and Client Certificates on the SAP J2EE Engine

Transcription:

OWASP Belgium Chapter The OWASP Foundation http://www.owasp.org The Belgian e-id: hacker vs developer Erwin Geirnaert ZION SECURITY Frank Cornelis Fedict

Agenda The OWASP Foundation http://www.owasp.org eid Card Introduction eid Card Integration Examples of bad implementations 2

Who are we? Frank: eid Architect at Fedict eid Middleware eid Applet eid Trust Service, jtrust, eid IdP, eid DSS Erwin: whitehat hacker at ZION SECURITY

eid Card Introduction

eid in Belgium eid cards issued (16/01/2010) 8.220.456 citizen eid cards (full deployment) 511.774 foreigner eid cards 186.011 kids eid cards Technology RSA 1024 smart card QC with 5 year validity Involved major organizations: FedICT: Federal ICT PKI, client software, SOA solutions National Registry user database, card issuing 5

eid Card Physical Structure Logical Structure eid Card Crypto (RSA) CPU ROM (operating system) EEPROM (file system) RAM (memory) APDU Belgian eid Card JavaCard Applet JavaCard Virtual Machine Basic Operating System Infineon Chip (SLE66CX322P) 6

eid Card Content PKI Authentication RSA key + Cert Non-repudiation RSA key + Cert Root CA Certificate Citizen CA Certificate Citizen Identity Data Photo Identity File Address File PKCS1 RSA-SHA1 NRN Signatures Identity File NRN Signature Address File NRN Signature NRN Certificate PKCS#15 file structure 7

eid Card Functionality Non-electronic functionality Visible Identification Visible Authentication via facial recognition and/or hand-written signature (a kind of challenge) Electronic functionality Identification: who are you? Passive eid usage Privacy sensitive Authentication: can you prove who you are? Active challenging the eid card + eid user (2 factor) Digital Signing: non-repudiation signature Prove of acknowledgment at a point in time 8

eid PKI Topology Certificate Signatures according to PKCS1-RSA- SHA1 Root CA Certificate RSA2048 RSA2048 Citizen CA Certificate OCSP Responder Authn/non-repud Certificate RSA1024 same key CRL CRL GlobalSign CA Certificate Root CA Certificate RSA2048 RSA2048 Gov CA Certificate RSA2048 NRN Certificate CRL SSL Certificate RSA1024 9

eid Card Integration

eid Card Interfacing Via APDU messages Application Protocol Data Unit Command: from the reader to the card Response: from the card to the reader Example: Creation of a signature Set APDU: select the key. 0x82 = authn key Prepare DigestInfo PKCS1 DER sequence Verify PIN APDU: (PIN BCD encoded) Compute Digital Signature APDU Retrieve signature data Doing the APDU interface is crazy 11

eid Card APDU Demo

eid Card Integration Web Application?????????????? eid Card Important aspects when integrating: Ease of integration Secure usage of eid Platform independent solution: Windows Linux Mac OS X Multiple browser support: Firefox MS IE Safari Chrome Integration point abstraction level Idiot proof eid components 13

14 eid Architecture eid reader CCID PC/SC PKCS#15 PKCS#1 authentication signatures eid IdP PKCS#11 CSP tokend minidriver SSL eid Applet PKI CRL OCSP DSS TSA TSP CA NTP ID SAML XAdES NR OpenID IdP IAM identification TSL WS-Federation pinpad XKMS SAMLp PKCS#7 trust XMLDSig ODF OOXML PDF eid Integration Points display

eid Identification identification Identification: who are you? Readout of the eid Identity, eid Applet Address and Photo files. Server-side identity file PC/SC parsing Server-side integrity reader eid ID validation of all identity files is possible via NRN signature NR 15

eid Applet Java 6 Web Browser eid Component Supports multiple web browsers: Firefox, Chrome, Internet Explorer, Safari Platform-independent: Windows, Linux, Mac OS X Interactive eid card handling Support for secure CCID pinpad readers Web developer friendly Open Source Software: GNU LGPL 3 http://code.google.com/p/eid-applet/ 16

eid Applet Architecture Web Browser Servlet Web Container Web Page 1 eid Applet 2 eid Applet Service 3 SPI 5 4 3 Target Page HTTP Session Service Implementation 6 jtrust SPI design pattern is key to enabling eid Applet features 17

eid Applet Identification identify-the-user.html <script src="https://www.java.com/js/deployjava.js"></script> <script> var attributes = { code :'be.fedict.eid.applet.applet.class', archive :'eid-applet.jar', width :600, height :300 }; var parameters = { TargetPage :'identification-result-page.jsp', AppletService :'applet-service', }; var version = '1.6'; deployjava.runapplet(attributes, parameters, version); </script> web.xml identification-result-page.jsp <%@page import="be.fedict.eid.applet.service.identity"%> <html> <body> <%=((Identity) session.getattribute("eid.identity")).name%> </body> </html> <servlet> <servlet-name>appletserviceservlet</servlet-name> <servlet-class>be.fedict.eid.applet.service.appletserviceservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>appletserviceservlet</servlet-name> <url-pattern>/applet-service</url-pattern> </servlet-mapping> 18

eid Identification Demo

eid Identity Integrity eid Applet reads the identity files and NRN signatures, posts to eid Applet Service Server-side verification of the NRN signatures over the identity, photo and address files by the eid Applet Service Verification of the NRN certificate chain via the IdentityIntegrityService SPI <servlet> <servlet-name>appletintegrityserviceservlet</servlet-name> <servlet-class>be.fedict.eid.applet.service.appletserviceservlet</servlet-class> <init-param> <param-name>identityintegrityservice</param-name> <param-value>/location/in/jndi/of/the/identityintegrityservicebean</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>appletintegrityserviceservlet</servlet-name> <url-pattern>/applet-service-integrity</url-pattern> </servlet-mapping> 20

eid Identification Demo Integrity Validation

eid Card Cloning eid has a 3th key pair: card authn key eid Card Authentication signature can be created without PIN verification eid Card Authentication allows for detection of a cloned eid card eid Card Authentication signature cannot be verified due to missing corresponding public key. National Registry needs to make the public key available as an eid file Would prevent identity fraude 22

eid Authentication authentication IdP Authentication: can you prove who you IAM eid IdP are? Using the eid SSL eid Applet authentication key tokend CSP PKCS#11 pinpad PC/SC minidriver CCID reader eid PKCS#1 23

Entity Authentication Entity authentication is the process whereby one party is assured of the identity of a second party involved in a protocol, and that the second has actually participated (i.e., is active at, or immediately prior to, the time the evidence is acquired) Formal definition (A authenticated B if): Alice A, Bob B A believes freshness challenge_a A believes (B recently said challenge_a) Authentication vs. Session Key Establishment How to achieve this using an eid card? 24

eid Authentication Authentication Private Key (1024 bit RSA) PKCS1-RSA PIN authorization for Authn Key usage Card caches the authn PIN authorizations Log-off instruction to reset PIN authorization Creation of a signature: Set APDU: select the key. 0x82 = authn key Prepare DigestInfo PKCS1 DER sequence Verify PIN APDU: (PIN BCD encoded) Compute Digital Signature APDU Retrieve signature data eid can only sign (RSA decryption of DigestInfo) 25

Authentication Protocol eid authentication by itself is useless Remote Entities, e.g. web application context. We need an Authentication Protocol Different Authentication Protocols are possible Each Entity Authentication Protocol yields its own cryptographic goals. Of course Entity Authentication Session key via combined Key Agreement (SSL) DO NOT TRY TO INVENT YOUR OWN PROTOCOL! Needham-Schroeder protocol: replay attack Creativity is great for non-critical applications, like music. 26

Candidate Protocols Mutual SSL Browser initiated SSL handshake Relies on eid PIN authorization caching feature Tunneled Entity Authentication Uses unilateral SSL to authenticate the server Based on ISO/IEC 9798-3 Authentication SASL Mechanism (RFC 3163) Cryptographic channel binding to secure the channel (RFC 5056) Requires an eid Applet (or browser extension) Explicit eid card management possible Sequential eid card access possible 27

Unilateral SSL Validate cert chain Alice HelloClient(ciphers,Ra) HelloServer(cipher,Rb) Certificate(cert chain) ServerHelloDone ClientKeyExchange {pre_master_secret}kb+ ChangeCipherSpec ClientFinish (encrypted) PRF(master_secret,handshake_msgs) ChangeCipherSpec ServerFinish (encrypted) PRF(master_secret,handshake_msgs) Bob Ra: random by A Rb: random by B Kb+: public key of B pre_master_secret: random by A PRF: pseudo-random function Entity Authentication A believes freshness Ra A believes B recently said Ra master_secret=prf(pre_master_secret, Ra, Rb) session_key=f(master_secret) 28

SSL Features Resuming a TLS connection HelloClient(session_id) Reusing the same master_secret Reduces load due to a full TLS handshake Renegotiating the SSL handshake Over an already established SSL connection Useful when client authentication is required Both client and server can initiate a renegotiation Not all SSL stacks support this (Java does not) Security flaws in implementations 29

Mutual SSL via eid Alice HelloClient(ciphers,Ra) HelloServer(cipher,Rb) Certificate(cert chain) CertificateRequest,ServerHelloDone Certificate(cert chain) ClientKeyExchange {pre_master_secret}kb+ CertificateVerify sign_ka-(handshake_msgs) ChangeCipherSpec ClientFinish (encrypted) PRF(master_secret,handshake_msgs) ChangeCipherSpec ServerFinish (encrypted) PRF(master_secret,handshake_msgs) Bob Ra: random by A Rb: random by B Kb+: public key of B pre_master_secret: random by A Ka-: private key of A PRF: pseudo-random function Entity Authentication A believes freshness Ra A believes (B recently said Ra) B believes freshness Rb B believes (A recently said Rb) 30

eid SSL Authentication So we need two SSL terminations: One for unilateral SSL One for the mutual SSL using eid Requires 2 IP addresses (+ DNS names), or at least 2 different ports. Internet firewall SSL Terminator eid SSL Terminator Application Server Problem: how to properly link the SSL sessions? If same IP address, via session cookies If different IP address, via signed SAML tickets 31

eid SSL Authentication How about session life cycles? The Application Server cannot inform SSL to terminate that easily... A B Unilaternal SSL eid Login Magical SSL Session Linking Mutual SSL Handshake Server SSL eid SSL eid PIN authz caching Show profile, payments Logout index.html eid Login Show profile What if the web application wants to sign a contract with eid of citizen C??? eid SSL session still alive!!! Short SSL sessions? :) 32

eid SSL Authentication Demo

Tunneled Entity Authn Alice Bob A trusts B Unilateral SSL Challenge sign_ka-(ra,challenge), Ra, cert A At this point B still doubts A What can B believe at this point? ISO/IEC 9798-3 Authentication SASL Mechanism RFC 3163 Unilateral client authentication: server already authenticated via unilateral SSL connection Did we achieve the same effect as mutual SSL? What if challenge actually is SHA1(contract)? B can abuse A's challenge signature. 34

eid Tunneled Entity Authentication Demo

Alice MITM attack on SASL Mallory Bob Unilateral SSL Unilateral SSL Challenge sign_ka-(ra,challenge), Ra, cert A Mallory can abuse the authentication token of Alice Why is this going wrong? Challenge sign_ka-(ra,challenge),ra,cert A SSL: sign_ka-(handshake_msgs) so the signature digests parts of the secure channel's identity SASL: sign_ka-(ra,challenge) does not digest any part of the secure channel's identity. 36

Secure Channel Binding Alice Bob SSL context Unilateral SSL Challenge Sign_Ka-(Ra,challenge,channel_binding), Ra, cert A RFC 5056: cryptographic binding channel_binding = Hostname B (nice try) Inet address B (nice try) SSL certificate B (OK) SHA1(master_key) (even better) A channel binding should really digest part of the channel's identity. Alice's SSL stack must support this. 37

Secure Channel Binding Demo

eid Applet Signatures client server Browser PKCS1-RSA eid Applet eid Applet Service Signature SPI eid XML Signature Service ODF Signature Service OOXML Signature Service OpenOffice XAdES Office 2007 39

eid Applet Signature Demo

Examples of Bad Implementations

Examples of bad implementations Identification is not authentication Unsecure trust in a third party After successful authentication abuse HTTP Web vulnerabilities in an eid site 42

Identification is not authentication Using a Java applet to retrieve first name and last name and use this for authentication => bad Without using HTTPS Sniffing MITM XSRF 43

Unsecure trust in a third party Authentication occurs using a redirect or intercept by reverse proxy To forward credentials to web application, an insecure mechanism is used HTTP Header contains NRN: can be spoofed, hijacked 44

After successful authentication abuse HTTP Session cookie is used to maintain state Redirect to HTTP Sniff cookie and spoof authentication 45

Web vulnerabilities in an eid site Cross-site-scripting to steal session cookie SQL Injection XSRF Broken authorization 46

Questions?