SlideShare uma empresa Scribd logo
1 de 46
Baixar para ler offline
1
New Security Issues related to
Embedded Web Servers
Eric Vétillard, Trusted Labs
© 2009 Trusted Logic S.A.
All Cards are Servers
3
Card characteristics
 Reacts to external requests
▪ a.k.a. APDU command
 Is accessible to the attacker
▪ Provided that the attacker has the card handy
▪ A bit more remotely with contactless cards
 Of course, most cards use specific protocols
© 2009 Trusted Logic S.A.
4
Card functions
 Store, use, and protect secrets
 Store private user data
 Authenticate users
 Establish secure communication links
© 2009 Trusted Logic S.A.
How is a Web Server Different ?
6
A Web server is standard
 There are many standards to be followed
▪ Protocols: HTTP, HTTPS, SSL, …
▪ Data formats: HTML, XML, CSS, …
▪ Languages: JavaScript, …
 Web clients are standardized
▪ Browsers
▪ JavaScript-based AJAX clients
© 2009 Trusted Logic S.A.
7
A Web server is complex
 At least, more complex than a typical card
 Several layers of complexity
▪ TCP/IP is more complex than ISO7816-3
▪ Data exchange formats more complex
▪ XML more complex than TLV
▪ Processes often more complex
▪ In particular, GUI provided by the server
 But, complexity mostly handled by browser
▪ The server provides a description but no rendering
© 2009 Trusted Logic S.A
8
A Web server is accessible
 Most Web servers are on Internet
▪ They are widely accessible by everybody
 The most sensitive servers are not
▪ They are on various kinds of Intranets
▪ Think of your SVN servers
▪ Think of your router’s/printer’s internal server
 Some servers are local to a device
▪ Only accessible from the device that hosts them
© 2009 Trusted Logic S.A.
9
An attacker’s point of view
 Standard
▪ Good reusability of attack efforts
▪ Widely deployed standard clients are vulnerable
 Complex
▪ More complex, more buggy, more vulnerable
 Accessibility
▪ Easy to reach and reproduce
▪ Possibility to evade law enforcement
© 2009 Trusted Logic S.A.
Web attacks
11
What makes a good attack?
 A vulnerability
▪ Widely deployed is better
▪ Hard to fix is very good
▪ design flaw vs. implementation flaw
▪ Requiring significant work from developer
 Opportunities for exploitation
▪ Stealing/abusing authentication credentials
▪ Compromising users’ machine
© 2009 Trusted Logic S.A.
12
State-of-the-art
 Web attacks are not static
 OWASP regularly updates its “Top 10”
▪ Old (under control) attacks are downgraded
▪ New (uncontrolled) attacks are added/upgraded
 Let’s look at their latest release
▪ Can they be applied to smart cards?
© 2009 Trusted Logic S.A.
13
OWASP’s Top 10 Vulnerabilities
 Cross-site scripting (XSS)
 Injection flaws
 Malicious file execution
 Insecure direct object reference
 Cross site request forgery
 Information leakage and improper error handling
 Broken authentication and session management
 Insecure cryptographic storage
 Insecure communications
 Failure to restrict URL access
© 2009 Trusted Logic S.A.
14
A1 – Cross-Site Scripting (XSS)
 Cross-site scripting is a subset of HTML
injection
▪ XSS allows attackers to execute a script in a
browser
 Reflected XSS
▪ Returns user-provided data to the same user
▪ Without checking it
out.println(" Successfully added " +
request.getParameter("id") ;
© 2009 Trusted Logic S.A.
15
A1 – Cross-Site Scripting (XSS)
 Why is this vulnerable?
▪ Because of possible user entries
out.println(" Successfully added " +
request.getParameter("id") ;
<IMG SRC="javascript:alert('XSS');"> ;
<SCRIPT SRC=http://ha.ckers.org/xss.js></SCRIPT>
© 2009 Trusted Logic S.A.
16
A1 – Cross-Site Scripting (XSS)
 Stored XSS stores data before to display
it back
▪ Potentially to another user (a.k.a. the victim)
▪ Very useful in “social” sites
 DOM-based XSS modifies the DOM tree
▪ Usually in combination of Ajax
out.println("New friend added: " +
friend.getParameter("id") ;
© 2009 Trusted Logic S.A.
17
A1 – Cross-Site Scripting (XSS)
 Recommended countermeasures include
▪ Input validation
▪ Use white-list validation (accept only limited input)
Validate length, type, syntax, business rules, …
▪ Avoid black-list validation, which can be bypassed
▪ Strong output encoding
▪ Encode all user-input directly
▪ Specify the output encoding explicitly
ISO8859-1 or UTF-8
▪ Watch out for canonicalization errors
▪ If possible, use standard library
© 2009 Trusted Logic S.A.
18
A1 – Cross-Site Scripting (XSS)
 Does it apply to Smart Card Web Servers ?
 Yes, it definitely does
▪ Query data will be used by the server
▪ Resources are scarce
 Strong requirement for
▪ Input validation
▪ Output canonicalization
© 2009 Trusted Logic S.A.
19
A2 – Injection flaws
 Every interpreter can fall victim of injection
flaws
▪ SQL is the most well-known victim
▪ HTML is also very common (see XSS)
▪ Any other interpreter can be attacked
▪ LDAP, XPath, XSLT, OS Command, …
▪ Your own proprietary language
 The danger comes from the interpreter itself
▪ Security is orthogonal to Java’s security
© 2009 Trusted Logic S.A.
21
A2 – Injection flaws
 Recommended countermeasures include
▪ Input validation
▪ White lists, no black lists
▪ Use standard libraries if available
▪ Design validation carefully for proprietary
frameworks
▪ Make exploits as difficult as possible
▪ Enforce least privilege principles
▪ Avoid detailed error messages
 Many countermeasures for specific
interpreters
▪ SQL is the most common
© 2009 Trusted Logic S.A.
22
A2 – Injection flaws
 Does it apply to Smart Card Web Servers?
 Not really, or not directly
▪ No interpreter, no problem
 But … a TLV format is a kind of interpreter
▪ Be careful as soon as data becomes structured
▪ Apply standard countermeasures
© 2009 Trusted Logic S.A.
23
A3 – Malicious File Execution
 The attacker executes a malicious OS
command
▪ When runtime.exec() is used
▪ When files are created and/or updated
 Small example exploitable on a weak platform
String file = request.getParameter("file") ;
File f = new File(dir + "/"+ file) ;
http://www.example.com/banking?file=../../web.xml
© 2009 Trusted Logic S.A.
24
A3 – Malicious File Execution
 Does it apply to Smart Card Web Servers?
 No it doesn’t
▪ Advantage of a “bare metal” implementation
▪ No operating system to be abused
 But … there may still be an operating system
▪ Control all interfaces with Web server
© 2009 Trusted Logic S.A.
25
A4 – Insecure Direct Object Ref
 Never expose reference to implementation objects
▪ Files, directories, records, keys, etc.
 An attacker may modify or abuse such references
String language = request.getParameter("language") ;
ResourceBundle rb = context.getResources("rsrc-"+language);
<select name=“language”>
<option value=“fr”>Français</option>
</select>
int cartId = Integer.parseInt(request.getParameter("cartID");
String query = "SELECT * FROM table WHERE cartID=" + cartId);
© 2009 Trusted Logic S.A.
26
A4 – Insecure Direct Object Ref
 Recommended countermeasures include
▪ Establish a standard way to refer to app objects
▪ Avoid exposing private object references to users
No primary keys, no filenames
▪ Validate any private object references extensively
An “accept know good” approach is here easy
▪ Verify authorization to all referenced objects
▪ Make sure that input does not contain attack
patterns
For instance, “../” and “%00”
© 2009 Trusted Logic S.A.
27
A4 – Insecure Direct Object Ref
 Does it apply to Smart Card Web Servers?
 Yes, it definitely does
▪ Think about the “cart Id” example
▪ Short identifiers are likely on smart cards
▪ These identifiers may be easy to guess
 Countermeasures are seen as expensive
▪ Map external references to internal ones
© 2009 Trusted Logic S.A.
28
A5 – Cross Site Request Forgery
 Cross-site request forgery steals user
privileges
▪ The attacker sends a request from the victim’s
browser
▪ The browser will use the victim’s privileges
▪ For instance, if the victim is logged in to a bank
 The browser provides some protection
▪ There is a “same origin” policy
▪ It is not possible (easy) to directly steal content
▪ But, requests can be sent and interpreted on
server
© 2009 Trusted Logic S.A.
31
A5 – Cross Site Request Forgery
 Does it apply to Smart Card Web Servers?
 Yes, it definitely does
 A few countermeasures are simple enough
▪ Insert random token in URL’s
▪ Re-authenticate for sensitive transactions
▪ More generally, limit the validity of authentication
© 2009 Trusted Logic S.A.
32
A6 – Information Leakage and Improper
Error Handling
 Applications frequently use error messages
▪ They often try to be “helpful” for the user
 As a result, some information is leaked
▪ Results are often too differentiated
▪ “Wrong username” vs. “Wrong password”
▪ Debugging information is often included
▪ Stack traces
▪ Failed SQL statements
© 2009 Trusted Logic S.A.
34
A6 – Information Leakage and Improper
Error Handling
 Does it apply to Smart Card Web Servers?
 Yes, but not really
 Default output is likely to be scarce
▪ Tools are unlikely to include detailed information
▪ Applications are likely to have simple error mgmt
▪ Debugging code is the most likely culprit
▪ Override errors with standard response
© 2009 Trusted Logic S.A.
35
A7 – Broken Authentication and Session
Management
 Many flaws are possible in authentication
▪ We know them quite well
 Flaws are often found in ancillary functions
▪ Logout that doesn’t work, password management,
no timeout, etc.
 Session management is provided by the
platform
▪ Don’t try to design one yourself
© 2009 Trusted Logic S.A.
38
A7 – Broken Authentication and Session
Management
 Does it apply to Smart Card Web Servers?
 Yes, it does
▪ All errors can be done on a card application
 Java Card 3.0 provides some tools
▪ They are not sufficient on their own
▪ Be careful if you write authenticators
© 2009 Trusted Logic S.A.
39
A8 – Insecure Cryptographic Storage
 Sensitive data should be stored encrypted
▪ First, the data should actually be encrypted
▪ Then, the cryptography should be efficient
▪ Using well-known, accepted algorithms
▪ Protecting the keys adequately
 Sensitive data should be well qualified
▪ Don’t forget some sensitive data
▪ Don’t store data that you don’t need
▪ If you don’t have it, attackers can’t get it
© 2009 Trusted Logic S.A.
40
A8 – Insecure Cryptographic Storage
 Does it apply to Smart Card Web Servers?
 Not really, at least for card developers
▪ Java Card 3.0 is not as exposed as other
platforms
▪ Many mechanisms are readily accessible
▪ The storage is tamper-proof to some level
 Still, some recommendations apply
▪ Use the platform’s algorithms and key storage
▪ Ensure that your encryption cannot be bypassed
▪ Don’t store data unnecessarily
© 2009 Trusted Logic S.A.
41
A9 – Insecure Communications
 Sensitive data should be encrypted
▪ Secure channels need to be used
▪ HTTPS, SSL, TLS, …
 Encryption is not sufficient
▪ Session establishment is crucial
▪ Authentication of other party is mandatory
© 2009 Trusted Logic S.A.
42
A9 – Insecure Communications
 Does it apply to Smart Card Web Servers?
 Yes it does
▪ SSL may be unusual and hard for smart card guys
▪ Mutual authentication may be hard to get
▪ How can you be sure that your user has actually
authenticated you (i.e., that phishing won’t work) ?
▪ All Web designers face the same issues
© 2009 Trusted Logic S.A.
43
A10 – Failure to Restrict URL Access
 Flaws are linked to accessible URLs
▪ Hidden or specials URLs, proposed only to
privileged users, but in fact accessible to all users
▪ Pages used during development that perform
administrative functions (without authentication)
▪ Sensitive data hidden by “Security through
Obscurity”
▪ Out-of-date access control policies
▪ Some pages remain accessible to too many users
▪ Code that evaluates privileges on the client
© 2009 Trusted Logic S.A.
45
A10 – Failure to Restrict URL Access
 Does it apply to Smart Card Web Servers?
 Yes, to a certain degree
▪ Smart Card Web Servers are likely to be simple
▪ Less temptation to have “hidden URLs”
▪ But … Smart Card Web Servers may be
administered through the Web interface
▪ We can see a chicken and egg problem
▪ There is no “console” on a smart card
© 2009 Trusted Logic S.A.
Defending Ourselves
47
A Local Server?
 A Smart Card Web Server may be local
▪ Basic assumption in SCWS
▪ Not an assumption in Java Card 3.0
 Some applications don’t need Web access
▪ Being local greatly reduced the risk of attacks
▪ Physical access becomes a prerequisite
 Smart cards may very often be local
© 2009 Trusted Logic S.A.
48
Basic defenses
 Validate input, encode outputs
▪ Standard libraries can’t be directly used
▪ Be ready to sacrifice flexibility for security
 Follow recommendations for encoding
▪ Don’t use internal identifiers in the interface
▪ Include random data in URL’s
 Follow recommendations for access control
▪ No hidden URL’s
▪ Authenticate user after opening secure channel
▪ …
© 2009 Trusted Logic S.A.
49
Reproduce Web server architecture
 Web servers are not monolithic
▪ They usually are “n-tier” systems
▪ The Web server is the presentation tier
▪ The actual data is on another (Intranet) server
 Smart card servlets can be structured
▪ The Java Card firewall guarantees some isolation
▪ Data is best kept outside of the servlet
▪ Attacks then need to be performed through servlet
▪ Management uses a different security policy
© 2009 Trusted Logic S.A.
Where do we go from here ?
51
Try it out !
 When trying SCWS/Java Card 3.0
▪ Think about Web security
▪ Develop appropriate countermeasures
▪ At least, list what you should do
▪ Assess the performance impact
 Now, you should realize the problem
▪ Web security is not easy
© 2009 Trusted Logic S.A.
52
Build reference code ?
 The specification is not the right place
▪ Security code is by essence variable
▪ Security code usually is the result of a trade-off
▪ Input validation is much easier if you only accept
alphanumerical characters and spaces
 Yet, this is not really a competitive area
▪ A broken Web server is bad news for all
 Would there be a use for a reference code?
▪ Bring the Web spirit to smart cards
© 2009 Trusted Logic S.A.
53
Thank you !
Eric Vétillard
eric.vetillard@trusted-labs.com
© 2009 Trusted Logic S.A.

Mais conteúdo relacionado

Mais procurados

Security Code Review 101
Security Code Review 101Security Code Review 101
Security Code Review 101Paul Ionescu
 
The cyber house of horrors - securing the expanding attack surface
The cyber house of horrors -  securing the expanding attack surfaceThe cyber house of horrors -  securing the expanding attack surface
The cyber house of horrors - securing the expanding attack surfaceJason Bloomberg
 
Controlling Access to IBM i Systems and Data
Controlling Access to IBM i Systems and DataControlling Access to IBM i Systems and Data
Controlling Access to IBM i Systems and DataPrecisely
 
Expand Your Control of Access to IBM i Systems and Data
Expand Your Control of Access to IBM i Systems and DataExpand Your Control of Access to IBM i Systems and Data
Expand Your Control of Access to IBM i Systems and DataPrecisely
 
Andrew Useckas Csa presentation hacking custom webapps 4 3
Andrew Useckas Csa presentation   hacking custom webapps 4 3Andrew Useckas Csa presentation   hacking custom webapps 4 3
Andrew Useckas Csa presentation hacking custom webapps 4 3Trish McGinity, CCSK
 
Secure by Design - Security Design Principles for the Rest of Us
Secure by Design - Security Design Principles for the Rest of UsSecure by Design - Security Design Principles for the Rest of Us
Secure by Design - Security Design Principles for the Rest of UsEoin Woods
 
Defcon 22-alex zacharis-nikolaos-tsagkarakis-po s-attacking-t
Defcon 22-alex zacharis-nikolaos-tsagkarakis-po s-attacking-tDefcon 22-alex zacharis-nikolaos-tsagkarakis-po s-attacking-t
Defcon 22-alex zacharis-nikolaos-tsagkarakis-po s-attacking-tPriyanka Aash
 
Securing Web Applications
Securing Web ApplicationsSecuring Web Applications
Securing Web ApplicationsMark Garratt
 

Mais procurados (11)

Security Code Review 101
Security Code Review 101Security Code Review 101
Security Code Review 101
 
The cyber house of horrors - securing the expanding attack surface
The cyber house of horrors -  securing the expanding attack surfaceThe cyber house of horrors -  securing the expanding attack surface
The cyber house of horrors - securing the expanding attack surface
 
Controlling Access to IBM i Systems and Data
Controlling Access to IBM i Systems and DataControlling Access to IBM i Systems and Data
Controlling Access to IBM i Systems and Data
 
Luis Grangeia IBWAS
Luis Grangeia IBWASLuis Grangeia IBWAS
Luis Grangeia IBWAS
 
Expand Your Control of Access to IBM i Systems and Data
Expand Your Control of Access to IBM i Systems and DataExpand Your Control of Access to IBM i Systems and Data
Expand Your Control of Access to IBM i Systems and Data
 
Web Hacking
Web HackingWeb Hacking
Web Hacking
 
Andrew Useckas Csa presentation hacking custom webapps 4 3
Andrew Useckas Csa presentation   hacking custom webapps 4 3Andrew Useckas Csa presentation   hacking custom webapps 4 3
Andrew Useckas Csa presentation hacking custom webapps 4 3
 
Secure by Design - Security Design Principles for the Rest of Us
Secure by Design - Security Design Principles for the Rest of UsSecure by Design - Security Design Principles for the Rest of Us
Secure by Design - Security Design Principles for the Rest of Us
 
Defcon 22-alex zacharis-nikolaos-tsagkarakis-po s-attacking-t
Defcon 22-alex zacharis-nikolaos-tsagkarakis-po s-attacking-tDefcon 22-alex zacharis-nikolaos-tsagkarakis-po s-attacking-t
Defcon 22-alex zacharis-nikolaos-tsagkarakis-po s-attacking-t
 
Secure Coding in C/C++
Secure Coding in C/C++Secure Coding in C/C++
Secure Coding in C/C++
 
Securing Web Applications
Securing Web ApplicationsSecuring Web Applications
Securing Web Applications
 

Destaque (16)

Race questions
Race questionsRace questions
Race questions
 
Reproducción celular
Reproducción celularReproducción celular
Reproducción celular
 
Opcions correctes parts del cos
Opcions correctes parts del cosOpcions correctes parts del cos
Opcions correctes parts del cos
 
El Peruano 08/05
El Peruano 08/05El Peruano 08/05
El Peruano 08/05
 
Pantilla
PantillaPantilla
Pantilla
 
Satyam sai web tech
Satyam sai web techSatyam sai web tech
Satyam sai web tech
 
Stanfordinternationlfraud
StanfordinternationlfraudStanfordinternationlfraud
Stanfordinternationlfraud
 
Diyani Loadcell S type
Diyani Loadcell S typeDiyani Loadcell S type
Diyani Loadcell S type
 
From East to West
From East to WestFrom East to West
From East to West
 
Mental Health Conference Leaflet FINAL
Mental Health Conference Leaflet FINALMental Health Conference Leaflet FINAL
Mental Health Conference Leaflet FINAL
 
Hiram guia de observacion
Hiram guia de observacionHiram guia de observacion
Hiram guia de observacion
 
FROM EAST TO WEST. FINAL
FROM EAST TO WEST. FINALFROM EAST TO WEST. FINAL
FROM EAST TO WEST. FINAL
 
4 levis
4 levis4 levis
4 levis
 
4.Распределение доходов, эффективность и благосостояние
4.Распределение доходов, эффективность и благосостояние4.Распределение доходов, эффективность и благосостояние
4.Распределение доходов, эффективность и благосостояние
 
Viermii
ViermiiViermii
Viermii
 
Resume
ResumeResume
Resume
 

Semelhante a New Security Issues related to Embedded Web Servers

Secure RESTful Web Services for ASP.NET Web API
Secure RESTful Web Services for ASP.NET Web APISecure RESTful Web Services for ASP.NET Web API
Secure RESTful Web Services for ASP.NET Web APIRob Daigneau
 
Secure Web Services
Secure Web ServicesSecure Web Services
Secure Web ServicesRob Daigneau
 
How to Destroy a Database
How to Destroy a DatabaseHow to Destroy a Database
How to Destroy a DatabaseJohn Ashmead
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10bilcorry
 
Secure coding guidelines
Secure coding guidelinesSecure coding guidelines
Secure coding guidelinesZakaria SMAHI
 
The Top 10 Most Common Weaknesses in Serverless Applications 2018
The Top 10 Most Common Weaknesses in Serverless Applications 2018The Top 10 Most Common Weaknesses in Serverless Applications 2018
The Top 10 Most Common Weaknesses in Serverless Applications 2018PureSec
 
Mr. Mohammed Aldoub - A case study of django web applications that are secur...
Mr. Mohammed Aldoub  - A case study of django web applications that are secur...Mr. Mohammed Aldoub  - A case study of django web applications that are secur...
Mr. Mohammed Aldoub - A case study of django web applications that are secur...nooralmousa
 
Case Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by DefaultCase Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by DefaultMohammed ALDOUB
 
Solvay secure application layer v2015 seba
Solvay secure application layer v2015   sebaSolvay secure application layer v2015   seba
Solvay secure application layer v2015 sebaSebastien Deleersnyder
 
Defcon9 Presentation2001
Defcon9 Presentation2001Defcon9 Presentation2001
Defcon9 Presentation2001Miguel Ibarra
 
Web Application Security - "In theory and practice"
Web Application Security - "In theory and practice"Web Application Security - "In theory and practice"
Web Application Security - "In theory and practice"Jeremiah Grossman
 
Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)Abhishek Kumar
 
Django (Web Applications that are Secure by Default)
Django �(Web Applications that are Secure by Default�)Django �(Web Applications that are Secure by Default�)
Django (Web Applications that are Secure by Default)Kishor Kumar
 
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...IBM Security
 

Semelhante a New Security Issues related to Embedded Web Servers (20)

Secure RESTful Web Services for ASP.NET Web API
Secure RESTful Web Services for ASP.NET Web APISecure RESTful Web Services for ASP.NET Web API
Secure RESTful Web Services for ASP.NET Web API
 
Secure Web Services
Secure Web ServicesSecure Web Services
Secure Web Services
 
How to Destroy a Database
How to Destroy a DatabaseHow to Destroy a Database
How to Destroy a Database
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10
 
Secure coding guidelines
Secure coding guidelinesSecure coding guidelines
Secure coding guidelines
 
Owasp top 10 2013
Owasp top 10 2013Owasp top 10 2013
Owasp top 10 2013
 
Web Security 101
Web Security 101Web Security 101
Web Security 101
 
The Top 10 Most Common Weaknesses in Serverless Applications 2018
The Top 10 Most Common Weaknesses in Serverless Applications 2018The Top 10 Most Common Weaknesses in Serverless Applications 2018
The Top 10 Most Common Weaknesses in Serverless Applications 2018
 
Mr. Mohammed Aldoub - A case study of django web applications that are secur...
Mr. Mohammed Aldoub  - A case study of django web applications that are secur...Mr. Mohammed Aldoub  - A case study of django web applications that are secur...
Mr. Mohammed Aldoub - A case study of django web applications that are secur...
 
Case Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by DefaultCase Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by Default
 
Web Security
Web SecurityWeb Security
Web Security
 
Solvay secure application layer v2015 seba
Solvay secure application layer v2015   sebaSolvay secure application layer v2015   seba
Solvay secure application layer v2015 seba
 
Defcon9 Presentation2001
Defcon9 Presentation2001Defcon9 Presentation2001
Defcon9 Presentation2001
 
Web Application Security - "In theory and practice"
Web Application Security - "In theory and practice"Web Application Security - "In theory and practice"
Web Application Security - "In theory and practice"
 
Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)
 
Web Apps Security
Web Apps SecurityWeb Apps Security
Web Apps Security
 
Django (Web Applications that are Secure by Default)
Django �(Web Applications that are Secure by Default�)Django �(Web Applications that are Secure by Default�)
Django (Web Applications that are Secure by Default)
 
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
 
Secure pl-sql-coding
Secure pl-sql-codingSecure pl-sql-coding
Secure pl-sql-coding
 
Web security 101
Web security 101Web security 101
Web security 101
 

Mais de Eric Vétillard

Step-by-step Development of an Application for the Java Card Connected Platform
Step-by-step Development of an Application for the Java Card Connected PlatformStep-by-step Development of an Application for the Java Card Connected Platform
Step-by-step Development of an Application for the Java Card Connected PlatformEric Vétillard
 
Java Card Technology: The Foundations of NFC
Java Card Technology: The Foundations of NFCJava Card Technology: The Foundations of NFC
Java Card Technology: The Foundations of NFCEric Vétillard
 
Java Card Platform Security and Performance
Java Card Platform Security and PerformanceJava Card Platform Security and Performance
Java Card Platform Security and PerformanceEric Vétillard
 
Java Card in Banking and NFC
Java Card in Banking and NFCJava Card in Banking and NFC
Java Card in Banking and NFCEric Vétillard
 
First Steps with Java Card
First Steps with Java CardFirst Steps with Java Card
First Steps with Java CardEric Vétillard
 
Java Solutions for Securing Edge-to-Enterprise
Java Solutions for Securing Edge-to-EnterpriseJava Solutions for Securing Edge-to-Enterprise
Java Solutions for Securing Edge-to-EnterpriseEric Vétillard
 
Threat Modeling for the Internet of Things
Threat Modeling for the Internet of ThingsThreat Modeling for the Internet of Things
Threat Modeling for the Internet of ThingsEric Vétillard
 
Eric java card-basics-140314
Eric java card-basics-140314Eric java card-basics-140314
Eric java card-basics-140314Eric Vétillard
 
Java Card, 15 years later
Java Card, 15 years laterJava Card, 15 years later
Java Card, 15 years laterEric Vétillard
 

Mais de Eric Vétillard (9)

Step-by-step Development of an Application for the Java Card Connected Platform
Step-by-step Development of an Application for the Java Card Connected PlatformStep-by-step Development of an Application for the Java Card Connected Platform
Step-by-step Development of an Application for the Java Card Connected Platform
 
Java Card Technology: The Foundations of NFC
Java Card Technology: The Foundations of NFCJava Card Technology: The Foundations of NFC
Java Card Technology: The Foundations of NFC
 
Java Card Platform Security and Performance
Java Card Platform Security and PerformanceJava Card Platform Security and Performance
Java Card Platform Security and Performance
 
Java Card in Banking and NFC
Java Card in Banking and NFCJava Card in Banking and NFC
Java Card in Banking and NFC
 
First Steps with Java Card
First Steps with Java CardFirst Steps with Java Card
First Steps with Java Card
 
Java Solutions for Securing Edge-to-Enterprise
Java Solutions for Securing Edge-to-EnterpriseJava Solutions for Securing Edge-to-Enterprise
Java Solutions for Securing Edge-to-Enterprise
 
Threat Modeling for the Internet of Things
Threat Modeling for the Internet of ThingsThreat Modeling for the Internet of Things
Threat Modeling for the Internet of Things
 
Eric java card-basics-140314
Eric java card-basics-140314Eric java card-basics-140314
Eric java card-basics-140314
 
Java Card, 15 years later
Java Card, 15 years laterJava Card, 15 years later
Java Card, 15 years later
 

Último

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Último (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

New Security Issues related to Embedded Web Servers

  • 1. 1 New Security Issues related to Embedded Web Servers Eric Vétillard, Trusted Labs © 2009 Trusted Logic S.A.
  • 2. All Cards are Servers
  • 3. 3 Card characteristics  Reacts to external requests ▪ a.k.a. APDU command  Is accessible to the attacker ▪ Provided that the attacker has the card handy ▪ A bit more remotely with contactless cards  Of course, most cards use specific protocols © 2009 Trusted Logic S.A.
  • 4. 4 Card functions  Store, use, and protect secrets  Store private user data  Authenticate users  Establish secure communication links © 2009 Trusted Logic S.A.
  • 5. How is a Web Server Different ?
  • 6. 6 A Web server is standard  There are many standards to be followed ▪ Protocols: HTTP, HTTPS, SSL, … ▪ Data formats: HTML, XML, CSS, … ▪ Languages: JavaScript, …  Web clients are standardized ▪ Browsers ▪ JavaScript-based AJAX clients © 2009 Trusted Logic S.A.
  • 7. 7 A Web server is complex  At least, more complex than a typical card  Several layers of complexity ▪ TCP/IP is more complex than ISO7816-3 ▪ Data exchange formats more complex ▪ XML more complex than TLV ▪ Processes often more complex ▪ In particular, GUI provided by the server  But, complexity mostly handled by browser ▪ The server provides a description but no rendering © 2009 Trusted Logic S.A
  • 8. 8 A Web server is accessible  Most Web servers are on Internet ▪ They are widely accessible by everybody  The most sensitive servers are not ▪ They are on various kinds of Intranets ▪ Think of your SVN servers ▪ Think of your router’s/printer’s internal server  Some servers are local to a device ▪ Only accessible from the device that hosts them © 2009 Trusted Logic S.A.
  • 9. 9 An attacker’s point of view  Standard ▪ Good reusability of attack efforts ▪ Widely deployed standard clients are vulnerable  Complex ▪ More complex, more buggy, more vulnerable  Accessibility ▪ Easy to reach and reproduce ▪ Possibility to evade law enforcement © 2009 Trusted Logic S.A.
  • 11. 11 What makes a good attack?  A vulnerability ▪ Widely deployed is better ▪ Hard to fix is very good ▪ design flaw vs. implementation flaw ▪ Requiring significant work from developer  Opportunities for exploitation ▪ Stealing/abusing authentication credentials ▪ Compromising users’ machine © 2009 Trusted Logic S.A.
  • 12. 12 State-of-the-art  Web attacks are not static  OWASP regularly updates its “Top 10” ▪ Old (under control) attacks are downgraded ▪ New (uncontrolled) attacks are added/upgraded  Let’s look at their latest release ▪ Can they be applied to smart cards? © 2009 Trusted Logic S.A.
  • 13. 13 OWASP’s Top 10 Vulnerabilities  Cross-site scripting (XSS)  Injection flaws  Malicious file execution  Insecure direct object reference  Cross site request forgery  Information leakage and improper error handling  Broken authentication and session management  Insecure cryptographic storage  Insecure communications  Failure to restrict URL access © 2009 Trusted Logic S.A.
  • 14. 14 A1 – Cross-Site Scripting (XSS)  Cross-site scripting is a subset of HTML injection ▪ XSS allows attackers to execute a script in a browser  Reflected XSS ▪ Returns user-provided data to the same user ▪ Without checking it out.println(" Successfully added " + request.getParameter("id") ; © 2009 Trusted Logic S.A.
  • 15. 15 A1 – Cross-Site Scripting (XSS)  Why is this vulnerable? ▪ Because of possible user entries out.println(" Successfully added " + request.getParameter("id") ; <IMG SRC="javascript:alert('XSS');"> ; <SCRIPT SRC=http://ha.ckers.org/xss.js></SCRIPT> © 2009 Trusted Logic S.A.
  • 16. 16 A1 – Cross-Site Scripting (XSS)  Stored XSS stores data before to display it back ▪ Potentially to another user (a.k.a. the victim) ▪ Very useful in “social” sites  DOM-based XSS modifies the DOM tree ▪ Usually in combination of Ajax out.println("New friend added: " + friend.getParameter("id") ; © 2009 Trusted Logic S.A.
  • 17. 17 A1 – Cross-Site Scripting (XSS)  Recommended countermeasures include ▪ Input validation ▪ Use white-list validation (accept only limited input) Validate length, type, syntax, business rules, … ▪ Avoid black-list validation, which can be bypassed ▪ Strong output encoding ▪ Encode all user-input directly ▪ Specify the output encoding explicitly ISO8859-1 or UTF-8 ▪ Watch out for canonicalization errors ▪ If possible, use standard library © 2009 Trusted Logic S.A.
  • 18. 18 A1 – Cross-Site Scripting (XSS)  Does it apply to Smart Card Web Servers ?  Yes, it definitely does ▪ Query data will be used by the server ▪ Resources are scarce  Strong requirement for ▪ Input validation ▪ Output canonicalization © 2009 Trusted Logic S.A.
  • 19. 19 A2 – Injection flaws  Every interpreter can fall victim of injection flaws ▪ SQL is the most well-known victim ▪ HTML is also very common (see XSS) ▪ Any other interpreter can be attacked ▪ LDAP, XPath, XSLT, OS Command, … ▪ Your own proprietary language  The danger comes from the interpreter itself ▪ Security is orthogonal to Java’s security © 2009 Trusted Logic S.A.
  • 20. 21 A2 – Injection flaws  Recommended countermeasures include ▪ Input validation ▪ White lists, no black lists ▪ Use standard libraries if available ▪ Design validation carefully for proprietary frameworks ▪ Make exploits as difficult as possible ▪ Enforce least privilege principles ▪ Avoid detailed error messages  Many countermeasures for specific interpreters ▪ SQL is the most common © 2009 Trusted Logic S.A.
  • 21. 22 A2 – Injection flaws  Does it apply to Smart Card Web Servers?  Not really, or not directly ▪ No interpreter, no problem  But … a TLV format is a kind of interpreter ▪ Be careful as soon as data becomes structured ▪ Apply standard countermeasures © 2009 Trusted Logic S.A.
  • 22. 23 A3 – Malicious File Execution  The attacker executes a malicious OS command ▪ When runtime.exec() is used ▪ When files are created and/or updated  Small example exploitable on a weak platform String file = request.getParameter("file") ; File f = new File(dir + "/"+ file) ; http://www.example.com/banking?file=../../web.xml © 2009 Trusted Logic S.A.
  • 23. 24 A3 – Malicious File Execution  Does it apply to Smart Card Web Servers?  No it doesn’t ▪ Advantage of a “bare metal” implementation ▪ No operating system to be abused  But … there may still be an operating system ▪ Control all interfaces with Web server © 2009 Trusted Logic S.A.
  • 24. 25 A4 – Insecure Direct Object Ref  Never expose reference to implementation objects ▪ Files, directories, records, keys, etc.  An attacker may modify or abuse such references String language = request.getParameter("language") ; ResourceBundle rb = context.getResources("rsrc-"+language); <select name=“language”> <option value=“fr”>Français</option> </select> int cartId = Integer.parseInt(request.getParameter("cartID"); String query = "SELECT * FROM table WHERE cartID=" + cartId); © 2009 Trusted Logic S.A.
  • 25. 26 A4 – Insecure Direct Object Ref  Recommended countermeasures include ▪ Establish a standard way to refer to app objects ▪ Avoid exposing private object references to users No primary keys, no filenames ▪ Validate any private object references extensively An “accept know good” approach is here easy ▪ Verify authorization to all referenced objects ▪ Make sure that input does not contain attack patterns For instance, “../” and “%00” © 2009 Trusted Logic S.A.
  • 26. 27 A4 – Insecure Direct Object Ref  Does it apply to Smart Card Web Servers?  Yes, it definitely does ▪ Think about the “cart Id” example ▪ Short identifiers are likely on smart cards ▪ These identifiers may be easy to guess  Countermeasures are seen as expensive ▪ Map external references to internal ones © 2009 Trusted Logic S.A.
  • 27. 28 A5 – Cross Site Request Forgery  Cross-site request forgery steals user privileges ▪ The attacker sends a request from the victim’s browser ▪ The browser will use the victim’s privileges ▪ For instance, if the victim is logged in to a bank  The browser provides some protection ▪ There is a “same origin” policy ▪ It is not possible (easy) to directly steal content ▪ But, requests can be sent and interpreted on server © 2009 Trusted Logic S.A.
  • 28. 31 A5 – Cross Site Request Forgery  Does it apply to Smart Card Web Servers?  Yes, it definitely does  A few countermeasures are simple enough ▪ Insert random token in URL’s ▪ Re-authenticate for sensitive transactions ▪ More generally, limit the validity of authentication © 2009 Trusted Logic S.A.
  • 29. 32 A6 – Information Leakage and Improper Error Handling  Applications frequently use error messages ▪ They often try to be “helpful” for the user  As a result, some information is leaked ▪ Results are often too differentiated ▪ “Wrong username” vs. “Wrong password” ▪ Debugging information is often included ▪ Stack traces ▪ Failed SQL statements © 2009 Trusted Logic S.A.
  • 30. 34 A6 – Information Leakage and Improper Error Handling  Does it apply to Smart Card Web Servers?  Yes, but not really  Default output is likely to be scarce ▪ Tools are unlikely to include detailed information ▪ Applications are likely to have simple error mgmt ▪ Debugging code is the most likely culprit ▪ Override errors with standard response © 2009 Trusted Logic S.A.
  • 31. 35 A7 – Broken Authentication and Session Management  Many flaws are possible in authentication ▪ We know them quite well  Flaws are often found in ancillary functions ▪ Logout that doesn’t work, password management, no timeout, etc.  Session management is provided by the platform ▪ Don’t try to design one yourself © 2009 Trusted Logic S.A.
  • 32. 38 A7 – Broken Authentication and Session Management  Does it apply to Smart Card Web Servers?  Yes, it does ▪ All errors can be done on a card application  Java Card 3.0 provides some tools ▪ They are not sufficient on their own ▪ Be careful if you write authenticators © 2009 Trusted Logic S.A.
  • 33. 39 A8 – Insecure Cryptographic Storage  Sensitive data should be stored encrypted ▪ First, the data should actually be encrypted ▪ Then, the cryptography should be efficient ▪ Using well-known, accepted algorithms ▪ Protecting the keys adequately  Sensitive data should be well qualified ▪ Don’t forget some sensitive data ▪ Don’t store data that you don’t need ▪ If you don’t have it, attackers can’t get it © 2009 Trusted Logic S.A.
  • 34. 40 A8 – Insecure Cryptographic Storage  Does it apply to Smart Card Web Servers?  Not really, at least for card developers ▪ Java Card 3.0 is not as exposed as other platforms ▪ Many mechanisms are readily accessible ▪ The storage is tamper-proof to some level  Still, some recommendations apply ▪ Use the platform’s algorithms and key storage ▪ Ensure that your encryption cannot be bypassed ▪ Don’t store data unnecessarily © 2009 Trusted Logic S.A.
  • 35. 41 A9 – Insecure Communications  Sensitive data should be encrypted ▪ Secure channels need to be used ▪ HTTPS, SSL, TLS, …  Encryption is not sufficient ▪ Session establishment is crucial ▪ Authentication of other party is mandatory © 2009 Trusted Logic S.A.
  • 36. 42 A9 – Insecure Communications  Does it apply to Smart Card Web Servers?  Yes it does ▪ SSL may be unusual and hard for smart card guys ▪ Mutual authentication may be hard to get ▪ How can you be sure that your user has actually authenticated you (i.e., that phishing won’t work) ? ▪ All Web designers face the same issues © 2009 Trusted Logic S.A.
  • 37. 43 A10 – Failure to Restrict URL Access  Flaws are linked to accessible URLs ▪ Hidden or specials URLs, proposed only to privileged users, but in fact accessible to all users ▪ Pages used during development that perform administrative functions (without authentication) ▪ Sensitive data hidden by “Security through Obscurity” ▪ Out-of-date access control policies ▪ Some pages remain accessible to too many users ▪ Code that evaluates privileges on the client © 2009 Trusted Logic S.A.
  • 38. 45 A10 – Failure to Restrict URL Access  Does it apply to Smart Card Web Servers?  Yes, to a certain degree ▪ Smart Card Web Servers are likely to be simple ▪ Less temptation to have “hidden URLs” ▪ But … Smart Card Web Servers may be administered through the Web interface ▪ We can see a chicken and egg problem ▪ There is no “console” on a smart card © 2009 Trusted Logic S.A.
  • 40. 47 A Local Server?  A Smart Card Web Server may be local ▪ Basic assumption in SCWS ▪ Not an assumption in Java Card 3.0  Some applications don’t need Web access ▪ Being local greatly reduced the risk of attacks ▪ Physical access becomes a prerequisite  Smart cards may very often be local © 2009 Trusted Logic S.A.
  • 41. 48 Basic defenses  Validate input, encode outputs ▪ Standard libraries can’t be directly used ▪ Be ready to sacrifice flexibility for security  Follow recommendations for encoding ▪ Don’t use internal identifiers in the interface ▪ Include random data in URL’s  Follow recommendations for access control ▪ No hidden URL’s ▪ Authenticate user after opening secure channel ▪ … © 2009 Trusted Logic S.A.
  • 42. 49 Reproduce Web server architecture  Web servers are not monolithic ▪ They usually are “n-tier” systems ▪ The Web server is the presentation tier ▪ The actual data is on another (Intranet) server  Smart card servlets can be structured ▪ The Java Card firewall guarantees some isolation ▪ Data is best kept outside of the servlet ▪ Attacks then need to be performed through servlet ▪ Management uses a different security policy © 2009 Trusted Logic S.A.
  • 43. Where do we go from here ?
  • 44. 51 Try it out !  When trying SCWS/Java Card 3.0 ▪ Think about Web security ▪ Develop appropriate countermeasures ▪ At least, list what you should do ▪ Assess the performance impact  Now, you should realize the problem ▪ Web security is not easy © 2009 Trusted Logic S.A.
  • 45. 52 Build reference code ?  The specification is not the right place ▪ Security code is by essence variable ▪ Security code usually is the result of a trade-off ▪ Input validation is much easier if you only accept alphanumerical characters and spaces  Yet, this is not really a competitive area ▪ A broken Web server is bad news for all  Would there be a use for a reference code? ▪ Bring the Web spirit to smart cards © 2009 Trusted Logic S.A.
  • 46. 53 Thank you ! Eric Vétillard eric.vetillard@trusted-labs.com © 2009 Trusted Logic S.A.