<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>On the road to Bandol &#187; GlobalPlatform</title>
	<atom:link href="https://javacard.vetilles.com/tag/globalplatform/feed/" rel="self" type="application/rss+xml" />
	<link>https://javacard.vetilles.com</link>
	<description>A weblog on Java Card, security, and other things personal</description>
	<lastBuildDate>Mon, 18 Aug 2025 06:48:26 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.32</generator>
	<item>
		<title>The misuse of bytecode verification</title>
		<link>https://javacard.vetilles.com/2011/10/19/the-misuse-of-bytecode-verification/</link>
		<comments>https://javacard.vetilles.com/2011/10/19/the-misuse-of-bytecode-verification/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 08:42:21 +0000</pubDate>
		<dc:creator><![CDATA[Eric Vétillard]]></dc:creator>
				<category><![CDATA[Discussions]]></category>
		<category><![CDATA[Java Card 2.x]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Virtual machine]]></category>
		<category><![CDATA[bytecode]]></category>
		<category><![CDATA[GlobalPlatform]]></category>
		<category><![CDATA[static analysis]]></category>

		<guid isPermaLink="false">http://javacard.vetilles.com/?p=759</guid>
		<description><![CDATA[Bytecode verification has been an interesting debate since the very beginning of Java Card. Back then, in 1997, Java was very much about Java applets, and the bytecode verifier was the essential piece of software that allowed untrusted code to run in a browser efficiently (i.e., without doing expensive runtime checks, and without having to [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Bytecode verification has been an interesting debate since the very beginning of Java Card. Back then, in 1997, Java was very much about Java applets, and the bytecode verifier was the essential piece of software that allowed untrusted code to run in a browser efficiently (<em>i.e.</em>, without doing expensive runtime checks, and without having to setup a complex process of applet vetting). We inherited this view of bytecode verification in Java Card, and the verifier was integrated in the Java Card virtual machine.</p>
<p>Since then, there have been many debates about bytecode verification, and my own position has evolved over the years. Today, my opinion is a bit contrasted, some may even say contradictory. Nevertheless, here it is:</p>
<ul>
<li>Bytecode verification has limited use for Java Card runtime security.</li>
<li>Extended bytecode verification is a very good tool for application vetting.</li>
</ul>
<p>Let me give a few more details about these two opinions.</p>
<h4>Bytecode verification and runtime security</h4>
<p>The idea of runtime verification is that it is performed after getting the code, and right before to run it. The code that runs is therefore known correct, at least regarding bytecode execution (unrelated attacks remain possible, of course).</p>
<p>The first big issue with bytecode verification is that, in Java Card, with the split virtual machine model, verification is not performed on the card, but outside of the card, before/during/after converting the application into Java Card&#8217;s specific binary format (CAP file). Then, the application is sent to the card over some channel that may be attacked. Here, we rely on GlobalPlatform&#8217;s cryptography-based security to protect the integrity of the code. So, basically, we still need to establish trust, and we must say goodbye to the power of running untrusted code from arbitrary developers.</p>
<p>This is not a big issue in practice, because there is no business model that allows arbitrary code to be loaded on cards. However, this causes an organizational problem, as the verification process needs to be well organized. Researchers from Nijmegen and Limoges have shown that it is possible to fool the verification process with fake export files, and then load on a card verified code that will perform type confusion attacks.</p>
<p>Going beyond that, some people have designed applications that can be verified, but have been designed to be attacked through hardware attacks (fault induction, usually). Such attacks, usually known as hybrid attacks, completely fool the bytecode verification process.</p>
<p>Most security experts will then remind you at this point of the discussion that bytecode verification is only one part of the process, that GlobalPlatform is also important, that the origin of code is usually known, that this makes it very difficult to include attack code in an application, <em>etc</em>. By doing this, they are just about accepting the fact that bytecode verification is useless or at best  marginally useful: the real security of cards is in the trust between issuers and application providers, and some cryptographic process. Basically, this works because the ecosystems are small enough to be controlled (which is true for cards, and fine for me).</p>
<p>Finally, some vendors claim to have developed defensive virtual machines, which do not require a bytecode verifier, and perform enough runtime verifications to accept any bytecode, good or bad, without any risk. In that case, bytecode verification is really useless, and I believe that it makes things much simpler. Of course, such virtual machines are difficult to design and implement efficiently, but this is definitely possible, and I think that it has been done in the past (or at least that some people has come very close to it).</p>
<p>To conclude, I will get back many years ago. In 2000, Trusted Logic was very proud of its on-card bytecode verifier; the technology worked, but it has not been widely adopted. I believe that the first factor was performance, as verification made the loading and linking process much slower. I also believe that a second factor, less obvious, is that on-card bytecode verification makes the card&#8217;s security more brittle, by encouraging VM developers to rely too much on static verification rather than runtime checks (which also prevent other runtime attacks, for instance using fault induction). More than ten years later, most people admit that this was not the way to go, and I just go one step further by stating that bytecode verification is not that useful for runtime security.</p>
<h4>Bytecode verification and application vetting</h4>
<p>Bytecode verification simply consists of a very simple static analysis of the application code. Basically, this is is a program proof, but a very simple one, whose complexity can be controlled. The objective of such simple proofs is not to demonstrate that a program is correct with respect to its specification, but that this program obeys a predefined set of properties.</p>
<p>For Java bytecode verification, these properties are related to the proper ues of the bytecode instructions. However, the same algorithms can be extended in order to prove many more properties, covering many aspects of application security. Among the things that can be proven, we have the following:</p>
<ul>
<li>Method <em>M</em> is not called.</li>
<li>Method <em>M</em> is not called with arguments <em>A1</em>, &#8230;, <em>An</em>.</li>
<li>Method <em>M</em> is always called before/after method <em>N</em>.</li>
<li>Method <em>M</em> never throws a <code>NullPointerException</code> (or any other exception).</li>
<li>Command <em>INS</em> can only return status codes <em>SW1</em>, &#8230;, <em>SWn</em></li>
<li>Toolkit buffers are only used when they are available.</li>
<li>and many more.</li>
</ul>
<p>Of course, there is no magic. When extending static analysis to many properties, it becomes more and more difficult to avoid false positives, <em>i.e.</em> errors that are caused by weaknesses in the algorithms. Put simply, an application is rejected although it is in fact correct.</p>
<p>Apart from working on the algorithms to make them better, there are two ways to deal with this issue:</p>
<ul>
<li>Providing the verification tool to developers, together with explanations about the rules to follow. Usually, it is rather simple for developers to ensure that their application can be verified, provided that they can use the tool throughout the development process.</li>
<li>Use the tool in a vetting process as a guide for evaluators, who then perform additional verifications. In that case, broken rules are considered as warnings, and then verified by the evaluators. Simple applications can usually be verified easily, and more complex verification requires a few checks, simplified by the fact that the most boring tasks are performed automatically.</li>
</ul>
<p>I believe in both approaches, but the second one has been proven efficient by my then colleagues of Trusted Labs. By using such a static analysis tool, they are able to optimize the vetting process of Java Card applications (and MIDlets, but this is another story) significantly, by allowing them to focus on the the most important parts of the applications.</p>
<p>In addition, this approach allows us to include many more security rules. For instance, hybrid applications must include code that can be modified into attack code through a simple attack. It is possible to build a library of patterns of such code sequences, and to check for them statically. Then, evaluators can be warned of the possible presence of an hybrid attack and check for it. This can be promising, because such checks (very boring to do, but very unlikely to lead to anything) are usually poorly performed by humans.</p>
<p>Finally, extended bytecode verification, or static analysis, has been proven to be a very efficient optimization tool. All optimizing compilers include a static analysis phase to perform their most complex optimizations. Java Card can take great advantage of this, because of the isolation between applications, and also because of the closed world hypothesis that is sometimes possible, when cards are closed (no additional applications can be downloaded).</p>
<p>So, bytecode verification has many uses in Java Card, but runtime security just isn&#8217;t the most compelling.</p>
]]></content:encoded>
			<wfw:commentRss>https://javacard.vetilles.com/2011/10/19/the-misuse-of-bytecode-verification/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Open Source, GlobalPlatform, and Java Card</title>
		<link>https://javacard.vetilles.com/2011/10/05/open-source-globalplatform-and-java-card/</link>
		<comments>https://javacard.vetilles.com/2011/10/05/open-source-globalplatform-and-java-card/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 06:32:32 +0000</pubDate>
		<dc:creator><![CDATA[Eric Vétillard]]></dc:creator>
				<category><![CDATA[Discussions]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Open issues]]></category>
		<category><![CDATA[GlobalPlatform]]></category>
		<category><![CDATA[Java Card]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://javacard.vetilles.com/?p=741</guid>
		<description><![CDATA[The two concepts of open source and smart cards have not gone well together. There are some projects about specific applications and corresponding terminal-side software, such as the Muscle project for Linux, and the JMRTD library for e-passports (if you have one that you want me to mention, let me know). However, there are really [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>The two concepts of open source and smart cards have not gone well together. There are some projects about specific applications and corresponding terminal-side software, such as the <a href="http://www.musclecard.com/" class="liexternal">Muscle</a> project for Linux, and the <a href="http://jmrtd.org/" class="liexternal">JMRTD</a> library for e-passports (if you have one that you want me to mention, let me know).</p>
<p>However, there are really few open source developments in the area of smart card operating systems and runtime environments. This is why the recent release of the <a href="http://secinfo.msi.unilim.fr/opal/" class="liexternal">OPAL</a> library by the University of Limoges is significant. This library offers a client-side implementation of the latest GlobalPlatform specifications, greatly simplifying the development of applications that manage applications on smart cards.</p>
<p>In particular, this development could be the basis for interoperable and open smart card testing tools. For instance, the <a href="http://mesure.gforge.inria.fr/" class="liexternal">Mesure</a> project, which defines benchmarks for Java Card, could use an open and complete GlobalPlatform implementation.</p>
<p>Now, can we go further than that? Is it possible to really get into the smart cards, and have open source operating systems, or parts of operating systems? Well, there are a few good reasons not to do it:</p>
<ul>
<li><strong>Licenses</strong>. The specificatoins like GlobalPlatform and Java Card are free to access, but after going through a click-wrap license, including some restrictions. For GlobalPlatform, the restricions are limited, mostly because GlobalPlatform is a community effort, and both the license to use the specification and to sell products bassed on it are free. The Java Card license is more restrictive, because it is owned by Oracle. Java Card is free for developers, but implementers need to pay a license.</li>
<li><strong>IP rights</strong>. The smart card industry is highly competitive, and has not always been very open source-friendly in the past. There are literally thousands of patents that have been filed on the technology, and it is hard not to infringe on any of them while writing a smart card operating system. Companies don&#8217;t have to enforce their IP, but they can, which means that any open source project is in under a constant threat.</li>
<li><strong>Security</strong>. This argument may not be as strong, but the smart card security community is very well organized, with manufacturers, labs, national authorities, <em>etc</em>. They have developed a significant set of documentation and guidelines aound Common Criteria certifications of cards, which is one of the best industry efforts available today. The industry may not be eager to see an active open-source community working on attacks and countermeasures in parallel to their own efforts. And if they are not happy, they may activate the <em>IP rights</em> argument.</li>
</ul>
<p>Of course, there is here a difference between academic projects and industrial projects. Consider Simulity&#8217;s <a href="http://dkard.org/" class="liexternal">DKard</a> project, a microcontroller (<em>i.e.</em>, smart card) virtual machine based on Android&#8217;s Dalvik VM. Google may have published Android as an open-source project (we can assume that the spec lcense part is covered), but this doesn&#8217;t make them safe from IP rights. If they start encountering the slightest success, somebody will remember that they infringe on their IP; and since this somebody is likely to be much larger than Simulity, this is not good news.</p>
<p>From my point of view, we can close the industrial part. It would be foolish to start a company with a business model based on open source software for smart card operating systems, unless it is strongly backed by at least one major manufacturer, with the ability to protect the small player from IP claims by competitors.</p>
<p>Now, we are left with the academic projects. There is an active research community around smart cards, focusing in particular on security aspects, particularly in Europe. One of the main problems faced by this community is that they don&#8217;t have a good playground: there is no open smart card operating system platform on which they can experiment.</p>
<p>Card vendors are not too keen to see academics use their products for experiments and attacks, because they don&#8217;t want to see publications claiming that their card was broken. As a consequence, card development kits usually come with licenses and non disclosure agreements that do not allow the use of the cards for research purposes.</p>
<p>The &#8220;obvious&#8221; solution is to develop an open source platform, just for research purposes. But then, we get back to the licenses and IP and everything. There are several choices, every one with pros and cons:</p>
<ul>
<li><strong>Implement Java Card</strong>. Here, a conflict is likely with the industry, especially if the implementation is good and can help outsiders develop/enhance their products.</li>
<li><strong>Implement something else</strong>. This could work, but the difficulty is to find the right balance between mimicking Java Card and differentiating from the spec.</li>
</ul>
<p>I don&#8217;t believe that the solution is ready here. Without industry support, getting funding for the research will likely be difficult. And the industry players may not look forward to sueing a few academic institutions. In the end, the stakeholderes need to talk to each other, really looking for a solution that suits everybody. This discussion never really took place in the past, let&#8217;s hope that it will happen some day, so we can at least remember that we tried.</p>
<p>Thoughts and remarks welcome, as comments or direct contact.</p>
]]></content:encoded>
			<wfw:commentRss>https://javacard.vetilles.com/2011/10/05/open-source-globalplatform-and-java-card/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Live from #esmart: GlobalPlatform 3 roadmap</title>
		<link>https://javacard.vetilles.com/2009/09/25/live-from-esmart-globalplatform-3-roadmap/</link>
		<comments>https://javacard.vetilles.com/2009/09/25/live-from-esmart-globalplatform-3-roadmap/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 07:43:51 +0000</pubDate>
		<dc:creator><![CDATA[Eric Vétillard]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[GlobalPlatform]]></category>
		<category><![CDATA[Java Card Bandol]]></category>

		<guid isPermaLink="false">http://javacard.vetilles.com/?p=468</guid>
		<description><![CDATA[GlobalPlatform is evolving, but it is very closely linked to Java Card, as it provides the deployment standard that Java Card needs to manage its applications. GlobalPlatform is evolving, and the next specification (GP3) is under way. It will target the next generation of cards, and some of it has already been published in the [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>GlobalPlatform is evolving, but it is very closely linked to Java Card, as it provides the deployment standard that Java Card needs to manage its applications.</p>
<p>GlobalPlatform is evolving, and the next specification (GP3) is under way. It will target the next generation of cards, and some of it has already been published in the GlobalPlatform Networked Framework. This specification supports networked cards, and it also allows the management of cards over TCP/IP, which is emerging as a new protocol on cards.</p>
<p>However, GP3 has the ambition of bringing back together the various documents produced by GlobalPlatform since Java Card 2.2, including all amendments. This is great news, because GP2.2 already did a great work at clearly defining and bringing together many different concepts that needed such a definition.</p>
<p>The future document will be based on a common architecture and security principles, with four additional parts:</p>
<ul>
<li>Secure communications. Building on the existing secure channel protocols, GP3 will add support for SCP81 (TLS), and for SCP20 (transport-independent security).</li>
<li>Networked communications. How to manage applications over HTTP.</li>
<li>Classic framework. The existing GP2.2 framework, with slight enhancements.</li>
<li>Networked framework. Based on the just released GPNF, and included support for Java Card 3.0 (other frameworks could be supported in the future).</li>
</ul>
<p>In addition, GP3 will define a set of profiles, that will implement a consistent subset of this specification. The components are mostly ready, and the intention is to work on the new specification during 2010.</p>
<p>Beyond specifications, there are migration issues, when someone wants to move from an APDU-based card to a networked card.<br />
<span id="more-468"></span></p>
<p>In terms of administration, there are a few major changes:</p>
<ul>
<li>The commands have changed from APDU&#8217;s to BER TLVs, which are defined in ASN.1 on the card.</li>
<li>The secure channels have changed from specific protocols to standard Web protocols.</li>
<li>Finally, although this is not related to GlobalPlatform, the formats used for downloading have changed from CAP files to WAR files.</li>
</ul>
<p>Taken individually, all of these steps are rather easy to deal with. The principles of content management are not dramatically changed; only the protocols change. The real difficulty is to transition from APDU-based cards to networked cards. From the content management point of view, there are three solutions:</p>
<ul>
<li>Dual card. Such a card would fully support both mechanisms (CAP files, APDU-based GlobalPlatform on one side, WAR files and networked communication on the other). This is very simple to manage, but these cards will be too expensive.</li>
<li>Migration card. In such a card, the runtime environment is unique (networked card, with WAR files), but both administration formats are supported (APDU or Web). This is an interesting intermediary point, since it will support &#8220;old&#8221; administrative tools, while allowing the deployment of Web applications.</li>
<li>Connected card. In that case, all operations must be migrated to the connected network</li>
</ul>
<p>An alternative way to deal with the migration issue is to develop an automated converter, that will transform GP2 commands into GP3 commands, and allow the management of classic applications.</p>
<p>From the secure channel point of view, the situation is approximately the same, with one major difference: one of the secure channel protocls (SCP81, or TLS), will be supported on all cards, at least in the SIM market.</p>
<p>Well, administration tool developers have some work to do. However, if card vendors produce &#8220;migration card&#8221;, things should be made quite easy on them. It is nice to see that GP is thinking about migration even before to write the final spec, as it increases the chances that we eventually get a workable migration path. This is much more important for GP than it is for Java Card, as card management tools are an important asset of the industry, making a smooth migration mandatory.</p>
]]></content:encoded>
			<wfw:commentRss>https://javacard.vetilles.com/2009/09/25/live-from-esmart-globalplatform-3-roadmap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
