Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers ›...

160
Institut Eurécom Thèse présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure des Télécommunications Spécialité : Informatique et Réseaux par: Sergio Loureiro Sujet de la thèse: Mobile Code Protection Soutenue le 26 Janvier 2001 devant le jury composé de: Rapporteur Nicolas Sendrier, INRIA Rocquencourt, France Rapporteur Christian Tschudin, Uppsala University, Sweden Examinateur Andrzej Duda, ENSIMA Grenoble, France Examinateur Günter Karjoth, IBM Research Zurich, Switzerland Examinateur Patrick Solé, CNRS Sophia Antipolis, France Directeur de Thèse Refik Molva

Transcript of Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers ›...

Page 1: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Institut Eurécom

Thèse

présentée pour obtenir le grade de docteur

de l'Ecole Nationale Supérieure

des Télécommunications

Spécialité : Informatique et Réseaux

par:Sergio Loureiro

Sujet de la thèse:Mobile Code Protection

Soutenue le 26 Janvier 2001 devant le jury composé de:

Rapporteur Nicolas Sendrier, INRIA Rocquencourt, France

Rapporteur Christian Tschudin, Uppsala University, Sweden

Examinateur Andrzej Duda, ENSIMA Grenoble, France

Examinateur Günter Karjoth, IBM Research Zurich, Switzerland

Examinateur Patrick Solé, CNRS Sophia Antipolis, France

Directeur de Thèse Refik Molva

Page 2: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure
Page 3: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection

Sergio Loureiro

ENST Paris / Institut Eurecom

Page 4: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure
Page 5: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

v

Contents

Acknowledgements ix

Abstract xi

Résumé xv

CHAPTER 1 Introduction 1

The Mobile Code Paradigm 1

Mobile Code Security Threats 4

Contributions 9

Structure 10

References 13

Page 6: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Contents

vi

CHAPTER 2 Privacy of Execution 17

Introduction 17

Threats 18

Tamper-Proof Hardware 19

Obfuscation 20

Secure Function Evaluation 21

Requirements 26

Conclusion 27

References 28

CHAPTER 3 Integrity of Execution 33

Introduction 33

Problem Statement34

Proof Systems 34

Traces of Execution 37

Fault Tolerance 38

Result Checking 39

Verifiers 40

Conclusion 42

References 42

CHAPTER 4 Introduction to Coding Theory 47

Introduction 47

Linear Block Codes 48

Complexity 50

Cryptosystems 52

Cryptanalysis 54

Conclusion 60

References 60

Page 7: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection vii

Contents

CHAPTER 5 Code Protection 67

Introduction 67

Computational Model 68

Security Framework 69

Example 70

Protocol Description 72

Function Representation75

Security Evaluation 77

Conclusion 80

References 81

CHAPTER 6 Code Protection with TPH 83

Introduction 83

Computational Model 84

Requirements 85

Protocol Description 87

Security Evaluation 90

Off-line Verifiers 93

Conclusion 97

References 98

CHAPTER 7 Code and Data Protection 99

Introduction 99

Memory Protection 100

Off-Line Secure Memory Manager105

On-Line Secure Memory Manager109

Code and Data Protection110

Conclusion 115

References 116

Page 8: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Contents

viii

CHAPTER 8 Collected Data Protection 119

Introduction 119

Data Collection System 120

Model 122

Security Requirements 123

Related Work 124

Set Integrity 126

Data Collection Protocol 129

Security Evaluation 131

Conclusion 133

References 133

CHAPTER 9 Conclusion 135

Unanswered Questions 139

Publications 141

Page 9: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

ix

Acknowledgements

First of all, I mustacknowledgemy greatdebtto my advisorRefik Molvafor his valuableadviceandpragmaticview of research.I am very gratefulfor his patience in improving my writing and presentation skills.

I would like to thank my thesis committeeNicolas Sendrier, ChristianTschudin,AndrzejDuda,GünterKarjothandPatrickSoléfor their valuablefeedback.I am especiallygrateful to Nicolas Sendrierfor his encourage-ment and for helping me with coding theory.

I acknowledgethefinancialsupportof thePortugueseScienceandTechnol-ogy FoundationthroughthescholarshipPraxisXXI BD 13875/97.I wouldlike to thank Adriano Carvalho for his help during the application process.

I wantto expressmy gratitudeto Eurecom,whichprovideda pleasantworkenvironment.

I would like to thanktheNSTeamat Eurecom,namelyAlain PannetratandYvesRoudierfor thefruitful discussionswehadandfor theirpatienceread-ing my thesis.

Page 10: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Acknowledgements

x

I amgratefulto the teamCODESfor their helpduringa very pleasantandproductive visit to the INRIA Rocquencourt.

I would like to thankeveryonewho madesunniertheyearsspentat SophiaAntipolis. First of all, Raul for his encouragementand for teachingmeimportantthingslikedoingsoups;ChristopheandDavid for initiating metohiking; Cristina for her friendship and pragmaticviews of life; Perrine,Franck,SophieandPierrefor showing metheimportanceof lingerie;NavidandHubertfor their insightsinto thestudway of life; Irfan for his insightsinto the cowboy way of life; my home-matesZoe and Olivier for theenglish/belgiancuisine;andafter MatthiasandAudrey for their patience;BeppeandMaria-Luisafor the lunchwith the priest;Arnd andJanfor thesplendid hat.

Furthermore,I would like to thank everyonewho mademe regret beingabroad.Paula, Paulo, Jorge, Manuel, Sergio, Marta and Miguel for theirfriendship;Anita, Luis, Susana,PedroandArmandofor their support;Rosaand Rosariofor their good mood; the “belhas” group for the “business”meetings.

My deepestgratitudeis to my parentsandsister. This thesisis dedicatedtothem.

Finally, I would like to thankNedafor her love. Shewasundoubtedlymymajor achievement during the thesis.

Page 11: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

xi

Abstract

Thedefinitionof themobilecodeparadigmappearsasa naturalstepin theevolutionof distributedsystemsandencompassesprogramsthatcanbeexe-cutedononeor severalhosts,otherthanthehostfrom whichthey haveorig-inated. Mobile code is generally justified on the grounds of greaterefficiency andincreasedflexibility , evenif thesefeatureshavenotbeenfullyexploitedyet.However, flexibility doesnot comewithout a price:increasedexposure to security threats.

Possible vulnerabilities with mobile code fall in one of two categories:

• Attacks performed by the mobile program against the remote executionenvironment and its resources;

• Subversionof themobilecodeandunauthorizedmodificationof its databy the remote execution environment.

Ourwork focuseson thesecondcategoryaimingat theprotectionof mobilecode from the execution environment.This category results in new andchallengingproblemswhich have not yet attractedmuch attentionfromsoftware manufacturersand for which no practicalsolutionsexist at thismoment.This category is alsoquite atypical sinceit doesnot rely on thesecurity of the execution environment which has always been a basic

Page 12: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Abstract

xii

assumptionin classicalreasoningaboutthe securityof cryptographicsys-tems.We further analyzemobile codeprotectionin two directions:codeprotectionfocusingon the integrity and privacy of the codesemanticsatrun-timeanddataprotectionfocusingon thesecurityof thedatatransportedby the mobile code.

Code protection addressesa more systematicform of maliciousnessinwhich theenvironmentwherethemobilecoderunscannotbetrusted.Codeprotectionmeanstheprotectionof thecodeduring its execution,consider-ing the environmentasa potentialadversary, ratherthanthe protectionofthe code during transmission.

Data protectiondealswith the securityof datagatheredby mobile coderoamingthrougha setof competinghosts.Classicaldataprotectiontech-niquesarenotsuitedto theprotectionof datathatchangesdynamicallydur-ing the code’s trip. We presenta protocol basedon a cryptographictechniquethat assuresthe integrity of a sequenceof datasegmentsregard-lessof theorderof eachsegmentin thesequence.Theprotocolallows eachhostto updatethedatait previously submitted,in a way that is suitableforfreecompetitionscenarioslikecomparativeshoppingor distributedauction,andfor highly dynamicenvironmentslike stockmarkets.The setof hostscan be visited several times in randomorder and a short messagedigestallows for the integrity verification of all the collected data.

Concerningcodeprotection,we furtherclassifytheproblemsinto two cate-gories:privacy of executionandintegrity of execution.Privacy of executionaimsat preventingthedisclosureof thecodesemanticsduringits executionin a potentiallyhostileruntimeenvironment.Integrity of executionassuresthata program,executedin a potentiallyhostileenvironmentactuallycom-plieswith its originalsemantics.Wepresentoriginalsolutionsthatdealwithbothrequirements(privacy andintegrity of execution).WepresentsolutionswithoutTamperProofHardware(TPH) thataddressavery limited modelofcomputation.

Then,we build solutionsusinganauxiliary trustedTPH actingon behalfofthe codeowner. The limited TPH allows us to deal with a more flexiblemodelof computation.ThetrustedTPH interactswith theuntrustedexecu-tion environmentin orderto fulfill thesecurityrequirementsakin to privacy

Page 13: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

xiii

and integrity of execution. The goal is not to execute the code on the trustedTPH, but to extend its inherent security to the more powerful untrustedenvironment. The solutions minimize the computational and storagerequirements on the trusted TPH.

The solution with TPH assumed that the data involved in the computationsis stored in secure memory. We further enhance this solution by focusing onthe protection of the data stored in untrusted memory. Based on the solu-tions for the protection of the code execution and the solutions for the stor-age of data in untrusted memories, we suggest an integrated architecture forcode and data protection that relies on a limited TPH.

Page 14: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Abstract

xiv

Page 15: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

xv

Résumé

Le concept de code mobile apparaîtcomme une étape naturelle dansl’évolution des systèmesrépartis : il correspond à l’ensemble desprogrammesqui ont la capacitédesedéplacerpendantl’exécutionou entredifférentes exécutions. L’utilisation de code mobile est généralementjustifiéeparuneplus grandeefficacité,ainsi queparuneflexibilité accrue,même si ces avantagesn’ont pas encore été entièrementexploités.Cependant,la flexibilité s’accompagned’une exposition accrue auxmenaces de sécurité.

Les vulnérabilitéspossiblesdu codemobile peuvent êtreclasséesen deuxcatégories :

• Les attaques perpétrées par le code mobile contre l’environnementd’exécution et ses ressources;

• La subversion du code mobile et la modification non autorisée de sesdonnées par l’environnement d’exécution.

Notre travail porte sur la protection du code mobile vis-à-vis del’environnementd’exécution. La plupart des problèmesde ce type sontnouveauxet représententun défi ; ils n’ont pasencoreattiré l’attentiondeséditeursde logicielset aucunesolutionpratiqueà cesproblèmesn’existeà

Page 16: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Résumé

xvi

ce jour. Cettecatégorieestégalementtout à fait atypiquepuisqu’ellenesefondepassur la sécuritéde l’environnementd’exécutionqui a toujoursétéuneconditiondebasedansle raisonnementclassiqueausujetdela sécuritédes systèmescryptographiques.Nous analysonsla protection du codemobileà deuxniveaux: la protectiondu codevisantà assurerl’intégrité etla confidentialitédu codependantl’exécutionet la protectiondesdonnéesafin d’assurer la sécurité des données contenues dans un code mobile.

La protection du code a pour objet une forme plus systématiquedemalveillancedanslaquelleonnepeutpasfaireconfianceà l’ environnementoù le code mobile s’exécute.La protection du code s’effectue pendantl’exécution, en considérant l’environnement en tant qu’adversaire potentiel.

La protectiondesdonnéestraitedela sécuritédesdonnéesrecueilliesparlecodemobilequi sedéplaceentreun ensembledeserveursconcurrents.Lestechniqueshabituelles de protection de donnéesne conviennent à laprotectiondesdonnéesqui évoluent dynamiquementpendantle trajet ducode.Nousprésentonsunprotocolebasésurunetechniquecryptographiquequi assure l’intégrité d’un ensemble de segments de donnéesindépendammentde l’ordre de chaque segment dans l’ensemble. Leprotocolepermetà chaqueserveur de mettre à jour les donnéesqu’il aprécédemmentsoumises.Ceprotocolerépondauxbesoinsdesscénariosdelibre concurrencecommelesachatscomparatifsou l’enchèredistribuéeet ilconvient particulièrement aux besoins des environnements fortementdynamiquescommelesmarchésboursiers.Lesserveurspeuventêtrevisitésplusieurs fois de façon aléatoire et l’intégrité de toutes les donnéescollectées peut être vérifée par le calcul d’un condensat.

Pourcequi concernela protectiondecode,nousclassifionscesproblèmesdans deux catégories: confidentialité de l’exécution et intégrité del’exécution.La confidentialitéde l’exécutionviseà empêcherla révélationde la sémantiquedu codependantson exécutiondansun environnementd’exécutionpotentiellementhostile.L’intégrité de l’exécutionassurequ’unprogrammeest exécuté dans un environnementpotentiellementhostileconformément à sa sémantique initiale.

Pourchacunde cesdeuxproblèmes, nousprésentonsd’abordunefamilledesolutionssansnoyausécurisé(NS) concernantun modèledecalcul très

Page 17: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

xvii

limité. Puis,nousmontronsdessolutionsutilisantun NS auxiliaireagissantaunomdupropriétaireducode.Le NS nouspermetd’utiliser unmodèledecalculplusflexible. Le NS communiqueavec l’environnementd’exécutionafin de satisfaire les besoinsde sécurité,c’est-à-direla confidentialitéetl’intégrité de l’exécution.L’objectif n’est pasd’exécuterle codesur le NSmaisd’étendrela sécuritéinhérentedecedernierà un environnementpluspuissant.Nos solutionsréduisentla complexité en calcul et en mémoireimposée au NS.

NotresolutionavecNSsupposequelesdonnéesimpliquéesdanslescalculssont sauvegardéesdans une mémoire sécurisée.Nous étendonscettesolution en nousconcentrantsur la protectiondesdonnéessauvegardéesdansune mémoirepotentiellementmalveillante. Grâceà l’utilisation dessolutionspour la protectionde l’exécutiondu codeet dessolutionspour lasauvegardedesdonnéesdansdesmémoirespotentiellementmalveillantes,nous mettonsau point un architecturepour la protectionde code et dedonnées qui se base sur un NS limité.

Page 18: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Résumé

xviii

Page 19: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

1

CHAPTER 1 Introduction

1.1 The Mobile Code Paradigm

Themobilecodeparadigmencompassesprogramsthatcanbeexecutedononeor several hosts,other thanthe host from which they have originated.Mobility of suchprogramsimplies a built-in capability for eachpieceofcodeto migratesmoothlyfrom onehostto another. A mobilecodeis asso-ciatedwith at leasttwo parties:its owner, andthe host that runsthe code.Advancesin softwaretechnologyallow for thedesignof mobilecodecapa-bleof moving over thenetwork, andrunningindependentlyat remotehosts.Mobile codesystemsrangefrom simpleJavaappletsandActiveX programsto intelligent mobile software agents.Recently, we witnessedthe deploy-mentof a largenumberof mobilecodeplatforms(for example,seetheshortsurvey in [KT98]), which provide the required services for code mobility.

Dependingon the typeof mobility, a mobilecodecanbe furtherclassifiedinto strong and weak mobility, as described in [FPV98] and [Pic98].

Our work is orthogonalto the discussionsaboutthe taxonomyof mobilecodeanddifferenttypesof mobility, in thesensethatwe focuson thegen-eralcaseof thesecurityof acodeexecutedonanuntrustedhost.As aresult,

Page 20: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

2

the fact that thecodeencompassessomeform of intelligenceor that it canmove anytime in a completelyautonomousway is not relevant for ourstudy. Therefore,we adoptthe moregeneraldenominationof mobile coderather than mobile agents.However, the term agent is also usedin thismanuscript when appropriate.

This chapterpresentsa brief introductionto mobilecodefocusingon secu-rity threatsto betteridentify the scopeof this dissertation.Next, a simpleclassificationof theproblemsthataffectmobilecodeis established.Finally,the structure of the thesis presented at the end of this chapter is clarified.

1.1.1 Benefits and Drawbacks

Mobile codesystemsoffer severaladvantagesover themoretraditionaldis-tributed computing approaches [LO99][CHK97] in terms of:

• Network load reduction;

• Network latency avoidance;

• Protocols encapsulation;

• Asynchronous and autonomous execution;

• Dynamic adaptation;

• Support for heterogeneous architectures;

• Robustness and fault-tolerance.

All theseadvantagesneedto be critically analyzed.The advantagesaremainly dueto the fact that the executionis performedlocally, closeto thedatato be analyzedor nearthe systemoutputsto be processed.For exam-ple, [HI99] shows throughanexperimentalstudythatbandwidthoptimiza-tion canbeachievedusingmobileagents,althoughtheexperimentsfocusedonaveryspecificapplicationandscenario,hencetheresultsshouldbecon-sideredwith care.It was particularly clear from the experimentsthat theoverheadon size,andthuson communicationandcomputationalcomplex-ity imposedby the mobility platform, may compromisethe bandwidthadvantage.

Page 21: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 3

The Mobile Code Paradigm

Nevertheless,webelieve thatdespitecontroversialargumentsaboutspecificcriteria,mobilecodeoffersa clearadvantageover traditionalprogrammingparadigms in terms of flexibility in the development of applications.

1.1.2 Applications

Someapplicationshave beencited in [LO99] as very suitablefor mobileagents or mobile code as follows:

• Electronic commerce. Therearealreadya largenumberof mobileagentmediated electronic commerce frameworks [GMM98]. Researchers[MGM99] envision agentsembodyingthe intentionsof their owners,actingandnegotiatingon their behalfwhile travelling throughthe net-work;

• Personal assistants. Assistantscan operate remotely without beingdependent on the state of network connections [Kru97];

• Distributed information retrieval. Mobile codethatroamsthenetwork togatherdatais oneof thesimplestapplicationsenvisagedby developers.Theability of mobilecodeto processsearcheslocally on largedatabasesis veryattractive.Thisspecificapplicationwill bethefocusof Chapter8;

• Monitoring applications. The asynchronousnatureof mobile code ishighlightedby this application.The codecanbe dispatchedto monitorsourcesof information available remotely, avoiding network latenciesand the need for a reliable connection;

• Information and code dissemination. Mobile codecanprovideadditionalcontent delivery services;

• Parallel processing. Complex computationscanbeperformedby asetofmobile code fragments that will execute in parallel on different hosts.

This list is not exhaustive, but it givescluesto thescenarioswheremobilecode can be applied.

Page 22: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

4

1.2 Mobile Code Security Threats

The increasedflexibility offeredby mobile codecomesat the expenseofincreasedvulnerability in the faceof maliciousintrusionscenariosakin tonetworking. The following security exposures derive from code mobility:

• Host and mobile codecan representdifferent partiesthat may exhibitmalicious behavior toward one another;

• Mobile codecan be exposedto third-party intrudersthrough the net-work;

• Severalmobilecodesegmentsrepresentingdifferentpartiesmayexhibitmalicious behavior toward one another.

Thesecondandthird typesof exposurescall for solutionsbasedonclassicalcommunicationsecurity mechanisms,such as the approachsuggestedin[KLO97]. However, thefirst typeof exposureraisesnew requirementsthatcannotbemetby classicalsecuritytechniques.As for thefirst problem,thetype of exposures falls into one of two categories:

• Host protection from mobile code. Attacksperformedby themobilepro-gram against the remote execution environment and its resources;

• Mobile code protection from malicious hosts. Subversionof the mobilecodeandunauthorizedmodificationof its databy the remoteexecutionenvironment.

1.2.1 Host Protection from Mobile Code

A first securitythreatconsistsof a mobile codegeneratedby a maliciousoutsiderattackingthe environmentwherethe codeis executed,suchas intheexampleof maliciousJava applets.This problemhasalreadybeenthor-oughly studiedin recentyears.The first solution consistedin restrictingcapabilitiesof codesegmentsin order to limit vulnerabilities.Techniquesfor host protection now evolve along two directions [LMR00]:

• Enhancementof themobilecodeinfrastructurewith authentication,dataintegrity and access control mechanisms;

• Verification of the semantics of the mobile code.

Page 23: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 5

Mobile Code Security Threats

In the following, we give a brief descriptionof thebestknown solutionstotheproblemof hostprotectionin orderto show thedifferencein complexitybetween host and mobile code protection. The surveys[HLPS98],[RG98],[LMR00]andreferencesindicatedbelow provide moreinformation about this topic.

Sandboxing

Sandboxingconsistsof runninga mobile codeinsidea restrictedenviron-ment called the “sandbox”. A remote host may execute an otherwiseuntrustedmobilecodeinsidethesandbox,without worrying aboutsecurity.This approachis well illustratedby theearlyJava JDK 1.0 [GJS96],whereit wasusedin orderto enableappletsavailableanywhereon theInternettorun within a browser. The major drawbackof sandboxingis that applica-tions runningin sucha restrictive environmentarethemselvesseldomuse-ful because their operations are limited.

Code Signing

Codesigningis theprocessthroughwhich a codeis digitally signedby thecodeownerin orderto assurestrongauthenticationandintegrity of thecodeto whomever executes the code. This model was first introduced byMicrosoft within the ActiveX framework. Java JDK 1.1 also follows thecode signing model, with so-calledsigned applets.Upon receipt of anappletwith avalid signature,theJavavirtual machineexecutestheappletasa trustedpieceof code,authorizingit to accessall featuresavailablein Java.An appletwithoutapropersignatureis run insideasandboxasin theprevi-ousversionof theJDK. However, securinga hostfrom a maliciousmobilecodeprogramraisesmore security issuesthan just making surethat thisprogram has been correctly signed by someone on the Internet.

Access Control

In orderto limit the impactof an attack,oneway to enhancethe previousapproachesis to enablemorecomplex accesscontrolschemes.This canbeseenastherefinementof a monolithicsandboxpolicy into smaller, applica-

Page 24: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

6

tion-specificpolicies.The identity of the codesigner, as describedin theprevioussection,alsohelpsto furtherrefinetheexecutionpolicy definition.JavaJDK 1.2securitymodel[Gon98]follows thisdirectionandthusallowsthe definition of finer-grainedsecurity policies more suited to executinguntrustedmobile code.Comparedwith sandboxingand codesigning, theaccesscontrol modelhasthe bestof both worlds: mobile codeactionscanbe restrictedto a setof resourceswhile the modelallows to write andrunreally useful software at the sametime. However, since it is performeddynamicallyat runtimetheenforcementof theaccessschemehasa costinperformance.

Code Verification

Codeverificationprovidesfurtherassuranceon thecodesemanticsthroughtheanalysisof thestructureor behavior of themobilecodeagainsta givensecuritypolicy. Sandboxes have alreadyexercisedsomerudimentarypro-gram checks,either statically or dynamically, for instanceto ensurethatoperandsof aninstructionareof thecorrecttype.A newer approachto hostprotectionis to staticallytype-checkthe mobile code;the codeis thenrunwithout any expensive runtimechecks.Promisingresultswereobtainedinthis areaby the Proof-CarryingCode (PCC) work [Nec97] [NL98], andeven to someextent by the Java virtual machine(for safety checks).InProof-CarryingCode, the remotehost first asksfor proof that the coderespectshis securitypolicy beforehe actually agreesto run it. The codeownersendstheprogramandanaccompanying proof,usingasetof axiomsandrewriting rules.After receiving the code,the hostcan thenchecktheprogramwith theguidanceof theproof.This canbeseenasa form of typecheckingof theprogram,sincetheproof is directlyderivedfrom it. In PCC,checkingtheproof is relatively simplecomparedto constructingit, thusthistechniquedoesnot imposemuch computationalburdenon the executionenvironment.However, the proofs can be large and automatingthe proofgeneration is still an open problem.

1.2.2 Mobile Code Protection from Malicious Hosts

The problem of mobile code protectionfrom a malicious host has onlyrecentlybeenstudied,andit is intrinsically moredifficult becausethe run-

Page 25: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 7

Mobile Code Security Threats

time environmenthastotal controlover themobilecode.This problemhasnot yet attractedmuchattentionfrom softwaremanufacturers.Researchisstill in its infancy aswell, andtheexisting mobilecodeplatformsonly pro-vide solutions for host protection.

This category is alsoquiteatypicalasit doesnot rely on thesecurityof theexecutionenvironmentwhich hasalwaysbeena basicassumptionin classi-cal reasoningfor thesecurityof cryptographicsystems.This assumptionisoftendenotedby theterm"trustedcomputingbase".Protectingmobilecodefrom maliciousremoteexecutionenvironmentsmayberephrasedascarry-ing out a trustedoperation(definedby themobilecode),usinganuntrustedhost as execution environment. Some authors[CGH+95] postulatethatmobile codecannotbe effectively protectedagainsta maliciousexecutionenvironment that has full access to both code and data segments.

The problemsencounteredby the executionof mobile codeon untrustedandpossiblymalicioushostsarethefocusof thisdissertation.In thecaseofmobile codeprotection,the existing surveys [JK99][KP00] are limited tothe descriptionof the few approachesproposedto addressthis problem.Adeeperanalysisof thesecurityissuesandtheirsolutionsis neededto gainaninsight into theproblemof mobilecodeprotection.Concretely, we startbyclassifyingthe securityrequirementsaccordingto the informationcarriedby the mobile code. This information can be classified as follows:

• Code. The set of executable instructions;

• Static data. Data not modified during the trip;

• Collected data. Datacollectedduring the trip performedby the mobilecode;

• State. Dynamic datausedas input to the computationsperformedonremote hosts during the trip.

Theaim of mobilecodeprotectionis to protecttheabove informationfromthe executionenvironmentsvisited by the mobile code.Startingfrom thisclassification,possibleviolationsoriginating from runninga programin apotentiallyhostileenvironmentmayleadto thefollowing differentsecurityrequirements:

Page 26: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

8

• A company might needto prevent the disclosureof certain sensitivealgorithmsimplementedin its mobilecodedespiteextensivecodeanaly-sisandreverseengineeringby potentialintruders,including its custom-ers;

• A mobile software agentacting on behalf of a personmight needtoassure the integrity of some critical operations performed on anuntrusted remote host;

• A datacollectionagentmight needto assureboththeconfidentialityandthe integrity of the data gathered at various competing sites.

From the above discussion,the differencebetweenrequirementsrelatedtocodeexecutionandthe onesrelatedto dataprotectionnaturallycomesup.Throughthis thesis,we show that thereis a broadclassof problemscorre-spondingto eachsetof requirements.Therefore,we will clearlydistinguishthe problems of code protection from data protection.

Code Protection

We further classify the problems related to code protection (as in[BMW98]) into two categories,namelyprivacy of executionandintegrityof execution:

• Privacy of execution aims at preventing the disclosureof the codesemanticsduring its executionin a potentiallyhostile runtimeenviron-ment.This is a hardproblembecausethedisclosureof thecodeseman-tics to the runtime environment is considereda basic requirementforcode execution;

• Integrity of execution assuresthat a programexecutedon a potentiallyhostile environment actually complies with its original semantics.

We analyzethesetwo problemsin Chapters2 and3, respectively. In Chap-ters 5 and 6, we present original solutions addressing these problems.

Data Protection

Mobile or roamingagentsarea form of mobilecodeespeciallytalkedaboutin electroniccommerce,but usualdataprotectiontechniquesarenot suited

Page 27: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 9

Contributions

to the protectionof datathat changedynamicallyduring the code’s trip. Agoodexamplemight be the so-called“comparisonshopping”application,wherean agentlooks for the lowest priced shoppingitem amongseveralretailers.In this scenario,it is necessaryto know whetherthedatacollectedhasbeenchangedor not. In a distributedauctionscenario,it might alsobenecessaryto preventa hostfrom exploiting theoffersmadeby thepreviousbidders.Thesescenariosshow that there is a need for data protectionschemesoutsidethesphereof codeprotection.We focuson dataprotectionin Chapters 7 and 8.

1.3 Contributions

This thesisfocuseson problemsrelatedto mobile code protectionfrompotentiallymalicioushosts.Our contributionsmay be summarizedas fol-lows:

• We elaborateanoriginal list of requirementsimposedby theproblemofprivacy of execution in Chapter 2;

• Weintroducetheconceptof verifier in Chapter3. Thisoriginaldefinitionis more suitableto tackle the problemof integrity of executionin themobile code scenario;

• We presentan original solution to the problem of code protectioninChapter5. This solution applies to a simple model of computation(Booleanfunctions),basedon error correctingcodesandprovidespri-vacy and integrity of execution;

• We extendtheprevioussolutionto a morepowerful modelof computa-tion in Chapter6. This solutionrequiresa limited Tamper-Proof Hard-ware,like a smartcard,actingon behalfof the codeowner andlocatedneartheexecutionenvironment.A new setof requirementsis presentedas well as a solution that applies to sets of Boolean functions;

• Weintroducetheconceptof off-line verifier in Chapter6. Wedevelopanoff-line solutionwherethe verificationprocessis not performedby theTPH,but by thecodeowner. A smallcheckvaluecomputedby theTPHis transmittedto the codeowner, assuringthe integrity of executionofseveral computations;

Page 28: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

10

• We present techniquesto addressthe problem of data storage inuntrusted memory in Chapter 7;

• We presentsomeguidelinesfor the developmentof an architectureforsoftware protection in Chapter7. This architectureis original in thesense that previous proposalshad considereda trusted CPU anduntrustedmemory, while we extend the securityof a limited Tamper-Proof Hardware to the computations performed on an untrusted CPU;

• Wedevelopanew techniqueto protectthedatacollectedby mobilecoderoaming through a set of competing hosts in Chapter 8.

1.4 Structure

This thesisfocuseson theproblemof mobilecodeprotectionfrom possiblymalicioushostsasdepictedat thetop of Figure1.1.Thegeneralproblemofmobile codeprotectionfrom untrustedexecutionenvironmentsis dividedinto two sub-problems as shown in Figure 1.1:

• Code Protection;

• Data Protection.

Chapter2 describesthe problem of privacy of execution and refers torelatedwork. Privacy of executionis a hardproblemthatconsistsin hidinginformationaboutthecodewhile giving a descriptionthatallows its execu-tion. At theendof thechapter, we specifytherequirementsimposedby pri-vacy of execution.

Chapter3 focuseson theproblemof integrity of executionandit discussesexisting approachesto tackle this problem. Verifiers are defined,whichmakepossiblethedesignof moreefficientsolutionsto theproblemof integ-rity of execution.

Page 29: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 11

Structure

Figure 1.1 Scope and structure

Mobile Code

Protection

Without TPH

Chapter 5

With TPH

Chapter 6

Privacy of Exe-cution

Chapter 2

Introduction toCoding Theory

Chapter 4

Integrity ofExecution

Chapter 3

Code and DataProtection

Chapter 7

Collected DataProtection

Chapter 8

Code

Protection

Data

Protection

Host

Protection

Mobile Code

Security

Page 30: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

12

Chapter4 providesanintroductionto thecryptographictoolsusedin subse-quentchapters.Thesetoolsexploit thehardnessof someproblemsfoundincodingtheory. This chapterfocuseson thecomplexity of theproblemsusedto constructcryptosystemsbasedon codingtheory. At theend,thechapterincludes a cryptoanalysis of these systems.

Theremainingchapters(last row of blocksof Figure1.1) presentour solu-tions to the problemsstatedin the first threechapters.We further classifyour solutions to mobile code protection, as:

• Solutions that do not rely on Tamper-Proof Hardware (Chapter 5);

• Solutions that rely on it (Chapter 6).

Chapter5 presentssolutionswithout Tamper-Proof Hardware(TPH). Thischapterdefinesa framework for mobilecodeprotection.Westartby consid-eringa simpleexample,andwe presentsolutionsto generalBooleanfunc-tions afterwards. A simple model of computation based on Booleanfunctionsis adoptedin Chapter5 to illustrateoursolutionin practicalappli-cations. We extend this model in the subsequent two chapters.

Chapter6 builds solutionsusinganauxiliary trustedTPH actingon behalfof the codeowner. The trustedTPH interactswith the untrustedexecutionenvironment in order to fulfill the security requirementsof privacy andintegrity of execution.The goal is not to executethe codeon the trustedTPH, but to extend its inherentsecurity to the more powerful untrustedenvironment.The solutionstry to minimize the computationalandstoragecomplexities imposed on the trusted TPH.

The solutionsdescribedin Chapters5 and6 focuson the problemof codeexecutionexplainedin Chapters2 and3. Thesechaptersdo not addresstheproblemof dataprotection,specificallythe protectionof the dynamicdatainvolved in the computations (state).

Chapter7 focuseson the protectionof the datausedduring the computa-tions.In Chapter6 weassumedthatthelimited TPHhasenoughmemorytosecurelystoreall thevaluesinvolvedin thecomputations.In Chapter7, sev-eral solutionsare developed to addressthe protectionof data stored inuntrustedmemory. Using solutionsfor the protectionof codeexecutions

Page 31: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 13

References

andsolutionsfor thestorageof datain untrustedmemory, webuild anarchi-tecture for software protection that relies on a limited TPH.

Chapter8 addressesthe problemof collecteddataprotection.This chapterdescribesa protocol to protect data collectedby mobile agentsroamingthrougha set of potentially malicioushosts.This protocol is basedon acryptographictechniquethatassurestheintegrity of asequenceof dataseg-ments,regardlessof theorderof eachsegmentin thesequence.Theproto-col allows eachhostto updatethedatait previously submittedin a way thatis suitablefor free competitionscenariossuchascomparative shoppingordistributedauctionandfor highly dynamicenvironmentssuchasstockmar-kets.The setof hostscanbe visited several times in randomorder, andashortmessagedigestallows for theintegrity verificationof all thecollecteddata.

Chapter9 endsthis thesiswith a conclusionandsomeunansweredques-tions.

1.5 References

[BMW98] Ingrid Biehl, Bernd Meyer, and SusanneWetzel.Ensuringtheintegrity of agent-basedcomputationsby shortproofs. In Kurt RothermelandFritz Hohl, editors,Proc. of the Second International Workshop, MobileAgents 98, pages183–194,1998.Springer-VerlagLectureNotesin Com-puter Science No. 1477.

[CGH+95] David Chess,BenjaminGrosof,Colin Harrison,David Levine,Colin Parris,andGeneTsudik.Itinerantagentsfor mobilecomputing.IEEEPersonal Communication Systems, 2(5):34–49, October 1995.

[CHK97] David Chess,Colin Harrison,andAaron Kershenbaum.Mobileagents:Are they a goodidea?– update.In Mobile Object Systems: Towardsthe Programmable Internet, pages46–48.Springer-Verlag,April 1997.Lec-ture Notes in Computer Science No. 1222.

Page 32: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

14

[FPV98] Alfonso Fuggetta,GianPietroPicco,andGiovanniVigna.Under-standing code mobility. IEEE Transactionson Software Engineering,24(5):342–361, May 1998.

[GJS96]JamesGosling,Bill Joy, andGuySteele.TheJavaLanguageSpec-ification. Addison-Wesley, 1996.

[GMM98] R. Guttman, A. Moukas, and P. Maes. Agent-mediatedelec-tronic commerce: A survey. Knowledge Engineering Review, June 1998.

[Gon98] Li Gong. SecureJava class loading. IEEE Internet Computing,2(6):56–61, November- December 1998.

[HI99] DanielHagimontandLeila Ismail.A performanceevaluationof themobile agentparadigm.In Proceedingsof the Conferenceon Object-Ori-entedProgramming, Systems,LanguagesandApplications, pages306–313,Denver-USA, November 1999.

[HLPS98] Brant Hashii, Manoj Lal, Raju Pandey, andSteven Samorodin.Securingsystemsagainst external programs.IEEE Internet Computing,2(6):35–45, November-December 1998.

[JK99] WayneJansenand Tom Karygiannis.Specialpublication800-19:Mobile agentsecurity. Technicalreport,NationalInstituteof StandardsandTechnology, August 1999.

[KLO97] GünterKarjoth,Danny B. Lange,andMitsuruOshima.A securitymodelfor Aglets.IEEEInternetComputing, 1(4):68–77,July-August1997.

[KP00] GünterKarjoth and JoachimPosegga. Mobile agentsand telcos’nightmares.Annales des Télécommunications, 55(7-8):29–41, 2000.

[Kru97] Bruce Krulwich. Automating the internet:Agentsas usersurro-gates.IEEE Internet Computing, 1(4):34–38, July-August 1997.

[KT98] NeeranKarnik andAnandTripathi. Designissuesin mobile-agentprogrammingsystems.IEEE Concurrency, 43(6):52–61,July-September1998.

Page 33: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 15

References

[LMR00] Sergio Loureiro, Refik Molva, and Yves Roudier. Mobile codesecurity. In Proceedingsof ISYPAR 2000 4èmeEcole d’InformatiquedesSystèmes Parallèles et Répartis, Toulouse, France, February 2000.

[LO99] Danny LangeandMitsuru Oshima.Sevengoodreasonsfor mobileagents.Communications of the ACM, 42(3):88–89, March 1999.

[MGM99] Pattie Maes,RobertGuttman,andAlexandrosMoukas.Agentsthat buy and sell.Communications of the ACM, 42(3):81–91, March 1999.

[Nec97]GeorgeC. Necula.Proof-carryingcode.In Proceedingsof the24thACM Symposiumon Principles of ProgrammingLanguages, pages106–119, Paris, France, January 1997.

[NL98] GeorgeC. Necula and Peter Lee. Safe, untrustedagentsusingproof-carryingcode. In Giovanni Vigna, editor, Mobile Agents Security,LectureNotesin ComputerScienceN. 1419,pages61–91.Springer-Verlag,1998.

[Pic98] GianPietro Picco. Understanding, Evaluating, Formalizing, andExploiting Code Mobility. PhD thesis, Politecnico di Torino, 1998.

[RG98] Aviel RubinandDanielGeer. Mobile codesecurity. IEEE InternetComputing, 2(6):30–34, November-December 1998.

Page 34: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

16

Page 35: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

17

CHAPTER 2 Privacy of Execution

2.1 Introduction

This chapterdealswith the problemof privacy of execution.The goal ofprivacy of executionis to hide the actionsperformedby a pieceof codefrom theenvironmentthatexecutesthecode.We do not focuson theconfi-dentialityof this codewhentransmittedover thenetwork. Thereareseveralapplications where privacy of execution is important:

• Personal assistants. With the increasinguseof personalassistantsforsearchingandshoppingapplications,someonewho monitorsthe inten-tionsof theseagentscanretrievea largeamountof informationabouttheownerof theagents.In particular, theexecutionenvironmentwhereeachagentexecutesshould be consideredas a potentially malicious partyfrom which privacy violations can originate;

• Electronic Commerce - bargaining agents. It is important to hide thestrategy implicitly implementedwithin the code.In order to conductafair negotiation, eachparty’s reasoningprocessabout the negotiationshouldbekeptsecretfrom theotherparticipant.Thetypical applicationof thisscenariois ashoppingagentthatis ableto bargainonbehalfof itsowner.

Page 36: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

18

• Valuable algorithms. Privacy of executionis requiredto prevent thedis-closure of the algorithms implemented by mobile code.

Privacy of executionis not a new problem,but researchhasnot comeupwith many practicalsolutions.The emergenceof the two first applicationshas renewed the need and motivation for research on this topic.

Confidentialityof datahasbeenthoroughlystudiedand many encryptionmethodshave beenproposedto satisfy this requirement.Nevertheless,theuseof dataencryptiontechniquesto addressprivacy of executionhasto takeinto accountthat the ciphertext mustbe understoodby the executionenvi-ronmentin order to be executed.The fact that the executionenvironmentneedsfull accessto bothcodeanddatasegmentsin orderto accomplishtheexecutionhasincited someauthors[CGH+95] to hypothesizethat privacyof mobile code cannot be effectively achieved.

In this chapter, anoverview of thetechniquesdevelopedto tacklethis prob-lem is provided.This overview triesto beascomprehensive aspossibleandattemptsto cover both theoreticalandheuristicsettings.In order to betterunderstandthesetechniques,the threatsto the codeexecutionin termsofprivacy are enumerated.Then, we presentthe existing solutions to thisrequirement.At theend,a moreformal definitionof privacy of executionispresented and discussed.

2.2 Threats

Theexecutionenvironmentmaythreatentheprivacy of executionof mobilecodein severalways.Privacy of executionencompassesall theinformationtheenvironmentcanretrieve from theexecutionof thecode.Roughly, it ispossible to classify these threats as follows:

• Code interpretation. In orderto executethecode,theenvironmenthastounderstandit. Therefore,the environmentcaninspectthe codewith theobjective of disclosingthe functionsthat thecodeencompasses.Due tothe fact that sourcecodeis usually easierto understandthan machinecode,thefirst stepof this attackoftenconsistsof performingtheinverse

Page 37: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 19

Tamper-Proof Hardware

functionof a compiler. Theautomatictoolsthatimplementthis first stepare usually called de-compilers;

• Code interpolation. In this case,thecodeis regardedasa black-boxandthe analysis performed by an attacker focuses on the relationshipbetween inputs and outputs, that intrinsically defines the functionsimplementedwithin thecode.This attackis alwayspossibleif the inputand output data are in cleartext form, and its complexity basicallydepends on the complexity of the implemented functions.

Theprivacy of executionrequirementhasbeentackledin differentways,asfollows:

• Tamper-proof hardware (TPH);

• Obfuscation;

• Secure function evaluation.

In the next threesections,we analyzetheseapproachesin detail, andpro-vide references to related work.

2.3 Tamper-Proof Hardware

The useof tamper-proof hardware aiming at mobile codeprotectionwasproposedin [WSB98] and [Yee97].The approachsuggestedin [WSB98]requirescodeanddatasegmentsto be confinedto trustedexecutionenvi-ronments.In addition,providing privacy with thatapproachrequiresall thecodeto betransmittedover a privatechannel.This work focuseson imple-mentationissues,suchastheauthenticationof thecodeandits installationin the TPH.

Thesolutionin [Yee97]considersamodelwith a trustedCPUanduntrustedmemory. Thecomputationis thereforetrusted,andthesecurityconcernsareshiftedto the integrity of datastoredin untrustedmemories.Thesameset-ting is addressedin the more generalproposalfor software protectionin[GO96]. However, the latter schemeis morecompletebecauseit hidesallinformation about the software, i.e. the contentsof the memoryand thememory access pattern.

Page 38: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

20

In all solutionsreferredto so far, the computationis executedinside thetrustedTPH.Therefore,they all sharethedrawbackof thelimited capacitiesof themorepracticalandcheaperformsof Tamper-ProofHardwaresuchassmartcards.

It is not always efficient to rely on limited devices to perform complextasks. This was the starting assumptionfor the proposalsin [MKI88],[Fei93], and[Bla96] wherethe trusteddevice takesadvantageof thesupe-rior computationalpower of anuntrustedhostwithout compromisingsecu-rity. Thesesolutions focusedon the specific applicationsof public-keycryptography ([MKI88] and[Fei93]) andsymmetrickey encryption,calledRemotelyKeyed Encryption[Bla96] (afterwardsformalizedin [BFN98]).In additionto server-aidedRSAcomputation,[MKI88] providessomesolu-tionsto otherapplications,suchasmatrix multiplicationandsolvingmodu-lar equations,but all the schemespresentedin this paperweresucessfullyattacked in [PW92]. Thework presentedin [Fei93] providesa comprehen-sive and formal treatmentof host-assistedpublic-key cryptography whenseveral servers are available.

Solutionsfor host-assistedcomputationfocusingon moregeneralfunctionscanbefoundin thefield of securefunctionevaluationdiscussedlaterin thischapter. The issuespresentedin this sectionwill be revisited later, in ourdescriptionof solutionsusinglimited Tamper-ProofHardwarein chapter6and7. Onedrawbackof all approachesrelying on Tamper-ProofHardwareis theadditionalcostof theTPH itself. Furthermore,theseapproachesmustestablisha private channelbetweenthe function owner and the TPH totransmit the function in order to achieve privacy.

2.4 Obfuscation

Obfuscation,as describedin [CTL98] and [Hoh98], is a mechanismthattransformsan application into anotherapplicationwhich is functionallyidenticalbut morecomplex to understand.Functionallyidenticalmeansthatthe two applicationsare equivalent concerningthe relationshipbetweeninputsandoutputs.Therearemany obfuscatorsproposedasautomatictoolsthat encompassmostly heuristicandad-hocalgorithmsthat scramblecode

Page 39: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 21

Secure Function Evaluation

in order to renderthe codeinterpretationmore complex. A taxonomyofobfuscation techniques can be found in [CTL97].

This approachdoesnot addressinterpolationattacks.Thegoalof obfusca-tion is to render the interpretationof the code harder than learning itssemanticsby runningit. Oneof theadvantagesof this techniqueis the lowincreaseof the programsize.Its major drawbackis the lack of theoreticalfoundationsin orderto establishprecisedefinitionsof security, andaccord-ingly to be able to quantify the security of the underlying transformations.

2.5 Secure Function Evaluation

This sectionfocuseson theproblemof preservingtheprivacy of functionsexecutedon untrustedenvironmentsin a moretheoreticalway. Two partiesare involved: the function owner and the environment that executesthefunction. The executionenvironmentprovides input datato the function.Whengettingthe resultof the functionexecution,the functionownerdoesnot want to reveal information about the function.

In otherwords:Alice hasa function f andBob hasaninput x. Thefunctionevaluationtakes placein Bob’s environment,but he shouldlearn nothingsignificant about the function. Alice should learn the valuef(x).

Theproblemaddressedhereis sometimescalledcomputingwith encryptedfunctionsandcan be seenas an instanceof the more generalproblemofsecurefunction evaluation.Researchon cryptography hasaddressedthisproblemfrom differentpointsof view. Thissectionprovidesanoverview ofthesetechniquesandattemptsto analyzethemtaking themobilecodesce-nario into perspective.

Theproblemof securefunctionevaluationwasmainlyaddressedin two dif-ferent scenarios, as follows:

• Secure multi-party computation;

• Instance hiding.

Page 40: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

22

2.5.1 Secure multi-party computation

In this case,eachpartyhasoneinput to thepublic functionto beevaluated.Thegoalof eachplayeris to computetheresultof thefunctionrevealingnoinformationabouthis own data.More precisely, theinformationabouteachparty’s inputs that may be extracted from the execution of the schemeshouldbe, at most, the information that canbe retrieved from the overallresult.

This problemwasintroducedby Yaoin [Yao82]with thefamous“Million-aires’Problem”wheretwo millionaireswantto know who is richerwithoutrevealingtheirwealth.Theauthorproposedasolutionbasedontheintracta-bility assumptionof factoring.In [Yao86],a moredetailedformalizationofthe problem is presented.Later, Goldreich, Micali and Wigderson[GMW87] weakenedthe intractability assumptionto the existenceof anytrapdoorpermutationand extendedthe solutionsto the multi-party case.However, theroundcomplexity of thesolutionis at leastlinearin thedepthof the underlyingcircuit. The work of [BMR90] focusedon reducingtheroundcomplexity without significantlyincreasingthecommunicationcom-plexity, but both complexities continue to be high.

2.5.2 Instance Hiding

Theseschemeshighlight the dichotomybetweentwo partiesthat do notnecessarilytrusteachother:theownerof thedataandtheownerof thecir-cuit or executionenvironment.In thiscase,thedataowneris acomputation-ally limited player that wishesto usethe help of a powerful but untrustedplayer(calledanoracle)to computea complex function.Thelimited playerwishesto hide informationabouthis datawhile retrieving the resultof thefunction.

Thisproblemwasfirst introducedby [RAD78] in termsof "computingwithencrypteddata"(CED).Thedataownerwantsto keephis datasecretwhilethe datais storedin an untrustedhost.Moreover, the dataowner wantstoperformoperationsin the storeddatawithout having to decryptit for per-forming operationsand then re-encrypting.The authorstried to find ahomomorphicencryptionschemeE with respectto an operationop. An

Page 41: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 23

Secure Function Evaluation

encryptionschemeE is homomorphicconcerningtheoperationop if thereis anefficientoperationop’ to computeE(xopy) from E(x)andE(y), thatisE(x op y)= E(x) op’E(y).

Nevertheless,the solutions proposedby the authors were sucessfullyattacked in [BO92]. Later, [BL96] proved that all such deterministicencryption schemes are insecure.

Thesecurefunctionevaluationproblemwasalsoreferredto in thepaperbyAbadi, Feigenbaumand Kilian [AFK89], and it was called "hiding datafrom anoracle".In this case,a computationallylimited playerwantsto usethecomputationalpower of a powerful player(theoracle)but without dis-closing his data.The authorsformalized the problemof computingwithencrypteddatain thetwo-partycase.Basedon this idea,Abadi andFeigen-baum[AF90] developeda two-partyprotocolfor securecircuit evaluation,that is also similar to the protocol of [CDvdG87], and which allowed aplayerto evaluatehis dataon anotherplayer’s Booleancircuit. This proto-col preservedtheconfidentialityof thedataandalsohid thecircuit from theownerof thedata.Themajordrawbackof bothprotocolsis theroundcom-plexity betweenthe two players,which is proportionalto the depthof theBoolean circuit.

Protocolsfor computingwith encrypteddatacanbe characterizedby howthey perform the evaluation in an operation-by-operationbasis(gate-by-gatein thecaseof circuits).A naturalwayof designingtheseprotocolsis touseprivacy homomorphisms,but this hasbeenanopenresearchissuesincethe seminal paper of [RAD78].

2.5.3 Computing with encrypted functions

The problemsof securemulti-party computationandhiding instancesarecloselyrelatedto the problemof computingwith encryptedfunctions.Wemay build solutionsfor computingwith encryptedfunctionsbasedon thetwo kinds of schemesdescribedabove. In the caseof securemulti-partycomputation,if a universalcircuit is usedas the public function, then thedescriptionof the function is theprivateinput of the functionowner. Onceagain, using universal circuits, the encrypted data in instance hiding

Page 42: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

24

schemescanrepresenttheencryptedform of a circuit. Theuseof universalcircuits incursa costof a polynomialexpansion[CCKM00]. On the otherhand,a thoroughstudyaboutthecharacterizationof moregeneralfunctions(non-Boolean)thatcanbesecurelyevaluatedwasbegunin [CK91]. In gen-eral,securetwo-partycomputationis notpossiblewithoutsomecomplexityassumption, as shown in [BGW88] for the case of an OR gate.

Themajordrawbackof thesolutionsthatachievesecurefunctionevaluationis their complexity in termsof roundandcommunicationcomplexity. Oneof themainadvantagesof mobilecodeis theability to executetaskslocallyin anautonomousway, asseenin Chapter1. Autonomymeansthatthecodeis ableto performits taskswith no interactionwith thecodeowner. There-fore, non-interactivity is an importantrequirement.Next, we look at non-interactive solutions in greater detail.

Non-Interactive Solutions

Figure2.1describesthenon-interactivesettingfor providing privacy of exe-cution. There are three phases without interaction:

• The scrambling phase, wherea transformationE is applied to f. Theresulting functionE(f) should leak no information aboutf ;

• The evaluation phase, wherethefunctionE(f) is evaluatedon thedatax ;

• The result retrieval phase, wherethecleartext resultf(x) canbederivedfrom the encrypted result[E(f)](x) using a transformationD.

Sanderand Tschudin[ST98] illustrated the conceptwith a methodthatallows to computewith encryptedpolynomials,basedon the Goldwasser-Micali [GM84] probabilisticencryptionscheme.The authorstook advan-tageof the additively andmixed multiplicatively homomorphicpropertiesof the encryptionscheme.The transformationE consistsof the encryptionof thecoefficientsof thepolynomial.Thus,this techniquedoesnot hidetheskeleton of the polynomial.

Recently, [SYY99] presenteda non-interactive solution for secureevalua-tion of log-depthcircuits. The evaluation is done in a gate-by-gate basisusinga new privacy homomorphismfor processingNOT andOR gatesin a

Page 43: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 25

Secure Function Evaluation

secureway. The restriction on the depth of the circuit comesfrom theincreaseof theoutputsizeby aconstantfactorwhencomputinganORgate.

In [CCKM00], a morepowerful techniquethat combinesthe techniqueof“garbled” circuits by [Yao86] and one-roundoblivious transfers(seeforexample[Kil89]) is presented.This work extendednon-interactive securecomputations to polynomial-size circuits. Moreover, the techniqueaddressedthe multi-hop scenario,wherea mobile codemay visit several(possiblymalicious)hosts.Eachvisited hostcanuseoutputscomputedonpreviouslyvisitedhostswithout learninganythingaboutthepreviouslyusedinputs and obtained outputs.

The major drawbackof the securefunction evaluationapproachesis theircomplexity in termsof computation,communicationandrounds.This is thecost of having very strongsecuritypropertiesrelatedto cryptographicorinformation-theoreticassumptions.Thereis a panoplyof differentschemesthat fit different requirements,such as non-interactivity. However, non-interactivity is achieved with an additionalcost in termsof computationalandcommunicationcomplexity. We invite thereaderto referto [Fra93]and[Gol98] for an in-depthanalysisof the theoreticalapproachesto the prob-lem of secure function evaluation.

Figure 2.1 Non-interactive protocol for privacy of execution

f E(f)

x

y’=[E(f)](x)y=f(x)=D(y’)

E(f)

Alice Bob

E

key

D

Page 44: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

26

2.6 Requirements

In this section,we focus on a scenariowithout TPH. The requirementsimposedto solutionswith TPH will beelaboratedin chapter6. Our goal isto addressflexible modelsof computation,in anefficientway. Theoverheadbroughtupby thesecurityprimitivesmustnot rendertheuseof mobilecodeunattractive.We cannow defineanidealsetof requirementsthatshouldbeimposedon techniquesaddressingprivacy of executionin themobilecodescenario.

We considerthe samenon-interactive scenarioas depictedon Figure2.1.Theprivacy of f is assuredby thealgorithms{E, D} thatshouldsatisfythefollowing properties, stated in an informal way:

Correctness. Thereis a polynomialtime algorithmD to retrieve thedesiredresultf(x) from the obtained resulty’=[E(f)](x) ;

Privacy of execution. Theresultingfunction f ’=E(f) preservestheprivacy off if it is computationallyunfeasibleto derive f from f ’ . We noticedfromrelatedwork thatperfectprivacy is hardto achieve.Therefore,thesolutionsmay admit information leakageaboutthe function f that shouldbe mini-mized;

Remote host computational complexity. The complexity of f ’ shouldnot beincreasedby morethana polynomialfactorwhencomparedwith thecom-putational complexity of f;

Communication complexity. The communicationcomplexity shouldnot beincreasedby more than a polynomial factor when comparedwith thescheme wheref itself is transmitted and evaluated;

Round complexity. Theschemeshouldbenon-interactive,or theroundcom-plexity equalto two. Theevaluationof f ’ shouldbeperformedwithout thehelpof Alice. Additionally, algorithmsE andD shouldnot needthehelpofBob;

Privacy of data. The obtainedresulty’ shouldnot reveal moreinformationabout datax to the function owner than what the actual resulty reveals.

Page 45: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 27

Conclusion

This is anidealsetof requirementsthatwill beanalyzedduringthesecurityevaluationof oursolutionsin chapter5. Theserequirementswill beadaptedin chapter 6 to the case where Tamper-Proof Hardware is available.

2.7 Conclusion

Two main approacheshave beendevelopedto addressthe problemof pri-vacy of executionwithout Tamper-ProofHardware.On onehand,therearemorepracticalsolutionslike obfuscationwith a lack of theoreticalfounda-tions. On the other hand, there are the strongertheoreticalsolutionsofsecurefunction evaluation,that apply to more limited modelssuchascir-cuitsandthathavea largecomplexity associatedto eachbit of output.Solu-tionsfor codeprivacy againstpossiblymalicioushostsarethusstill in theirinfancy.

Our aim is to createnew solutionsthatoffer a trade-off betweenthesetwoworlds: lesscomplex andmoreflexible thansecurefunctionevaluationandstrongerin securitytermsthanobfuscation.Thesetof requirementsdefinedis hardto fulfill in a completeway. Our objective is to achieve securityincryptographic terms while reducing the complexity of the solutions.

In addition,our objective is alsoto tackletheproblemof integrity of execu-tion in anefficient way. Thefunctionownershouldhave a way of verifyingif theobtainedresultis a possibleresultof the function.Usually, the integ-rity problemis not consideredin thescenariosillustratingprivacy of execu-tion. This fact relies on the trust assumptionthat if the host cannotgetinformation about the function, then the remotehost will not be able totamperwith thefunctionin a meaningfulway. In thenext chapter, we focuson theproblemof integrity of execution.In Chapters5 and6, we will showhow to tackle privacy and integrity of execution in an efficient way.

Page 46: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

28

2.8 References

[AF90] Martín Abadi and Joan Feigenbaum.Securecircuit evaluation.Journal of Cryptology, 2(1):1–12, 1990.

[AFK89] Martín Abadi,JoanFeigenbaum,andJoeKilian. On hiding infor-mation from an oracle. Journal of Computer and SystemSciences,39(1):21–50, August 1989.

[BFN98] Matt Blaze, JoanFeigenbaum,and Moni Naor. A formal treat-mentof remotelykeyed encryption.In KaisaNyberg, editor, AdvancesinCrytology - EUROCRYPT’98, LectureNotesin ComputerScience,pages251–265, Finland, 1998. Springer-Verlag.

[BGW88] M. Ben-Or, S.Goldwasser, and A. Wigderson. Completenesstheoremsfor fault-tolerantdistributed computing.In ACM Symposiumonthe Theory of Computing 88, pages 1–10, Chicago, 1988.

[BL96] DanBonehandRichardJ. Lipton. Algorithms for black-boxfieldsandtheir applicationto cryptography (extendedabstract).In Neal Koblitz,editor, Advancesin Cryptology—CRYPTO ’96, volume 1109 of LectureNotesin ComputerScience, pages283–297.Springer-Verlag,18–22August1996.

[Bla96] Matt Blaze.High-bandwidthencryptionwith low-bandwidthsmart-cards.In DieterGrollman,editor, FastSoftware Encryption:Third Interna-tional Workshop, volume1039of LectureNotesin ComputerScience, pages33–40, Cambridge, UK, 21–23February 1996. Springer-Verlag.

[BMR90] DonaldBeaver, Silvio Micali, andPhillip Rogaway. The roundcomplexity of secureprotocols(extendedabstract).In Proceedingsof theTwentySecondAnnual ACM Symposiumon Theoryof Computing, pages503–513, Baltimore, Maryland, 14–16 May 1990.

[BO92] E.F. Brickell andA.M. Odlyzko. Cryptanalysis:A survey of recentresults, chapterContemporaryCryptology - the Scienceof InformationIntegrity, pages 501–540. IEEE Press, 1992.

Page 47: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 29

References

[CCKM00] C. Cachin,J.Camenisch,J.Kilian, andJoy Muller. One-roundsecurecomputationandsecureautonomousmobile agents.In Proceedingsof the 27th International Colloquiumon Automata,Languages and Pro-gramming-ICALP 2000, Geneva, July 2000.

[CDvdG87] David Chaum, IvanB. Damgård,and Jeroenvande Graaf.Multiparty computationsensuringprivacy of eachparty’s inputandcorrect-nessof the result. In Carl Pomerance,editor, Advancesin Cryptology—CRYPTO ’87, volume293of LectureNotesin ComputerScience, pages87–119. Springer-Verlag, 1987.

[CGH+95] David Chess,BenjaminGrosof,Colin Harrison,David Levine,Colin Paris,andGeneTsudik. Itinerantagentsfor mobilecomputing.IBMResearch Report RC 20010, IBM, March 1995.

[CK91] B. Chor and E. Kushilevitz. A zero-onelaw for Booleanprivacy.SIAM Journal of Discrete Mathematics, 4:36–47, 1991.

[CTL97] ChristianCollberg, Clark Thomborson,andDouglasLow. A tax-onomyof obfuscatingtransformations.TechnicalReport148, Departmentof Computer Sciences-The University of Auckland, July 1997.

[CTL98] ChristianCollberg, Clark Thomborson,andDouglasLow. Manu-facturingcheap,resilient,andstealthy opaqueconstructs.In PrinciplesofProgramming Languages 1998, POPL’98, San Diego, CA, January 1998.

[Fei93] JoanFeigenbaum.Locally randomreductionsin interactive com-plexity theory. DIMACS Seriesin Discrete Mathematicsand TheoreticalComputer Science, 13:73–98, 1993.

[Fra93] Matthew Keith Franklin. Complexity and Securityof DistributedProtocols. PhD thesis, Columbia University, 1993.

[GM84] ShafiGoldwasserandSilvio Micali. Probabilisticencryption.Jour-nal of Computer and System Sciences, 28(2):270–299, April 1984.

[GMW87] OdedGoldreich,Silvio Micali, andAvi Wigderson.How to playany mental game or a completenesstheoremfor protocolswith honest

Page 48: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

30

majority. In Proceedingsof the NineteenthAnnual ACM SymposiumonTheory of Computing, pages 218–229, New York City, 25–27 May 1987.

[GO96] Oded Goldreich and Rafail Ostrovsky. Software protectionandsimulationon oblivious RAMs. Journal of the ACM, 43(3):431–473,May1996.

[Gol98] OdedGoldreich.Securemulti-party computation.Working Draft,Version 1.1, 1998.

[Hoh98] Fritz Hohl. An approachto solve the problemof malicioushosts.In 4th ECOOPWorkshopon Mobility: Secure Internet Mobile Computa-tions, 1998.

[Kil89] JoeKilian. Usesof Randomnessin AlgorithmsandProtocols. PhDthesis, Massachusetts Institute of Technology, 1989.

[MKI88] T. Matsumoto,K. Kato,andH. Imai. Speedingupsecretcomputa-tionswith insecureauxiliary devices.In S.Goldwasser, editor, CRYPTO88,pages497–506.Springer-Verlag,1988.LectureNotesin ComputerScienceNo. 403.

[PW92] Birgit Pfitzmannand Michael Waidner. Attacks on protocolsforserver-aidedRSAcomputation.In R. A. Rueppel,editor, Advancesin Cryp-tology—EUROCRYPT92, volume658 of Lecture Notesin ComputerSci-ence, pages 153–162. Springer-Verlag, 24–28May 1992.

[RAD78] R. Rivest,L. Adleman,andM. Dertouzos.Ondatabanksandpri-vacy homomorphisms.In DeMillo, Dobkin, Jones,and Lipton, editors,Foundationsof Secure Computation, pages169–180.New York: AcademicPress, 1978.

[ST98] TomasSanderandChristianTschudin.Towardsmobile cryptogra-phy. In Proceedingof the 1998IEEE Symposiumon Securityand Privacy,pages 215-224 Oakland, California, May 1998.

Page 49: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 31

References

[SYY99] TomasSander, Adam Young, and Moti Yung. Non-interactivecryptocomputingfor NC1. In Proceedings of the IEEE FOCS, October1999.

[WSB98]UweG. Wilhelm, SebastianStaamann,andLeventeButtyan.Pro-tectingthe itinerary of mobile agents.In 4th ECOOP Workshop on Mobil-ity: Secure Internet Mobile Computations, 1998.

[Yao82]A.C. Yao.Protocolsfor securecomputations.In IEEE Symposiumon Foundations of Computer Science 82, pages 160–164, Chicago, 1982.

[Yao86]A.C. Yao.How to generateandexchangesecrets.In IEEE Sympo-sium on Foundations of Computer Science 86, pages162–167,Toronto,1986.

[Yee97] Bennet Yee. A sanctuaryfor mobile agents.Technical ReportCS97-537,UC at SanDiego, Dept.of ComputerScienceandEngineering,April 1997.

Page 50: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

32

Page 51: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

33

CHAPTER 3 Integrity of Execution

3.1 Introduction

As statedbefore,this thesisdealswith the protectionof mobile codefromtheexecutionenvironment,a problembroughtup by themobilecodepara-digm.In thisscenario,thereis aconflictbetweentwo sides:themobilecodeandthesecurityrequirementsof its ownerononeside,andon theothersidethe execution environment and its security requirements.We focus onmobilecodeprotectionfrom possiblymalicioushosts,namelytheproblemof integrity of execution.The owner of the mobile codeshouldbe abletoverify thecorrectnessof thecodeexecution.Ourconcernis not theintegrityof the code itself, but the integrity of its execution.

Without integrity of execution, the number of possibleapplicationsformobilecodebecomessmallerandthecomputationsarerestrictedto trustedenvironments.Thepossibilityof detectingmisbehaviors from remotehostsis also fundamental for the enforcement of control policies.

This chapter presentsa short but comprehensive survey of techniquesaddressingintegrity of execution.Then,a definition for integrity of execu-tion is given and analyzed.

Page 52: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

34

3.2 Problem Statement

Theaimof integrity of executionis to give thecodeownertheability to ver-ify thecorrectnessof theexecutionof his code.This canbedoneat theendof the agenttrip, or as suggestedin [FGS96], the codecan containstateappraisalfunctionsthat will verify the stateof the agenton eachhost thatthe agentvisits. The authorsclaimedthat an agentcanbecomemaliciouswhenits stateis tamperedwith, basedon theexampleof a shoppingagentthat searchesfor n seatson an airplane.A malicioushostcanaugmentthenumberof seatsto bereservedin orderto causebogusreservationsoncom-petinghosts.In this case,it is importantto checkthe stateof the codeateach host.

In ourcase,thecodeownerwishesto verify theintegrity of theresultsat theend of the code’s trip. The codeowner shouldbe able to detectattacksregardingthe correctnessof the codeexecutionfrom the remoteexecutionenvironments.It is possibleto classify the solutionsto this problemintofour categories, as follows:

• Proof systems;

• Traces of execution;

• Fault tolerance;

• Result checking.

Moreover, the solutionscalled securefunction evaluation schemes,pre-sentedin chapter2, alsopreventany playeror groupsof playersfrom cheat-ing. Therefore these solutions also achieve integrity of execution.Obviously, settingsrelying on tamper-proof hardwareaccomplishthis goalas well. In the next sections,we analyze in more detail the existingapproaches that deal with integrity of execution.

3.3 Proof Systems

Yee [Yee97]suggestedthe useof proof basedtechniquesto addresstheproblemof integrity of executionin the mobile codescenario.Eachhost

Page 53: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 35

Proof Systems

that executesthe mobile codehasto senda proof of the correctnessof theexecutionwith theresult.Theobjectiveof proofsystemsis to make thever-ification of the proof easier than the construction of the proof.

Definition: A languageL belongsto NP if thereexists a polynomial time

non-deterministic Turing machine V such that for all :

• implies that thereexists a sequenceof non-deterministicchoices

(or proof) , such that V on choice accepts the inputx;

• implies that there is no proof for which V will acceptx.

Proof systemshave beenextendedover the yearswith the possibility of aprobabilisticverification procedure.The resultsinclude very well knowntechniquessuchas interactive proof systemsand zero-knowledgeproofs.Thereis extensive work on proofs,seefor example[Gol99] for a compre-hensive survey.

In [BC86], theauthorsillustratedthis conceptwith a protocolwhereAlicecanconvinceBob of thegoodresultof a Booleancircuit simulation,with-out revealingher inputs,underthe QuadraticResiduesAssumption.How-ever, this protocol requiredthe knowledgeof the Booleancircuit by bothparties.Theprotocoldevelopedfor thecircuit modelentailedacommunica-tion complexity dependent on the number of wires or gates of the circuit.

In [Yee97],theauthorpointedout thepossibleuseof ProbabilisticCheck-ableProofs(PCP)[ALM+91] [AS98]. PCPproofsassurethecorrectnessofa statementwhile checkingonly a subsetof the proof. In more formalterms:

Definition: A language if thereexistsaprobabilisticpolyno-

mial time oraclemachineV, accessinga polynomialsizedoracle , such

that for all :

• implies that suchthat for all choicesof randomstrings,theverifier V acceptsx.

x 0 1,{ }n∈

x L∈

π π

x L∉ π

L PCP r q,( )∈

π

x 0 1,{ }n∈

x L∈ π∃

Page 54: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

36

• impliesthat , V rejectsx with probabilityof at least1/2 (overinternal coin flips).

Furthermore,V usesat mostr(n) coin flips for its probabilisticverification

and queries the oracle at mostq(n) times.

This conceptis similar to thedefinitionof transparentproofsintroducedin[BFLS91] and [Bab93]. With transparentproofs, the input hasto be pro-vided to theverificationprocessin anencodedform (usinga specificerrorcorrectingcode).In this way, membershipproofsfor NP maybeverifiedinpolylogarithmic time. One interestingresult is that NP=PCP(log n, 1)[ALM+91], which meansthat thereareproofsof membershipfor any NPlanguagethatcanbecheckedby examiningonly a constantnumberof bitsof the proof. However, the processof converting a proof into a PCPproofproducesa super-quadraticincreasein size [PS94].Fortunately, the sameauthorspresentedan optimization in [PS94], and probabilistic proofs ofnearly linear size were obtained.

In our case, it is important to analyze the round complexity of theseapproaches.Oneappealingideais theuseof Non-Interactive ZeroKnowl-edgeProofs [BSMP91]. Basedon somereasonablecomplexity assump-tions, one may constructnon-interactive zero-knowledgeproofs for everyNP language,but theprover andtheverifier have to interactwith a trustedrandomsequenceof bits (which canbe consideredasbeingselectedby atrusted third party [Gol99]).

PCPproofsmaybeusednon-interactively, but thesubsetof verifiedbitshasto berandomlydeterminedby theverificationprocessandtheprover hastocommit to theoverall PCPproof.This commitmentis necessaryin ordertopreventtheprover from adaptingtheproof to thequeriesbeingmade.In themobile code scenario,the use of PCP proofs in a non-interactive wayimplies that the prover shouldsendthe completePCPproof to the codeowner. Therefore,the increasedsize of PCPproofs when comparedwithnon-probabilistic proofs becomes a drawback in the mobile code scenario.

In [BMW98], the authorspresentedan interestingmodel for mobile com-puting as well as a solution that overcomesthe problem of using PCP

x L∉ π∀

π

Page 55: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 37

Traces of Execution

proofs.Theagentis modelledasaprobabilisticTuringmachine,andthesetof all possiblestatesof this machineconstitutesan NP language.So, theverificationprocessconsistsof checkingwhetheranobtainedstatebelongsto this language.In orderto avoid thetransmissionof theoverallPCPproof,the randomlychosenqueriesfrom the checker are encryptedusing non-interactive Private Information Retrieval (PIR) techniques [CGKS98][CMS99]. Theseprivatequeriesarethensentto the remotehost.In a fewwords, single databasePIR consistsof retrieving a bit from a string (thedatabase),without revealing the index of the desiredbit. Therefore,theremotehosthasonly to sendthe answersto the encryptedqueriesandnotthe complete PCP proof.

Wemayusemorepracticalandattractiveproofsystemsin which theproveris restricted in computationalterms, such as cryptographicCS-proofs[Mic94] andarguments[Kil92]. Consideringintractability assumptions,itis thenpossibleto build morecommunicationefficient proof systems.WithcryptographicCSproofs,theprogramsmaybetransformedin orderto sup-ply a very short proof which is easyto inspectin addition to the result[Mic94]. Nevertheless,it is an openproblemwhethersuchcryptographicproofscanbeconstructed,for examplefor NP. In thecaseof CS-proofsandargument systems,we need either three messagesof interaction or theassumptionof theexistenceof a randomoracle[Gol99], consequentlytheyare not really non-interactive.

Recently, [ABOR00] improved the above resultsto one-roundproofs forNP with poly-logarithmic communicationcomplexity in the lengthof theproof. The authorsextendedthe idea presentedin [BMW98] in that theyuseda combinationof PCPproofs and PIR techniques.Nevertheless,thesolution proposed in [ABOR00] achieves stronger security properties.

3.4 Traces of Execution

In a morepracticalsense,onecould think aboutstoringthe entiretraceofexecutionin the mobile code.Then,the codeowner would re-executethecodeandcompareit with thetrace.Sucha processis socumbersomethatitrenders the use of mobile code unattractive.

Page 56: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

38

A moreefficient way of implementingthis ideawasproposedin [Vig97].Firstly, the authordivided the codestatementsinto white andblack state-ments.The black statementsarethe critical onesbecausethey result frominteractionswith theenvironment.Thetraceof executionof theblackstate-mentshas to be signedand transmittedto the codeowner. Secondly, inorderto avoid the transmissionof the completetrace,the authorproposedthat the remotehostsenda hashof the trace.The hostherebycommitstothe trace.If the codeowner suspectsthat the codewasnot correctlyexe-cuted,theremotehosthasto sendthetraceto prove his correctbehavior. ATrustedThird Party may arbitrateconflictsat the momentthey occur, thusenforcinganoptimisticcontrolof integrity of execution.Thedrawbacksofthis approach are:

• Eachhosthasto keepthetracesof theexecutionsit performsin ordertoprove its innocence in case of dispute;

• Eachtime thecodeownerwantsto performa verification,hehasto re-execute the code.

In order to increasethe power of the traces,we may usethe techniquesdescribedin [KV98] wheretheauthorsusedfault injectionto simulatepos-sible malicioushostsystems.The objective is to build assertions,that willbeincludedin thecode,thereforeincreasingtheobservability of thetraces.Thetracesof executionbecomemorepowerful andanoraclemaybeauto-maticallygeneratedto checkthesetraces.Oncemore,thetraceshave to besent to the code owner in order to be verified with the help of the oracle.

3.5 Fault Tolerance

Fault toleranceapproachesarebasedon techniquesfor softwarereliability.Thedistinguishingfeatureof theseapproachesis theredundancy of execu-tions, which meansthat the resultof the computationcomesfrom the co-operation between different execution environments.

In [Rot98], theproblemof integrity of executionis mentionedin thecaseofthe protectionof a mobile agent’s itinerary. Preventing the tamperingofroutingdecisionsby theagentis not easy, if thesedecisionsareto betaken

Page 57: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 39

Result Checking

in a possiblymalicioushost.This problemis a goodillustrationof theneedfor integrity of execution.Without integrity of execution,the mobile codecanbesentwheretheexecutionenvironmentwants,ratherthanto theplaceit wassupposedto go otherwise.Theauthorproposedusinga backupagentexecutedon a trustedenvironment.This backupagentverifies the routingdecisions taken by the agent executed on a possibly malicious host.

Without recurringto previously known trustedenvironments,[MvRSS96]presentedan approachwhereseveral instancesof the samecodeare exe-cutedon differenthostsandthe right result is electedby a voting mecha-nism. The very efficient solution for voting proposedin [Nou96] can beusedif the voting procedureis performedon a trustedenvironment.Thesecurityof theschemein [MvRSS96]reliesonthefactthatabiggernumberof executionsshould occur in non-malicioushosts.Thus, the approachassumesthatattackerscannothaveaccessto all theexecutionenvironments,or thattheexecutionenvironmentsdonotcooperate.However, thismodelisnot realisticbecauseit supposesthat thereexists replicatedserversthatarenot controlled by the same entity.

3.6 Result Checking

Programresultchecking,first introducedin [Blu88] andfurther developedin [BK89], deals with the problem of software reliability. The authorsdefined a program checker in the following way:

Definition: Given a programP that shouldimplementa function f, a pro-gramchecker C aimsat catchingwith high probability that for anarbitraryinput x, . Moreover, thechecker shouldbeefficient in thesensethat its computationtime shouldbe shorter, i.e. o(T(n)), than the smallestknown computation timeT(n) for f.

The latter conditionpreventsthe checker from just re-computingthe func-tion at the given point. The methodologiesusedin programcheckingareusually linked to the algebraicpropertiesof the function, namelyrandomself-reducibility:

P x( ) f x( )≠

Page 58: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

40

Definition: A function f is k-randomself-reducibleif f(x) canbeexpressedas an efficient function of , where the are uni-

formly and randomly distributed.

A similar conceptcalledcoherentfunctionswasdefinedby [Yao90],whichallowsanadaptivechoiceof points . Theself-reducibilitypropertycanbe

usedby queryingtheprogramP on several randominputsandthencheck-ing a known relationshipbetweentheoutputs.Furthermore,resultcheckingtechniquesconsiderprogramP asa non-maliciousadversary. Resultcheck-ing aimsat achieving reliability (referto [BW97] for a survey) without tak-ing into account a possible malicious behavior from the executionenvironment.Beingresilientto a maliciousbehavior is equivalentto havinga programP thatattemptsto defeatthechecker. However, this requirementis not included in the definition of a checker.

In addition,if the programowner doesnot trust the checker, thenwe mayusewitnesses[FGY96]. In order to addressthis requirement,the programownerconstructstheanswersto thechecker in sucha way that thecheckercan infer no information about the programfrom theseanswers.For thesamereasons,witnessesdo not tackle the possiblemaliciousnessof pro-gramP.

3.7 Verifiers

We now presentthedefinitionof a new conceptmeantto addresstheprob-lem of integrity of execution.This definition is presentedin thesamenon-interactive scenario of chapter 2.

Using the samenotationasin chapter2, Alice receivesthe resulty’ of theexecutionof functionf ’ . With thisvalue,Alice shouldbeableto retrieve theresulty of the executionof the function f (usingalgorithmD) andto per-form a polynomial time verification of this result, using a verifierV.

f x1( ) f x2( ) … f xk( ), , , xi

xi

Page 59: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 41

Verifier s

Definition: Givenaprogramthatshouldimplementa functionf andconsid-ering Y as the set of all possibleoutputs of the function , with

, a verifierV satisfies the following condition:

if then .

WhereP representsa probability andthus is the error probabilityof theverifier. Additionally, as alreadystatedin chapter2, the computationandcommunicationcomplexities of transmittingandcalculatingy’ shouldnotexceedthecomplexitiesassociatedwith y by morethanapolynomialfactor.

The verifier concepthasa commonpoint with CS Proofs[Mic94] in thattheremayexist invalid proofs,but they shouldbehardto find. In short,theintegrity of executionpropertyrelieson the difficulty of finding a valuey’acceptedby theverificationprocess,thatdonotcorrespondto avalid outputy.

To ourknowledge,theverifierdefinitionis original. In spiteof beingsimilarto the checker definition [BK89], thereare two main differencesbetweenthe two definitions:

• A checker focusesonthecorrectnessof acomputationfor specificinputsxi, whereasaverifieraimsatdetectingthattheoutputis apossibleoutputof thefunction f. Thecomputationsperformedby theverifier do not relyon the knowledge of the inputxi;

• Maliciousnessof theprogram(or its executionenvironment)is not takeninto accountin thechecker definition.A checker needsthecomputationof a setof outputsof the function andchecksthe relationshipbetweentheseoutputs.A maliciousprogrammay build a setof outputsthat sat-isfy the relationship but that are not outputs of the program.

Notethata verifier only ensuresthatthecleartext resultis a possibleoutputof thefunction.However, theremotehostis ableto identify all thepossibleoutputs.

f xi( )

xi 0 1{ , } l∈

y D y'( )=( ) Y∉ P V y'( ) Accept=( ) δ<

δ

Page 60: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

42

3.8 Conclusion

Detectingwrongexecutionsof a mobilecodeis a fundamentalissuefor thesuccessof themobilecodeparadigm.We reviewedtheexisting approachesto the problem.The solutionsinspiredby software reliability techniques(fault toleranceandresultchecking)do not copewith themaliciousnessoftheexecutionenvironment.Thesolutionssatisfyingstrongersecurityprop-erties,suchasproofsandtracesof execution,suffer from their high com-plexity.

We definedthenew conceptof verifier to addresstherequirementof integ-rity of execution.We believe this conceptis moresuitablefor thedesignofefficient solutionsandfor expressingthepossiblemaliciousnessof theexe-cution environment.However, a verifier doesnot prevent re-executionsofthefunctionandselectionof thebestresult.Furthermore,it doesnotpreventattemptsto invert thefunctionin orderto retrieve aninput thatcorrespondsto adesiredoutput.However, whenintegratedwith privacy of execution,thetwo attacks mentioned above are defeated.

Briefly, averifieronly guaranteesthatit shouldbecomputationallyintracta-ble to a maliciousexecutionenvironment,to find valuesacceptedby theverifier for bogusoutputs.The implementationof verifiersshouldbe effi-cient, that is the remotehostsshouldhave a limited increasein computa-tionalandcommunicationcomplexity andtheverificationprocessshouldbeeasy.

We have searchedfor implementationsin the field of coding theory. Thegoal is to build programsthat are resilient to errorsof execution,suchasdatais resilientto errorsof transmissionwhenencodedby anerrorcorrect-ing code.

3.9 References

[ABOR00] W. Aiello, S.Bhatt,R. Ostrovsky, andS.Rajagopalan.Fastver-ification of any remoteprocedurecall: Shortwitness-indistinguishableone-roundproofsfor NP. In Proocedings of the 27th International Colloquium

Page 61: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 43

References

on Automata,Languages and Programming-ICALP2000, Geneva, July2000.

[ALM+91] Sanjeev Arora, CarstenLund, Rajeev Motwani, MadhuSudan,andMario Szegedy. Proofverificationandhardnessof approximationprob-lems.In Proc. 33rd IEEE Foundationsof ComputerScience, pages14–23,October 1991.

[AS98] Sanjeev Arora andShmuelSafra.Probabilisticcheckingof proofs:A new characterization of NP. Journal of the ACM, 45(1):70–122, 1998.

[Bab93] László Babai. Transparent(holographic)proofs. In 10th AnnualSymposiumon Theoretical Aspectsof ComputerScience, volume 665 ofLecture Notesin ComputerScience, pages525–534,Würzburg, Germany,25–27February 1993. Springer.

[BC86] GillesBrassardandClaudeCrépeau.Zero-knowledgesimulationofBoolean circuits. In A. M. Odlyzko, editor, Advancesin Cryptology—CRYPTO ’86, volume 263 of Lecture Notesin ComputerScience, pages223–233. Springer-Verlag, 1987, 11–15August 1986.

[BFLS91] László Babai, Lance Fortnow, LeonidA. Levin, and MarioSzegedy. Checkingcomputationsin polylogarithmic time. In Proceedingsof the Twenty Third Annual ACM Symposiumon Theory of Computing,pages 21–31, New Orleans, Louisiana, 6–8 May 1991.

[BK89] Manuel Blum and SampathKannan. Designing programsthatchecktheir work. In Proceedingsof theTwentyFirst AnnualACM Sympo-sium on Theoryof Computing, pages86–97,Seattle,Washington,15–17May 1989.

[Blu88] ManuelBlum. Designingprogramto checktheir work. TechnicalReport TR-88-009, InternationalComputerScienceInstitute, December1988.

[BMW98] Ingrid Biehl, Bernd Meyer, and SusanneWetzel.Ensuringtheintegrity of agent-basedcomputationsby shortproofs. In Kurt RothermelandFritz Hohl, editors,Proc.of theSecondInternationalWorkshop,Mobile

Page 62: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

44

Agents98, pages183–194,1998.Springer-VerlagLectureNotesin Com-puter Science No. 1477.

[BSMP91] ManuelBlum, Alfredo De Santis,Silvio Micali, andGiuseppePersiano.Noninteractive zero-knowledge. SIAM Journal on Computing,20(6):1084–1118, December 1991.

[BW97] Manuel Blum and Hal Wasserman.Software reliability via run-time result-checking.Journal of the ACM, 44(6):826–849, November 1997.

[CGKS98] Benny Chor, Oded Goldreich, Eyal Kushilevitz, and MadhuSudan.Private information retrieval. Journal of the ACM, 45(6):965–982,November 1998.

[CMS99] ChristianCachin,Silvio Micali, and Markus Stadler. Computa-tionally privateinformationretrieval with polylogarithmic communication.In JacquesStern,editor, Advancesin Cryptology: EUROCRYPT’99, Lec-ture Notes in Computer Science. Springer-Verlag, 1999.

[FGS96]William M. Farmer, JoshuaD. Guttman,andVipin Swarup.Secu-rity for mobileagents:Authenticationandstateappraisal.In ProceedingsoftheFourth EuropeanSymposiumon Research in ComputerSecurity, pages118–130,Rome,Italy, September1996.Springer-VerlagLectureNotesinComputer Science No. 1146.

[FGY96] Yair Frankel, PeterGemmel,andMoti Yung.Witness-basedcryp-tographicprogramcheckingandapplications(an announcement).In Pro-ceedings of the Fifteenth Annual ACM Symposiumon Principles ofDistributed Computing, page211, Philadelphia,Pennsylvania, USA, 23–26May 1996.

[Gol99] OdedGoldreich.ModernCryptography, Probabilistic ProofsandPseudorandomness. Springer, 1999.

[Kil92] JoeKilian. A note on efficient zero-knowledgeproofs and argu-ments (extendedabstract).In Proceedingsof the Twenty-Fourth AnnualACM Symposiumon the Theoryof Computing, pages723–732,Victoria,British Columbia, Canada, 4–6 May 1992.

Page 63: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 45

References

[KV98] Lora Kassaband Jeffrey M. Voas.Agent trustworthiness.In 4thECOOP Workshop on Mobility: Secure Internet Mobile Computations,1998.

[Mic94] Silvio Micali. CSProofs(extendedabstract).In IEEE Proceedingsof Foundations on Computer Science, pages 436–453, 1994.

[MvRSS96] Yaron Minsky, Robbertvan Renesse,FredB. Schneider, andScottD. Stoller. Cryptographicsupportfor fault-tolerantdistributed com-puting. In Proceedingsof the SeventhACM SIGOPSEuropeanWorkshop,pages 109–114, Connemara, Ireland, September 1996.

[Nou96] Guevara Noubir. NouvellesTechniquespour la Tolérance auxPannesBaséessur l’Algèbre desPolynômes. PhD thesis,École Polytech-nique Fédérale de Lausanne, 1996.

[PS94] Alexander Polishchuk and Daniel Spielman.Nearly-linear sizeholographicproofs. In ACM Symposiumon the Theoryof Computing94,pages 194–203, 1994.

[Rot98] Volker Roth. Securerecordingof itinerariesthroughco-operatingagents.In 4thECOOPWorkshoponMobility: Secure InternetMobileCom-putations, 1998.

[Vig97] Giovanni Vigna. Protectingmobile agentsthroughtracing.In 3rdECOOP Workshopon Mobile Object Systems, Jyvälskylä, Finland, June1997.

[Yao90]Andrew Chi-Chih Yao. Coherentfunctionsandprogramcheckers(extendedabstract).In Proceedingsof the Twenty SecondAnnual ACMSymposiumon Theoryof Computing, pages84–94,Baltimore,Maryland,14–16 May 1990.

[Yee97] Bennet Yee. A sanctuaryfor mobile agents.Technical ReportCS97-537,UC at SanDiego, Dept.of ComputerScienceandEngineering,April 1997.

Page 64: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

46

Page 65: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

47

CHAPTER 4 Introduction to CodingTheory

4.1 Introduction

This chapterfocuseson thecryptographictoolsusedto tackletheproblemsstatedin chapters2 and3. Thetoolspresentedhereareusedin thesolutionsdescribedin the following threechapters.The securityof thesesolutionsrelies on intractability assumptions found in the field of coding theory.

Codingconsistsof addingredundantinformationto thedataexchangeddur-ing a communicationin order to allow the receiver to recover the originaldataevenin thepresenceof transmissionerrors.Basically, anerrorcorrect-ing codetransformsa datablock of k symbolsinto a codedblock of n sym-bols.The n-k redundantsymbolsallow for the detectionandcorrectionoftransmission errors, if the number of error symbols is bounded.

Thecomplexity of someinstancesof codingtheoryproblemshasbeenusedto constructcryptosystemsand our solutionsalso exploit the hardnessofsuch instances.

In this chapter, we provide a brief introductionto codingtheory. We focuson linearblock codesandon thecomplexity of thedecodingprocessin thepresenceof errors. We then show how it is possibleto constructhard

Page 66: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

48

instancesof thedecodingproblem.Themostwell-known cryptosystemsaredescribed and an introduction to possible attacks is finally given.

4.2 Linear Block Codes

A q-ary linearblockcodeC of lengthn over andof dimensionk is a

linear subspace of with dimensionk.

Theelementsof thecodearecalledcodewordsandtheHammingweightwof aword is thenumberof non-nullbitsof theword.TheHammingdistance

d(a,b) between two wordsa andb in the set is defined as:

.

The minimum distanced of a codeC is equal to:

.

It is straightforwardto seethattheminimumdistanceof acodeC is equaltotheminimumnon-zeroweightcodeword of C. A linearcodewith lengthn,dimensionk andminimumdistanced is referredto asan [n,k,d] code.Theinformationrateof a codeis expressedas . Sincethe codeis a linearsubspaceof dimensionk, thereexist k linearly-independentcodewordsthatform a basisof thesubspace.Whenk independentcodewordsarethe rowsof a matrixG, G is called a generator matrix of the code.

A vectorm is encodedinto a codeword c asfollows: . A generatormatrix is in systematicform when , where is the identity

matrix and A is a matrix (| meansconcatenation).Anotherimportantmatrix in codingtheory is the parity-checkmatrix H of a code.Thismatrixhassize andit definesthecodein thefollowing way:

GF q( )

GF q( )n

0 1,{ }n

d a b,( ) 1 i n ai bi≠≤ ≤{ }=

d min d a b,( ) a b, C a b≠∧∈{ }=

k n⁄

k n×

c mG=

G Ik A( )= Ik k k×

k n k–( )×

n k–( ) n×

C c GF q( )n cHT∈ 0={ }=

Page 67: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 49

Linear Block Codes

which implies , where is the all-zero

matrix. When the generatormatrix is in systematicform , then the

parity check matrix assumesthe form . Furthermore,there isalways a polynomial time algorithm to derive G from H and vice-versa.

4.2.1 Error Correction

Consider , wherec is a codeword and is anerrorvec-

tor. Thesyndromeof v is definedby . Therefore,thesyndromeiszero if and only ifv is a codeword. Hence:

Theexpression definesn-k linearequations,with n unknowns(then bitsof thevectore). Thus,anerrorcorrectingschemeis amethodof solv-

ing then-k equations[LC83]. For examplein thebinarycase,thereare

solutions,which meansthat thereare error patternsthat result in thesamesyndrome.Then, the most probableerror patternshouldbe chosen.This pattern is the one that has minimum weight. In other words, thereceived vector should be decoded to the nearest codeword.

Onecanshow thatif acodehasminimumdistance , thenthereisonly oneerrorpatternsatisfyingthen-k equationsandhaving weight infe-rior or equalto t. Therefore,the codeis capableof correctingall the errorpatternsof t or fewererrors.Let c andv bethetransmittedcodewordandthereceivedvectorrespectively. Let w beany othercodeword in C. TheHam-ming distances satisfy the triangle inequality:

Let us supposethat an error patternof t’ errorsoccurs.Thenand since , the following inequality is obtained:

GHT 0k n k–,= 0k n k–, k n k–( )×

I k A( )

AT I n k–( )

v c e+= e GF q( )n∈

s vHT=

s vHT cHT eHT+ eHT= = =

s eHT=

2k

2k

d 2t 1+=

d c v,( ) d w v,( )+ d c w,( )≥

d c v,( ) t'=

d c w,( ) d 2t 1+≥ ≥

Page 68: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

50

.

If , then . If anerrorpatternof t or fewer errorsoccurs,thereceived vector v is closer to the transmittedcodeword c than any othercodeword w in C. Thus, the value t representsthe maximumnumberoferrors the code can correct.

4.3 Complexity

In their seminalpaper, Berlekamp,McEliece and van Tilborg [BMvT78]provedthatthefollowing problem,statedin thestyleof [GS79],is NP-com-plete:

Problem: Maximum-Likelihood Decoding

Instance: Let H bea binarymatrix,s abinaryvectorof lengthm andp a nonnegative integer.

Question: Is therea binary vector x of length n, suchthat and?

This problemwasoriginally termedCosetWeightsin [BMvT78] andsyn-drome decoding in [Ste93] but we use the denominationproposedin[Var97]. This problemis more generalthan the one relevant to decodingbecauseit is not statedthat the matrix hasmaximumrank. However, thisdoesnotaffectNP-completeness[BMvT78]. Theproblemstatedin termsofthe generatingmatrix G insteadof the parity checkmatrix H is also NP-complete [BMvT78]. This problem was called G-SyndromeDecoding[Ver95a]:

Problem: G-Syndrome Decoding

Instance: Let G bea binarymatrix,y a binaryvectorof sizen andpan integer.

d w v,( ) 2t 1 t'–+≥

t' t≤ d w v,( ) t>

m n×

xHT s=

w x( ) p≤

n k×

Page 69: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 51

Complexity

Question: Is there a binary vector x of size k, and a vector e with

, such that ?

NP-completenessensuresthat there is no polynomial time algorithm forsolving the problemin the worst case.However, many NP-completeprob-lemscanbe attacked after a preprocessingphase.Namely the beforehandknowledgeof theparity checkmatrix canbeused,but [BN90] showedthattheproblemremainscomplex evenwith a largeamountof preprocessingonthe matrix. Furthermore,the possibility of approximatingthe problemwasalso proven to be hard [ABSS97].

Nevertheless,theremayexist easyinstancesof theproblem.In thesectionon cryptanalysis,we will focus on this particularproblem.The decisionproblemsmentionedabove are connectedto the optimizationproblemofcomplete decoding:

Problem: Givena matrix G of rankk anda vectorx of sizen, find a

vectorm of sizek such that is minimum.

Thisproblemis NP-hard.However, instancesusedin cryptosystemsmaybeattacked with algorithmsfor decodingup to a given bound,as describedlater in this chapter. This problemis called BoundedDistanceDecoding[Var97], and it is not necessarily NP-hard [Can96][vT94].

Recently, [Var97] proved that the Minimum Distanceproblemis alsoNP-complete. To end this section, we state the Minimum Distance problem:

Problem: Minimum Distance

Instance: Let H be a binary matrix, andp a nonnegative integer.

Question: Is there a binary non-zero vector x of length n, such that

and ?

The author[Var97] (agreeingwith [Bar97]) conjecturedthat the BoundedDistance Decoding is also NP-hard.

w e( ) p≤ xG e+ y=

k n×d x mG,( )

m n×

xHT 0= w x( ) p≤

Page 70: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

52

4.4 Cryptosystems

Cryptosystemsbasedoncodingtheorytakeadvantageof thehardnessof theproblemsmentionedabove. Next, the specificimplementationsin termsofpublic key cryptosystemsaredescribedandanalyzed,namelytheMcEliece[McE78] andNiederreiter[Nie86] cryptosystems.Gabidulin[GPT91]alsoproposeda public key cryptosystemusingrank distancecodes.The cryp-toanalysisof systemsusing rank distancecodescan be found in [CS96],[Gib95a],and[Gib96] but ourdiscussionwill berestrictedto Hammingdis-tance codes.

Oneof the major obstaclesto the widespreaduseof the above cryptosys-temsis certainlythe impossibilityof performingdigital signatures.Severalimplementationshave beenproposedbut they do not withstandcryptanaly-sis.It is currentlybelieved[Ste94][vT94]thatsuchaschemewill behardtofind.

Secret-key variantsof the McEliece schemeappearedin [Jor81], [RN86]and[HR89] just to cite a few. Basically, they arevery similar to thepublickey versionsbut thecodesusedaresmaller. A descriptionandcryptanalysisof theseschemescanbefoundin [vT94]. We will revisit thesekind of sys-tems later in this chapter.

Someidentificationschemesthat take advantageof theseproblemswerealsoproposed,for examplein [Gir90], [Ste93](formalizedin [Ste96]),and[Ver95a].They have interestingpropertiesincluding zero-knowledge butthe major drawback is their communicationcomplexity. Veron [Ver95b]studied the optimization of this kind of authenticationschemesand heachievedvery interestingresults,including thepossibilityof an implemen-tation on a very limited device such as a smartcard.

4.4.1 The McEliece Public-Key Cryptosystem

Let bea q-ary linear code.Let bea generatormatrix ofthecode for whichanefficientdecodingalgorithmexists.Theencryption

matrix is , where is a random invertible matrix over

and is a random permutation matrix.

C n k d, ,[ ] G k n×C

E SGP= S k k×GF q( ) P n n×

Page 71: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 53

Cryptosystems

Encryption: A plaintext messagerepresentedby the vector is

encryptedinto the ciphertext by , wheree is a ran-domly chosen error vector that belongs to the set:

.

Decryption: A ciphertext y is decryptedby , and is

decodedwith thedecodingalgorithmof to retrieve ( is correct-

able since ). The plaintext is then obtained by

.

Keys: Thepublic key is thematrix and . Thesecretkey consistsofthe matrices and , and of the decoding algorithm for the code.

4.4.2 The Niederreiter Public-key Cryptosystem

Let be a q-ary linear code.Let be a parity checkmatrix of thecode for which anefficient decodingalgorithmexists.The

encryption matrix is , where is a random

invertible matrix over and is a random permutation matrix.

Encryption: A plaintext messagerepresentedby thevector hasto satisfythecondition: . Themessageis encryptedinto the

ciphertext by .

Decryption: A ciphertext y is decryptedby . Next, isobtainedby applyingthedecodingalgorithmof . Theplaintext is then

easily obtained: .

Keys: Thepublic key is and . Thesecretkey consistsof thematricesand , and of the decoding algorithm for.

x GF q( )k∈

y GF q( )n∈ y xE e+=

e GF q( )n w e( )∈ d 1–( ) 2⁄={ }

yP 1– xSG eP 1–+= yP 1–

C xS eP 1–

w eP 1–( ) w e( )= x

x xS( )S 1–=

E w e( )S P C

C n k d, ,[ ] H n k–( ) n×C

E SHP= S n k–( ) n k–( )×GF q( ) P n n×

x GF q( )n∈w x( ) d 1–( )≤ 2⁄

y GF q( )n k–∈ y xET=

y ST( )1–

xPT HT= xPT

C x

x xPT( )P=

E d S

P C

Page 72: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

54

The McEliece schemeuses a generatormatrix while the Niederreiterschemeusesaparity-checkmatrix,but they wereprovento beequivalentintermsof securityfor thesamecode[LDW94]. Thecodeinitially proposedby Niederreiterwastoo smallandthis versionwasbrokenin [BO92]. Nev-ertheless,for the samecode,the Niederreitercryptosystemrevealssomeadvantagesin termsof sizeof the public key, the numberof operationstoencryptandthetransmissionrate[CC98].On theotherhand,theMcElieceschemeis easierto usebecauseit doesnot put any restrictionon theweightof the message.Moreover the complexity of the decryptionalgorithm islower [CC98].

In comparisonwith theRSA public key cryptosystem,thedisadvantagesofcodingtheorybasedcryptosystemsarethe lack of a signaturescheme,thesizeof thepublic key andthetransmissionrate.However, theoperationsofencryptionanddecryptionaremuchfaster(see[Can96]for a detailedanal-ysis).

4.5 Cryptanalysis

Generallyspeaking,thesecretkey to this kind of cryptosystemsis thecodeitself, for which an efficient decodingalgorithm is known, and the publickey is a transformationof the generatoror parity-checkmatrices.In otherwords, the efficient decodingalgorithm is the trapdoorto the public keytransformation. There are two main attacks:

• Retrieving the secret code from the public code;

• Finding an efficient algorithm to decode the public code.

4.5.1 Retrieving the Secret Code

This first attackdependson the classof codesusedin the instanceof thecryptosystem. We focus on the McEliece scheme, which uses Goppa codes.

The complexity of the brute force attackon the original McEliece publickey cryptosystemcan be measuredby searchingexhaustively for all the

possiblecombinationsof permutations(n!), Goppacodes(~2mt / t, with

Page 73: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 55

Cryptanalysis

m=logn), andinvertiblematrices(~0.29*2k^2)[MS77]. Using thecodesizeproposedby McEliece([1024,524,50]), this attackis obviously not feasi-ble [Til88].

Theotherpossibilityis to explorethecharacteristicsof thecodetransforma-tion in order to identify its building blocks.The hardnessof identifying aGoppa code from a permutation has been thoroughly analyzed.

Heiman[Hei87] wasthefirst to studythis attackandstatedthattherandommatrix S usedin the original McElieceschemeservesno securitypurposeconcerningtheprotectionof thecode,becauseit doesnot changethecode-words of the original code.However, Canteaut[Can96] showed that thematrix S may be importantto hide the systematicstructureof the Goppacode therefore having an important security role. Adams and Meijer[AM87] showed that the likelihood of identifying a Goppacodeis smalland that thereis usually only one trapdoorto a given public code.Later,[Gib91] challengedthis resultandproved thateachpermutationappliedtoGoppacodescanbe regardedasa possibletrapdoorandthereareat leastm.n.(n-1) trapdoors.This resultsfrom the fact that non-equivalent Goppapolynomialscangeneratepermutedequivalentcodes.However, thenumberof trapdoorsis very small when comparedwith the n! possiblepermuta-tions.The numberof trapdoorsis still openfor large codes,but calculatedlower bounds[Gib95b] showed that an exhaustive searchremainsunfeasi-ble.

Furthermore,therewereefforts to find anefficient algorithmto retrieve thecharacteristicsof thecodefrom apermutedcoderepresentedby thegenera-tor or parity checkmatrix using techniquesthat try to identify invariantsamongtheclassesof codes[Sen94].However, theresultswerenegative forthe caseof Goppa Codes.There is currently no efficient algorithm toretrieve the characteristicsof a codefrom a permutedgeneratormatrix forGoppa Codes [CS98].

4.5.2 Finding a Decoding Algorithm

In spiteof beingconjecturedasNP-hard[Bar97][Var97],many probabilis-tic algorithmshave beendevelopedto tackletheproblemof BoundedDis-

Page 74: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

56

tanceDecoding.The better known algorithms include the onesof Lee-Brickell [LB88], Leon [Leo88], Stern [Ste89] and Canteaut-Chabaud[CC98].

We referthereaderto [Cha96],[vT94] and[Can96]in orderto have a moredetailedview of their possibleimplementationsand actualperformances.Nevertheless,their runningtime increasesexponentiallywith the lengthofthecode.In practicalterms,thementionedalgorithmsareefficient to solvetheproblemfor small codesandfor errorswith low weight,but theproba-bility of successis negligible for large codes(n>1024 [CS98]) when theweight of errors is close to the maximum correction capability of a code.

4.5.3 Classes of Codes

Thesecurityof thecryptosystemis highly dependenton theclassof codesused,especiallyconcerningthe complexity of the first attack,describedinsection4.5.1.Someclassesof codesreveal their characteristicsevenwhenthey go through the permutation used to construct the public key.

Niederreiter’s initial proposalusedconcatenatedcodes,which wereprovento be insecure[Sen94].Reed-Solomoncodeswerealsoproven to be inse-cure [SS92]. McEliece proposedGoppacodesthat proved to be secure.Nevertheless,Goppacodesgeneratedby a Goppapolynomialwith binarycoefficients are also insecure [Loi98].

Thepropertiesthata codeshouldhave in orderto beaneligible candidatefor thesecryptosystems,which resultfrom theexperiencegainedfrom suc-cessfulattacksagainstthiskind of cryptosystems,arethefollowing [CC98]:

• Thetypeof codesmustbe largeenoughto avoid any enumeration,whichis importantto defeata bruteforceattack.This attackcanuseSendrier’salgorithm[Sen97]thatdeterminesif codesareequivalentgiventwo gen-eratormatrices.If the answeris positive, then the permutationcan beretrieved.In brief, equivalencemeansthatonematrix is apermutationoftheother, becausematrix S doesnot changethecode,but only performsa modification on the basis of the linear subspace;

• An efficient decodingalgorithm shouldexist for this classin order tobuild efficient systems;

Page 75: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 57

Cryptanalysis

• The generatoror parity-checkmatrix of a transformationof the codemust not give any information aboutthe characteristicsof the codeinorder to be resilient to the attack described in section 4.5.1.

If the classof codesfulfills theserequirements,as in the caseof Goppacodes,thenthesecurityof thecryptosystemis equivalentto theproblemofbounded distance decoding any linear code [CS98].

Goppa Codes

This is themostinterestingsubclassof alternantcodes.Concretely, Goppacodesresultfrom therestrictionto GF(q) of theGeneralizedReed-Solomon(GRS) codes[MS77]. Goppacodesare specifiedin termsof a generatorpolynomial g(z), called a Goppa polynomial, with coefficients from

. An importantpropertyis thattheminimumdistanceis easilyesti-

mated: . Let be a subsetof ,

suchthat . L is calledthesupportof thecode.TheGoppa

code consists of all vectors satisfying:

In the binary case,if g(z) is irreducible(consider ) thenthe parameters are:

, and .

Thereareapproximately2mt / t differentirreduciblebinarypolynomialsof

degreet over . A differentGoppacodecorrespondsto eachpolyno-mial. The decodingof Goppacodewordscanbe doneusing the extendedEuclideanalgorithm (seefor example[Sen91])or the Berlekamp-Masseyalgorithm(seefor example[Bla83]).For moreinformationonGoppaCodes,see [MS77].

GF q( )m

d degree g z( )( ) 1+≥ L α1 … αn, ,{ }= GF q( )n

g αi( ) 0 0 i n≤<,≠

Γ L g,( ) C i GF q( )∈ n

C i

z αi–-------------

i 1=

n

∑ 0mod g z( )( )=

degree g z( )( ) t=

d 2t 1+≥ n 2m= k n mt–=

GF 2( )m

Page 76: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

58

Without lossof generality, we focuson binarycodes,becausethey aresuit-ablefor tacklingBooleanfunctions,but thetechniquecanbeusedfor alge-braic functions,wherethe elementsaredefinedin GF(q).This implies theuseof q-aryGoppacodesandthesecurityanalysisof thiskind of codescanbe found in [JM96].

4.5.4 Linearity

In thecaseof theMcEliececryptosystem,thereis oneweaknessdueto thelinearity of thecodes,aswell asthenon-deterministicnatureof thesystem.Non-deterministicmeansthat oneplaintext resultswith strongprobabilityin two differentplaintexts.Furthermore,theerrorvectorsdonotcompletelyhidethelinearity of thetransformationdueto their smallHammingweight.Therefore,it is possibleto easilyidentify that two ciphertexts result

from thesameplaintext becausethedistance will besmall(inferior

to 2t).

In thecaseof public key cryptosystems,this attackis describedin [Can96]and [Ber97] and it allows the plaintext to be recoveredwhen the attackergetstwo or moreciphertexts correspondingto thesameplaintext (with highprobabilitytheciphertexts usedifferenterrorvectors).In orderto avoid thisattack, several techniques were suggested:

• Introducingrandomnessasproposedin [BR94]. For example,[Sun98]proposedto changethe encryptionalgorithm to: ,whereh is acollision freehashfunction.Theciphertext y is decryptedby

decoding , which gives e and . The plaintext is

obtained by applying and then addingh(e) to the result;

• Using patterns of errors with higher weight [Loi00].

4.5.5 Secret Key Cryptosystems

The secret-key variants of the McEliece scheme(for example [Jor81],[RN86] and[HR89]) aresimilar but the codeusedis kept secret,thusthelength of the codes used can be made smaller.

yi y j,( )

d yi y j,( )

y x h e( )+( )E e+=

yP 1– x h e( )+( )S x

S 1–

Page 77: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 59

Cryptanalysis

The securityof suchschemesrelieson the secrecy of the code.Therefore,the hardnessof the problem of disclosingthe secretcode from a set ofciphertexts is furtheranalyzed.Eachciphertext is acodewordwith errors.Inanothercontext this problemwas called the Maximum Likelihood CodeRecognition Problem [Val99].

Maximum Likelihood Code Recognition

Imagineaneavesdroppercatchingseveralencodedmessageswith errorsbutwithout knowing theerrorcorrectingcodeused.Thegoal is to performtherecognitionof thecode.This problemwasreducedto thedecisionproblemof Rank Reduction, which was proved to be NP-complete [Val99]:

Problem: Decision Rank Reduction

Instance: Let Y bean matrix formedby N wordsof lengthn andk, pnonnegative integers.

Question: Is therea matrix E satisfying and ?WheretheHammingweightof a matrix denotesthenumberof its non-nullelements.

In the samepaper, a probabilisticalgorithm to addressthe problemwasdevised,but its probabilityof successdecreasesheavily with theHammingweight of the matrix E, beingnegligible for morethana few errorsin theoverall matrix.

Linearity

Thelinearity of thecodecanbeexploitedto obtainmoreefficient solutionsto thecoderecognitionproblem.This factis usedon theattacksto symmet-ric key cryptosystemsbasedon the McElieceschemecalledMajority Vot-ing andits extensions[MvT91] [SvT87],whosegoalis to recover thesecretcode from the knowledge of several ciphertext values.

Dueto thesmallweightof theerrorvectorsandwith severalciphertexts ofthe sameplaintext, it is possibleto determinethe codeword corresponding

N n×

rank Y E+( ) k= w E( ) p≤

Page 78: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

60

to theplaintext with high probability. By applyingthis techniquea numberof timesequivalentto thedimensionof thecode,it is possibleto retrieve thesecretcode.The probability of successof this attackdependson gettingahigh number l of different ciphertexts for eachplaintext. Moreover, thisprobability decreasesexponentially with the length of the code,and theattackhasa work factorof O(knl). Hence,theattackis only anobstacletotheuseof smallcodes.For largecodes,theattackis unfeasibleunlessmoreinformation about the error patterns can be obtained.

In thecaseof secretkey cryptosystems,in additionto thesolutionsthatusehigherweighterrorpatternsto breakthelinearity of thesystem[Loi00], wecanaswell usepatternof errorsin adifferentcosetsuchasin [RN86]. Bothalternativescandefeatthemajority voting attacksfor recovering thesecretcode.

4.6 Conclusion

Thischapterreviewedsomehardproblemsbroughtupby codingtheoryandit analyzedtheir usein cryptography. We showed that after thoroughstud-ies,cryptosystemsbasedon codingtheoryappearasanalternative to cryp-tography basedon numbertheory. We shouldemphasizethe high level ofefficiency of these cryptosystems.

Cryptanalysisrevealedsomeweaknessesof the existing systemsthat haveto betakeninto accountwhendesigningprotocolsbasedonthesameintrac-tability assumptions.Our solutionspresentedin thenext threechapterstakeadvantage of the security properties revealed in this chapter.

4.7 References

[ABSS97] Sanjeev Arora, László Babai, JacquesStern,and Z. Sweedyk.Thehardnessof approximateoptimain lattices,codes,andsystemsof linearequations.Journal of Computer and System Sciences, 54(2):317–331,April1997.

Page 79: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 61

References

[AM87] CarlisleM. Adamsand Henk Meijer. Security-relatedcommentsregardingMcEliece’s public-key cryptosystem.In Carl Pomerance,editor,Advancesin Cryptology—CRYPTO ’87, volume 293 of Lecture NotesinComputerScience, pages224–228,Universityof California,SantaBarbara,16–20August 1987. Springer-Verlag.

[Bar97] A. Barg. Complexity issuesin coding theory. Technical ReportTR97-046, Electronic Colloquium on Computational Complexity, 1997.

[Ber97] ThomasA. Berson.Failure of the McEliecepublic-key cryptosys-tem under message-resendand related-messageattack. In BurtonS.Kaliski Jr., editor, Advancesin Cryptology—CRYPTO ’97, volume1294ofLecture Notesin ComputerScience, pages213–220.Springer-Verlag,17–21August 1997.

[Bla83] RichardE. Blahut. Theoryand Practice of Error Control Codes.Addison-Wesley, 1983.

[BMvT78] E. Berlekamp,R. McEliece,andH. vanTilborg. On theinherentintractabilityof certaincodingproblems.IEEE Trans.InformationTheory,IT-24(3):384–386, May 1978.

[BN90] JehoshuaBruck andMoni Naor. The hardnessof decodinglinearcodes with preprocessing.IEEE Transactionson Information Theory,36(2):381–385, March 1990.

[BO92] E.F. Brickell andA.M. Odlyzko. Cryptanalysis:A survey of recentresults, chapterContemporaryCryptology - the Scienceof InformationIntegrity, pages 501–540. IEEE Press, 1992.

[BR94] Mihir Bellare and Phillip Rogaway. Optimal asymmetricencryp-tion. In Alfredo De Santis, editor, Advances in Cryptology—EUROCRYPT94, volume950of LectureNotesin ComputerScience, pages92–111. Springer-Verlag, 1995, 9–12May 1994.

[Can96] Anne Canteaut.Attaquesde Cryptosystèmesà Mots de PoidsFaible et Constructionde Fonctionst-Résilientes. PhD thesis,UniversitéParis VI, October 1996.

Page 80: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

62

[CC98] A. Canteautand F. Chabaud.A new algorithm for finding mini-mum-weightwords in a linear code:applicationto McEliece’s cryptosys-tem andto narrow-senseBCH codesof length511. IEEE TransactionsonInformation Theory, 1998.

[Cha96]F. Chabaud.Recherche de performancedansl’algorithmique descorps finis. Applicationsà la cryptographie. PhD thesis,École Polytech-nique, 1996.

[CS96] F. Chabaudand J.Stern. The cryptographicsecurity of the syn-drome decodingproblem for rank distancecodes.In Kwangjo Kim andTsutomuMatsumoto,editors,Advancesin Cryptology—ASIACRYPT’96,volume 1163 of Lecture Notes in Computer Science, pages368–381,Kyongju, Korea, 3–7November 1996. Springer-Verlag.

[CS98]A. CanteautandN. Sendrier. Cryptanalysisof theoriginalMcEliececryptosystem.In Advancesin Cryptology - ASIACRYPT’98, LectureNotesin Computer Science. Springer-Verlag, 1998.

[Gib91] J.K. Gibson.EquivalentGoppacodesandtrapdoorsto McEliece’spublickey cryptosystem.In D. W. Davies,editor, Advancesin Cryptology—EUROCRYPT91, volume547of LectureNotesin ComputerScience, pages517–521. Springer-Verlag, 8–11April 1991.

[Gib95a]J.K. Gibson.SeverelydentingtheGabidulinversionof theMcE-liecepublic key cryptosystem.Designs,CodesandCryptography, 6(1):37–45, July 1995.

[Gib95b] Keith Gibson.Algebraic CodedCryptosystems. PhD thesis,Uni-versity of London- Royal Holloway and Bedford New College, 1995.

[Gib96] Keith Gibson.Thesecurityof theGabidulinpublic key cryptosys-tem. In Ueli Maurer, editor, Advancesin Cryptology—EUROCRYPT96,volume 1070 of Lecture Notes in Computer Science, pages212–223.Springer-Verlag, 12–16May 1996.

[Gir90] Marc Girault. A (non-practical)three-passidentificationprotocolusing coding theory. In J.Seberryand J.Pieprzyk, editors, Advancesin

Page 81: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 63

References

Cryptology—AUSCRYPT’90, volume 453 of Lecture Notesin ComputerScience, pages265–272,Sydney, Australia,8–11January1990.Springer-Verlag.

[GPT91] E. M. Gabidulin, A. V. Paramonov, and O. V. Tretjakov. Idealsoveranon-commutativering andtheirapplicationin cryptography. In D. W.Davies,editor, Advancesin Cryptology—EUROCRYPT91, volume547 ofLecture Notes in ComputerScience, pages482–489,Brighton, UK, 8–11April 1991. Springer-Verlag.

[GS79] M. R. Garey and D. S.Johnson.Computers and Intractability: AGuide to the Theory of NP-Completness. San FranciscoCA, Freeman,1979.

[Hei87] R. Heiman.On the securityof cryptosystemsbasedon error cor-rectingcodes.Master’s thesis,Feinberg GraduateSchoolof the WeizmanInstitute of Science, 1987.

[HR89] Tzonelih Hwang and T. R. N. Rao. Private-key algebraic-codecryptosystemswith high information rates (extended abstract).In J.-J.Quisquater and J.Vandewalle, editors, Advances in Cryptology—EUROCRYPT89, volume434of LectureNotesin ComputerScience, pages657–661. Springer-Verlag, 1990, 10–13April 1989.

[JM96] HeeralalJanwa andOscarMoreno.McEliecepublic key cryptosys-temsusingalgebraic-geometriccodes.Designs,Codesand Cryptography,8(3):293–307, June 1996.

[Jor81] JohnP. Jordan.A variant of a public key cryptosystembasedonGoppacodes.In Allen Gersho,editor, Advancesin Cryptology: A ReportonCRYPTO 81, pages25–30.Departmentof Electrical and ComputerEngi-neering, U.C. Santa Barbara, 24–26August 1981.

[LB88] P. J.LeeandE. F. Brickell. An observationon thesecurityof McE-liece’s public-key cryptosystem.In ChristophG. Günther, editor, Advancesin Cryptology—EUROCRYPT88, volume 330 of Lecture Notesin Com-puter Science, pages 275–280. Springer-Verlag, 25–27May 1988.

Page 82: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

64

[LC83] ShuLin andDanielCostello.Error Control Coding:Fundamentalsand Applications. Prentice-Hall, 1983.

[LDW94] YuanXing Li, RobertH. Deng, and Xin Mei Wang. On theequivalenceof McEliece’s and Niederreiter’s public key cryptosystems.IEEE Trans. on Information Theory, 40(1):271–273, January 1994.

[Leo88] J.S. Leon. A probabilistic algorithm for computing minimumweightsof largeerror-correctingcodes.IEEETrans.onInformationTheory,34(5):1354–1359, 1988.

[Loi98] P. Loidreau.Someweak keys in McEliece public-key cryptosys-tem. In IEEE International Symposiumon Information Theory, ISIT’98,Boston, USA, 1998.

[Loi00] PierreLoidreau.Large weight patternsdecodingin Goppacodesand application to cryptography. In IEEE International SymposiumonInformation Theory, ISIT 2000, Sorento, Italy, 2000.

[McE78] R. McEliece.A public-key cryptosystembasedon algebraiccod-ing theory. In Jet Propulsion Lab. DSN Progress Report, 1978.

[MS77] F. MacWilliams and N. Sloane.The Theory of Error-CorrectingCodes. North-Holland, 1977.

[MvT91] JoostMeijers and Johanvan Tilburg. Extendedmajority votingand private-key algebraic-codeencryptions.In Hideki Imai, RonaldL.Rivest, and Tsutomu Matsumoto, editors, Advances in Cryptology—ASIACRYPT’91, volume739of Lecture Notesin ComputerScience, pages288–298, Fujiyoshida, Japan, 11–14November 1991. Springer-Verlag.Published 1993.

[Nie86] H. Niederreiter. Knapsack-typecryptosystemsandalgebraiccodingtheory. Problems of Control and Information Theory, 15(2):159–166, 1986.

[RN86] T. R. N. RaoandKil-Hyun Nam.Private-key algebraic-codedcryp-tosystems. In A. M. Odlyzko, editor, Advances in Cryptology—

Page 83: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 65

References

CRYPTO ’86, volume263of LectureNotesin ComputerScience, pages35–48. Springer-Verlag, 1987, 11–15August 1986.

[Sen91]NicolasSendrier. CodesCorrecteurs d’Erreurs à Haut Pouvoir deCorrection. PhD thesis, Université Paris VI, December 1991.

[Sen94]NicolasSendrier. On thestructureof a randomlypermutedconcat-enatedcode.In EUROCODE94, pages169–173,Abbayedela BussièresurOuche, France, October 1994.

[Sen97] Nicolas Sendrier. Finding the permutationbetweenequivalentbinary code. In IEEE Symposiumon Information Theory ISIT’97, Ulm,Germany, June 1997.

[SS92]V. Sidelnikov andS.Shestakov. Oncryptosystemsbasedongeneral-ized Reed-Solomon codes.Diskretnaya Math, 4:57–63, 1992.

[Ste89] J.Stern. A method for finding codewords of small weight. InG. CohenandJ.Wolfmann,editors,CodingTheoryandApplications, num-ber 388 in LectureNotesin ComputerScience,pages106–113.Springer-Verlag, 1989.

[Ste93] JacquesStern.A new identification schemebasedon syndromedecoding. In DouglasR. Stinson, editor, Advances in Cryptology—CRYPTO ’93, volume773of LectureNotesin ComputerScience, pages13–21. Springer-Verlag, 22–26August 1993.

[Ste94]JacquesStern.Canonedesigna signatureschemebasedon error-correctingcodes?In JosefPieprzyk and ReihanahSafavi-Naini, editors,Advancesin Cryptology—ASIACRYPT’94, volume917of Lecture NotesinComputerScience, pages424–426,Wollongong,Australia,28November–1 December 1994. Springer-Verlag.

[Ste96]J.Stern.A new paradigmfor public key identification.IEEE Trans-actions on Information Theory, 42(6):1757–1768, November 1996.

[SvT87] RenéStruik andJohanvanTilburg. TheRao-Namschemeis inse-cureagainsta chosen-plaintext attack.In Carl Pomerance,editor, Advances

Page 84: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

66

in Cryptology—CRYPTO ’87, volume 293 of Lecture Notesin ComputerScience, pages 445–457. Springer-Verlag, 1988, 16–20August 1987.

[Til88] H.C.A. van Tilborg. An Introduction to Cryptology. Kluwer Aca-demic Publishers, Boston, 1988.

[Val99] A. Valembois.Recognitionof binary linear codesas vector-sub-spaces.In Workshopon Coding and Cryptography’99,Bookof abstracts,pages 43–51, Paris, France, January 1999.

[Var97]AlexanderVardy. Theintractabilityof computingtheminimumdis-tanceof a code. IEEE Transactionson Information Theory, 43(6):1757–1766, November 1997.

[Ver95a] P. Veron. A fast identification scheme.In IEEE SymposiumonInformation Theory, Canada, 1995.

[Ver95b] P. Veron. ProblèmeSD, Opérateur Trace, Schémasd’Identifica-tion et Codes de Goppa. PhD thesis, Université de Toulon et du Var, 1995.

[vT94] Johanvan Tilburg. Security-Analysisof a Classof CryptosystemsBasedon Linear Error-CorrectingCodes. PhD thesis,TechnischeUniver-siteit Eindhoven, 1994.

Page 85: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

67

CHAPTER 5 Code Protection

5.1 Introduction

This chapterpresentssolutionsfor theprotectionof privacy andintegrity ofcode executed on possibly malicious environments. The solutions wepresentheredo not useTamperProof Hardware.The next chaptershowshow thesesolutionscanbeextended,concretelyin termsof computationalmodel, if an auxiliary trusted hardware is available.

The chosencomputationalmodel consistsin Booleanfunctions.On onehand, it can be easily related to other models, like Random AccessMachines[AHU74]. On theotherhand,themodelallows for theestablish-mentof a formal framework. The modelalsomakesit possibleto link thesecurity of the solutions to known cryptographic assumptions.

Thedesignof solutionsplacesa specialemphasison theefficiency require-ment.Apart from securityissues,oneof the mostsolid argumentsagainstthe useof mobile agentsis performance.The mobility propertyin mobilecodeplatformsoftencausestheincreasenotonly in thecodesizebut alsoincommunicationcomplexity. Therefore,solutionsthat inflate the computa-tional andcommunicationcomplexity arenot likely to beadoptedin prac-tice. Our solutions are based on the composition of functions. The

Page 86: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

68

propertiesof functionsusedin codingtheoryareexploited in orderto effi-ciently address both privacy and integrity of execution.

The definition of the computationalmodelandthe definition of a securityframework for mobilecodeprotectionarethestartingsectionsof this chap-ter. Thenwe provide solutionsto Booleanfunctions.Oneexamplefocusingon thefunctionrepresentationis alsogiven.Finally, asecurityevaluationofthe solution is described.

5.2 Computational Model

Let representthe set of all functionsfrom into . In the

mobile codescenario,a function ownedby Alice is evaluatedby

Bob on his input data . In a protocol that additionally provides

privacy of execution,Alice obtainsthe result , andBob

providesthe input data , while preventingthe disclosureof f toBob.

Figure 5.1 Framework for Code Protection

F l k, 0 1{ , } l 0 1{ , } k

f F l k,∈

x 0 1{ , } l∈

y f x( ) 0 1,{ }k∈=

x 0 1,{ }l∈

f

y’

E(f)

E

Alice Bob

V

E(f)

Qx

Dy=f(x)

Page 87: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 69

Security Framework

A function does a conversion between inputs from the set

andoutputsbelongingto theset . Therefore,Y

definesa subsetof . Integrity of executionallows thefunctionownerto verify in anefficient way thattheobtainedoutputy indeedbelongsto thesetY.

5.3 Security Framework

A mobile functionprotectionframework is a setof efficient algorithms{E,Q, D, V}, asdepictedin Figure5.1.For thesake of completeness,analgo-rithm Q was includedto representthe function evaluationon the remotehost. Such a framework should fulfill the following properties:

Correctness. Thereis a polynomial time algorithmD to retrieve the resultf(x) from y’;

Privacy of execution. It is computationallyhardto get informationaboutthefunction f from the function f ’=E(f) . The executionof algorithmQ shouldnot leak any additional information aboutf;

Remote host computational complexity. The complexity of evaluatingalgo-rithm Q with inputsf ’ andx shouldbeO(T(n)), whereT(n) is theworstcaserunning time forf;

Communication complexity. Thecommunicationcomplexity associatedwiththeevaluationof f ’ shouldbeO(S(n)), whereS(n)is theworstcasecommu-nication complexity associated with the evaluation off;

Round complexity. The scheme should be non-interactive, or should haveround complexity equal to two;

Integrity of execution. Usingthesamenotationasdefinedin chapter3, Alicereceivestheresulty’ of theevaluationof functionf ’ at thepointx. With thisvalue,Alice shouldbeableto performapolynomialtimeverificationof thisresult, using a verifierV:

f F l k,∈

X 0 1{ , } l= Y f x( ) x X∈{ }=

0 1{ , } k

Page 88: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

70

if then .

Privacy of data. Theresulty’ shouldnot revealmoreinformationaboutdatax to the function owner, than what the actual resulty reveals.

5.4 Example

Let usstartby consideringa setof easyfunctionsfrom into .Concretely, we considerfunctionswhereeachbit of theoutputmayberep-resentedasa linearcombinationof theinputs.Sucha function canberep-resented by a matrixM.

This matrix will be evaluatedby Bob using the data . This isequivalentto sayingthatBob will performthevectorby matrix multiplica-tion .

We presenta simpleprotocolto addressprivacy of execution.Theaim is tointroduce the techniques used later in this chapter.

5.4.1 A Simple Protocol for Privacy of Execution

Let beageneratingmatrix for an Goppacode andt thenumberof errorsthecodeis ableto correct.Let bean randompermutationmatrix.

Algorithm E. The goal is to achieve the privacy of the function, whichmeans hidingM. Alice calculates another matrixM’ as follows:

The matrix hassize , thus thereis an increasein the matrix sizeinversely proportional to the information rate of the codeC.

y Y∉ P V y'( ) Accept=( ) δ<

0 1{ , } l 0 1{ , } k

f

l k×

x 0 1{ , } l∈

y xM=

G n k d,[ , ] C

P n n×

M' MGP=

M' l n×

Page 89: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 71

Example

Algorithm Q. Bob performs the operation:

.

The result z is protectedagainst eavesdroppersby addinga randomerror

vector , with . The result is then sent toAlice.

Algorithm D. Alice decryptsthe result by computing , which is

, and usesC’s secretdecodingalgorithm to retrieve the

cleartext result from ya. Theerrorvector is a correctableerror

vector since .

5.4.2 Security Analysis

In thisexamplewefocuson theprivacy of execution.Thatis why algorithmV is not mentioned.

Concerningtheprivacy of execution,onecanseethatfrom , Bob cannotdistinguishM from another matrixN built in the following manner:

and then , whereR is a randominvertiblematrix.

However, thetransformationE doesnot hidetherankof thematrix M. Fur-thermore,Bob mayidentify inputsthatresultin thesameoutput,evenif hecannotdisclosetheoutput.Thecaseof matriceswhoseranksareinferior tothe maximum is not very interestingfor either player, becausethey areobliged to handleredundantequations(other than thosegeneratedby thecode).

Alice doesnot get more informationaboutx. The numberof informationbits aboutx is equalto the rankof thematrix which is thesameasthematrix M. More importantis that Bob caneasilycheckthe rank of matrix

z xM'=

e 0 1,{ }n∈ w e( ) t= y' z e+=

ya y'P 1–=

ya yG eP 1–+=

y xM= eP 1–

w eP 1–( ) t=

M'

N MR= M' N R 1– GP= k k×

M'

Page 90: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

72

. Therefore,ourprotocolsatisfiesthepropertyof privacy of datafrom thefunction owner.

The increasein communicationandremotehostcomputationalcomplexityis inversely proportional to the information rate of the code.

5.4.3 Discussion

Although not being mentionedin the requirementssection,our protocoladdressesconfidentialityof dataduring the transmissionof the resultbackto Alice. The securityof this propertyis equivalent to decodingthe codegeneratedby , which is hardasshown in thepreviouschapter. Thepossi-bility of protectingthedataduringtransmission,with just anadditionof anerrorvectoris anadvantagein comparisonwith schemesthatusecomposi-tion with random matrices.

Thetransformationontheoriginal function(algorithmE) consistsof acom-position usedto createa well definedsubspacefrom the subspaceof thesolutionsof the function.Next, we usetheerrordetectingcapabilityof thecodeto implementefficient Verifiers(ratherthanto protectthedataduringtransmission).

5.5 Protocol Description

In thissection,weredraw therestrictionsthatwehave imposedonthefunc-tion in theprevioussection,andwe considergeneralfunctions.Eachbit

of theoutputy canberepresentedasaBooleanfunction on thebits of

the inputx. For example, in the Algebraic Normal Form [MS77]:

where and .

M'

M'

yi

f i xi

yi f x0 … xl 1–, ,( ) ao xiui

i 0=

l 1–

… a⊕2l 1–

⊕ xiui

i 0=

l 1–

= =

ai GF 2( )∈ u GF 2( )l∈

Page 91: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 73

Protocol Description

The function may be seen as a set of k Boolean functions

. Most partof theBooleanfunctionshave very largecombi-nationalcomplexity [Sav87]. For the sake of simplicity, we considerthenumberof Booleanoutputsasour measureof complexity, ratherthan thesize or depth of the Boolean circuits representing each output bit.

Therefore,a function is a setof k equations.Thesek equationsare

the inputs to algorithmE, andthey canbe representedin every form, andfurthermorethey canbe optimized.Algorithm E performslinearcombina-tionsbetweentheseequations,which is easyto computeif theequationsarein Algebraic Normal Form.

5.5.1 Error Function - Function e

Algorithm E introducessomeerrorsin thefunctionin orderto detectinteg-rity attacks.In orderto generatetheerrorswe needto defineanerror func-tion.

Let usassumethatthereexistsa function thatoutputsrandomn-bit

vectors with a given weightt.

Let bea function,which givenan l-bit argumentx, returnsann-bit

stringwith weight t, denotede(x), suchthatit is computationallyunfeasibleto distinguish the responses ofe from the responses ofr.

This meansthat thefunctione shouldbecomputationallyindistinguishablefrom the set of functionssatisfyingthe weight restriction.This definitiontries to adaptthe definition of pseudorandomfunctions [GGM86] to thecase where the outputs of the functions have a given weight.

We further assumethat is possibleto efficiently build functionssatisfyingtheserequirements.In ourcase,this functionhasto beexpressedin termsofeach output bit .

f F l k,∈

0 1{ , } l 0 1,{ }→

f F l k,∈

r F l m,∈

e F l n,∈

ei

Page 92: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

74

In [Sen95],theauthorproposedanefficient constructionfor functionsthatoutput words of a given weight. However, the indistinguishability fromother functions that satisfy the weight requirement was not proven.

5.5.2 Function Transformation - Algorithm E

Alice constructsa new function , that is a setof n Booleanequa-

tions. The representsthe equationcorrespondingto the ith bit of the

function , as follows (all the operations are performed over GF(2)):

Thenew function is sentto Bob. G andP arekeptsecretby Alice.

Theconstructionof canbeseenasthecompositionof f with a transfor-mationsimilar to theoneusedto constructthepublic-key cryptosystemofMcEliece[McE78]. However, we furtherincludetheerrorfunction.Theset

Y’ of all the possible outputs of defines a subset of .

5.5.3 Remote Function Evaluation - Algorithm Q

Bob evaluatesf ’ on his data andgetsthe result .Thereis anincreasein thenumberof Booleanoutputswhile thenumberofinputs is kept unchanged. The result is then sent to Alice.

5.5.4 Result Retrieval - Algorithm D

Alice decryptstheresultby computing or , anduses

C’s secretdecodingalgorithm to retrieve the cleartext result

andtheerrorvectorz from ya. Theerrorvector is a correctable

error vector since .

f ' F l n,∈

yi'

f '

y0' … yn' y0 … yk 1–GP eo … en 1–

+=

f ' F l n,∈

f '

f ' F l n,∈ 0 1{ , } n

x 0 1{ , } l∈ y' f ' x( )= Y'∈

ya y'P 1–= ya yG z+=

y f x( )= Y∈

z e x( )P 1–=

w e x( )( ) t=

Page 93: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 75

Function Representation

5.5.5 Result Verification - Algorithm V

Alice performs the following verification:

If then Accept.

5.6 Function Representation

A smallexampleis givento show how algorithmE works.Weonly performthe multiplication of the function by an error correctingcode(matrix G).Consider the function defined as follows:

or in the form of truth table:

If we usethe following G matrix (in systematicform for the sake of sim-plicity):

x0 x1 x2 y0 y1 y2 y3

0 0 0 1 0 0 0

0 0 1 0 1 0 1

0 1 0 0 0 0 0

0 1 1 1 0 0 1

1 0 0 0 1 1 0

1 0 1 0 0 1 0

1 1 0 0 0 1 1

1 1 1 1 1 1 0

w z( ) t=

f F3 4,∈

y0 x0x1x2 x1x2+=

y1 x0x1x2 x0x1x2 x0x1x2+ +=

y2 x0=

y3 x0x1x2 x0x1x2 x0x1x2+ +=

Page 94: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

76

Thenthefollowing is definedasfollows(aftersomemanualopti-

mizations):

or in truth table format:

The first four outputsareidenticaldueto the systematicform of the code.Then,wehaveto permutetheexpressionsandto addtheerrorfunction.One

x0 x1 x2 y0 y1 y2 y3 y4 y5 y6

0 0 0 1 0 0 0 1 1 0

0 0 1 0 1 0 1 1 1 0

0 1 0 0 0 0 0 0 0 0

0 1 1 1 0 0 1 0 1 1

1 0 0 0 1 1 0 1 0 0

1 0 1 0 0 1 0 1 1 1

1 1 0 0 0 1 1 0 1 0

1 1 1 1 1 1 0 0 1 0

G

1 0 0 0 1 1 0

0 1 0 0 0 1 1

0 0 1 0 1 1 1

0 0 0 1 1 0 1

=

f ' F3 7,∈

y0 x0x1x2 x1x2+=

y1 x0x1x2 x0x1x2 x0x1x2+ +=

y2 x0=

y3 x0x1x2 x0x1x2 x0x1x2+ +=

y4 x1=

y5 x0x1 x0x1x2 x0x1x2 x0x1+ + +=

y6 x0x1x2 x0x1x2+=

Page 95: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 77

Security Evaluation

drawbackof oursolutionis thatthefunctionmustbeexpressedin aperout-put bit form.

5.7 Security Evaluation

5.7.1 Complexity

We considerthenumberof Booleanoutputsasour measureof complexity,ratherthanthesizeor depthof theBooleancircuitsrepresentingeachoutputbit. This simplification relies on the fact that the majority of the possibleBooleanfunctionshave very largecombinationalcomplexity [Sav87]. Tak-ing this simplification into account,the proposedframework fulfills therequirementsin terms of communicationand remotehost computationalcomplexity.

Algorithm D consistsof applyingapermutationanddecoding(knowing thesecretcode).Thusit is apolynomialtime algorithmandour framework sat-isfies the correctness property.

The privacy of datapropertyis not satisfiedby our protocol.Actually, themultiplicationby thematrix GP just addslinearly dependentbits, thereforenot giving moreinformationaboutx. But theerror functiongivesthefunc-

tion ownerthepossibilityof revealing bitsaboutx (logarithmis base

2).

5.7.2 Privacy of Execution

Privacy of executionrelieson thehardnessof retrieving thefunction f fromits compositionwith thematrixGP andanadditionwith anerrorfunctione.We show that for functionsandcodesof large dimensions,therearemanypossible solutions to this problem.

nt

log

Page 96: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

78

For a given f ’ , thereareseveralpossiblecombinationsof functions,Goppacodes,permutationsanderror functions,soanenumerationattackis unfea-sible for large codes.

Next, we analyzethe hardnessof identifying the blocks involved in thecomposition.Let usstartby retrieving theerrorfunctione from thefunctionf ’ . In anothercontext, the problemof retrieving a subspacefrom a setofcodewords with errorshasbeencalled DecisionRank Reductionand itshardnesshasalreadybeendiscussedin chapter4. The bestprobabilisticalgorithmto addresstheproblemhasaprobabilityof successthatdecreasesheavily with the weight of the errors.In our solution,we useerrorswithHammingweight equalto the maximumcorrectioncapabilityof the code.Therefore,thematrix consideredasthe input of thealgorithmproposedby[Val99] hasa large Hammingweight andthe probability of successof thealgorithm is negligible.

Nevertheless,transformationE doesnot hideeverythingaboutthefunctionf. Error functione doesnot completelyhidethelinearity of thetransforma-tion dueto the small Hammingweight of its outputs.Therefore,Bob canidentify inputs that have the sameoutput becausethe dis-

tance will besmall(inferior to 2t). Evenin thecasewhereaneffi-

cient algorithmcould be devisedfor searchingthis specificcase,only thesizeof Y andinformationaboutthedistribution of thefunctionoutputsmaybe obtained,but not the actualoutputs.The complexity of this algorithmdependsheavily on functionf. Wediscussin moredetailhow to avoid infor-mation leakage aboutf :

• Thereis informationrevealedaboutthe fact that two given inputshavethesameoutput,but retrieving thecleartext valueof theoutputusingtheattacksdescribedin [Can96] and [Ber97] is not possiblebecausethecode is unknown;

• For applicationswherethe informationaboutf showing that two inputshave thesameoutputmustbehidden,we have to usethemorecomplextransformationsdescribedin section 4.5.4. Namely, the proposalsof[Sun98]areeffective to hidethis information,but they imply anincreasein the computationalcomplexity of the codeowner (algorithm E andalgorithmD);

xi x j,( ) yi y j=

d yi' y j',( )

Page 97: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 79

Security Evaluation

• The majority voting attackdescribedin section4.5.5 that exploits thenon-deterministicnatureof the cryptosystemis not effective for largecodesandit requiresa lot of differentciphertexts of thesamecleartext.In thecaseof a functionf thathasmany collisionsamongits outputs,themajority voting attackmay be feasible.In order to be resilient to themajority voting attack, we may use higher weight error patternsasdescribed in section 4.5.5.

5.7.3 Integrity of execution

The verifier canacceptan invalid y’ in the casewhere . On the

otherhand,if theoutputsof function f do not generatethespace , the

outputsof function do not completelydefinethe code(this happensiflinear combinationsof the outputvectorsof the function f cannotgenerate

all the space ). To our knowledge,thereis no efficient algorithmtofind acodeword thatis notdefinedby asubpartof aGoppacode.Moreover,thecodeis scrambledwith theerrorsintroducedby theerror function.Thefact that it wasnot possibleto find an invariantseemsto begoodevidencethat such an algorithm will be difficult to find.

Dueto thedefinitionof theerrorfunctiongivenin section5.5.1,we assumeit is hardto build relationshipsbetweeninputsto theerror functionandthe

errorpatterns.Thus,picking a randomvalue hasa probabilityof

success that can be easily calculated as:

. For a code [1024,524,101] .

Nevertheless,thereis a betterattackthatexploresthe linearity of thetrans-formation.If anadversaryusesasumof two outputsof thefunctionf ’ , thenthe probability of success is:

Y 0 1{ , } k⊂

0 1{ , } k

f '

0 1{ , } k

r 0 1{ , } n∈

δ

δ 2k n– nt

⋅< δ 2 215–<

Page 98: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

80

, for the same code .

Using linear combinationsbetweenmorethantwo outputsgivesa smallerprobability of success.

5.8 Conclusion

The aim of our solution was to addressthe issueof secureevaluationoffunctionsin potentiallyhostileenvironments.Both integrity andprivacy ofexecution were addressed,satisfying the requirementsdescribedin theframework definition.It mustbenotedthatif anattackercannotdisclosetheoriginal function,andif thefinal result is encrypted,hewill not beabletotamper with the function for his benefit.

The securityof our solutionwas relatedto the hardnessof coding theoryproblemsdescribedin the previous chapter. The novelty of the approachconsistsof usingerrorcorrectingcodesto hidefunctionsinsteadof encrypt-ing datavectors.Ontheotherhand,theoverheadonthecommunicationandon theremotehostcomputationalcomplexity introducedby our solutionsislinear.

A drawbackof oursolutionis thelimited computationalmodel.In addition,theresultis only meaningfulfor thefunctionowner. In orderto performfur-ther computationsbasedon the previous computedresults,the help of thefunction owner is needed.Nevertheless,the function owner can use thetechniquepresentedhereto addressa sequenceof functions.This is possi-bleby cascadingseveraltransformations.However, thefunctionshave to beexecutedin a pre-establishedorder. Furthermore,this constructionis verycumbersome.

δ

tt 2⁄

n t–t 2⁄

nt

-----------------------------------= δ 2 73–<

Page 99: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 81

References

We will show in thenext chapterhow to addressin a moreefficient way amodel with several functions,but we needa limited TamperProof Hard-ware acting on behalf of the function owner.

5.9 References

[AHU74] Alfred V. Aho, JohnE. Hopcroft, and Jeffrey D. Ullman. TheDesign and Analysis of Computer Algorithms. Addison-Wesley, 1974.

[Ber97] ThomasA. Berson.Failure of the McEliecepublic-key cryptosys-tem under message-resendand related-messageattack. In BurtonS.Kaliski Jr., editor, Advancesin Cryptology—CRYPTO ’97, volume1294ofLecture Notesin ComputerScience, pages213–220.Springer-Verlag,17–21August 1997.

[Can96] Anne Canteaut.Attaquesde Cryptosystèmesà Mots de PoidsFaible et Constructionde Fonctionst-Résilientes. PhD thesis,UniversitéParis VI, October 1996.

[GGM86] OdedGoldreich,Shafi Goldwasser, and Silvio Micali. How toconstructrandomfunctions.Journal of the ACM, 33(4):792–807,October1986.

[McE78] R. McEliece.A public-key cryptosystembasedon algebraiccod-ing theory. In Jet Propulsion Lab. DSN Progress Report, 1978.

[MS77] F. MacWilliams and N. Sloane.The Theory of Error-CorrectingCodes. North-Holland, 1977.

[Sav87] JohnE. Savage.The complexity of computing. Krieger, 1987.

[Sen95] Nicolas Sendrier. Efficient generationof binary words of givenweight. In Colin Boyd, editor, Cryptography and Coding; proceedingsofthe 5th IMA conference, number1025 in LectureNotesin ComputerSci-ence, pages 184–187. Springer-Verlag, 1995.

Page 100: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

82

[Sun98]Hung-Min Sun.Improving thesecurityof theMcEliecepublic-keycryptosystem. InProceedings of Asiacrypt 98, pages 200–213, 1998.

[Val99] A. Valembois.Recognitionof binary linear codesas vector-sub-spaces.In Workshopon Coding and Cryptography’99,Bookof abstracts,pages 43–51, Paris, France, January 1999.

Page 101: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

83

CHAPTER 6 Code Protection withTPH

6.1 Introduction

The solutionpresentedin the previous chapterlacks the possibility of re-usingtheobtainedresultin subsequentcomputationswithout thehelpof thecodeowner. Theoriginality of themodelpresentedhereis thedelegationofthe code owner functionalities(integrity verification and cleartext resultretrieval) to tamper proof hardware available at the remote host.

We take advantageof limited Tamper-Proof Hardware (TPH) acting onbehalfof the codeowner to performmulti-stepexecutionsandgiving thecleartext result to the remotehost.Although the new solution is basedonthe techniquedescribedin the previous chapter, it doesnot consistof astraightforwardsubstitutionof thecodeownerof thepreviousschemefor atrustedparty locatedat the remotesite.Our solutiontakesinto accountthelimitationsof theTPH, in termsof storageandcomputationalpower, whilein chapter 5 these requirements were not important to the code owner.

Thenew solutionrequiresaTPHwith limited capacity, suchasasmartcard,and it assuresthe securityof the functionsexecutedon untrustedruntimeenvironmentsby meansof someinteractionsbetweenthe remotehostand

Page 102: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

84

the trustedhardware.Unlike theschemedescribedin thepreviouschapter,theproposedtechniqueallows multi-stepexecution,aswell asthedeliveryof the cleartext output at the remote site.

This chapterdescribesthe extendedcomputationalmodel and the newrequirementsimposed by the new scenario.Then, a first solution isdescribedandits securityevaluationis discussed.Next, theconceptof off-line verifiersis introduced.An off-line verifier allows theintegrity verifica-tion to be performedafter the executionof several functions,insteadof attheendof eachindividual functionexecution.Finally, anoff-line solutionispresented and its security is analyzed.

6.2 Computational Model

Our model is a set of Boolean functions { fi| }, such that

, asdepictedin theleft sideof Figure6.1.Thecomputationof each

function fi dependson theinput xi receivedfrom thehostandon theinput yi

which is the result of the functions that were previously evaluated.

For the sake of simplicity, we assumethat every individual function fi hasthe samenumberof inputsandoutputs.Without this assumption,we mayadd bogus equationsand variables.We representthe set of functionssequentially, but eachfunction is independentof the others.Therefore,

theorderof executionof thefunctionsmaychangebetweendifferentexecu-tions. So, this computation model allows conditional jumps.

As in chapter5, thegoalof thetransformationE is to achieve theprivacy ofeach function fi. The output of the algorithm E is a set of functions

{ f’ i| }, whereeach . Thecomputationof eachfunction

f ’ i dependson theinput xi receivedfrom thehostandon theinput mi calcu-

lated from the result of the functions that were previously evaluated.

0 i p 1–≤ ≤f i F l k,∈

f 'i

0 i p 1–≤ ≤ f 'i F l n,∈

y'i

Page 103: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 85

Requirements

For eachoutputof thetransformedfunctionf ’ i, theTamper-ProofHardwareshouldbe able to checkthe integrity of the resultand to get the cleartextresult in an efficient way as shown in the right side of Figure 6.1.

Figure 6.1 Extended model and Algorithm E

6.3 Requirements

The requirementsdefinedin chapter5 have to be adaptedto the new sce-nario.Thecomputationalandstoragecomplexity of thealgorithmsthatareexecutedon theTPH have to betaken into account.Basically, thecleartextresult retrieval (algorithmD) and result verification (algorithmV) will beperformedby the TPH. Therefore,we needto reducethe complexity ofthesealgorithms.In orderto establishthe difference,we will call the newverificationalgorithmEV andthe resultretrieval algorithmED asdepictedin Figure 6.2.

x0

xp-2

xp-1

x1

y0

y1

yp-2

yp-1

f0

f1

fp-2

fp-1

x0

xp-2

xp-1

x1

mp-2

f ’0

f ’1

f ’p-2

f ’p-1

mp-1

E

TPHy’p-2

m0

m1

Page 104: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

86

We define the new requirements as follows:

TPH computational complexity. The computationalcomplexity of the algo-rithmsevaluatedby theTPH (ED andEV) mustbesmallerthanevaluating

each function itself in the TPH.

Otherwise,we may not justify our solutions,in comparisonto the casewherethefunctions{ fi| } aredownloadedover a privatechanneland executedon the TPH. When comparingthesetwo approaches,weshouldalso include the computationalcomplexity relatedto the transmis-sionof thefunctionsoveraprivatechannelbetweenthefunctionownerandthe TPH. However, we adopted the more stringent requirement.

ThealgorithmsD andV asdefinedin thepreviouschapterdo not fulfill thecomputationalcomplexity requirement.Thesamediscussionappliesto thecommunication and storage complexity:

Communication complexity. The communicationcomplexity over a privatechannelimplied by thesolutionshouldbesmallerthanthe transmissionofthe functions to the TPH.

Figure 6.2 Code Protection with TPH

f E(f)

E

Alice

Bob

E(f)

QxEV

ED

TPH

yp

f i

0 i p 1–≤ ≤

f i

Page 105: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 87

Protocol Description

TPH storage complexity. Thestoragecomplexity imposedto theTPHby thesolution should be smaller than the storage of the functions in the TPH.

Eachfunction is a setof k Booleanfunctions . We

considerthe numberof non-null Booleanoutputsasour measureof com-plexity asin thepreviouschapter. This simplificationrelieson the fact thatthe majority of the possibleBooleanfunctionshave very large combina-tional complexity [Sav87].

Basedon theassumptionthatprivacy of thedatax from theTPH is not cru-cial, we usedatax as an input to the ED and EV algorithmsin order toachieve lower complexity. In addition,we adopta strongerintegrity of exe-cutionpropertythatusesthedatax. Thecompromiseof thesecretsdistrib-uted to the TPH resultsin the very cumbersometask of changingthesesecrets. This is the reason for the use of a stronger definition.

Integrity of execution. Integrity relies on the hardnessof creatinga validinput xi, for an invalid outputy’ i+1. Using thesameterminologyasbefore,we can state this probability as follows:

if then ,

where .

6.4 Protocol Description

6.4.1 Error Function

Let q beasecurityparameterwith , andlet beapseu-

dorandomfunction [GGM86] ( representstheath bit of theoutputof r).

We maychoosea family of efficient functions,whereeachfunctionis iden-tified by a seeds.

f i

f i F l k,∈ 0 1{ , } l 0 1,{ }→

yi 1+ f i xi mi( )≠ P EV xi mi y', i 1+,( ) Accept=( ) δ<

yi 1+ D y'i 1+( )=

0 q< n k–( )≤ r F l q,∈

r a

Page 106: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

88

Furthermore,considera set constructedby randomlytaking q elements

from theset{0,1,...,n-1}. Wedefinea function , , where

representstheBooleanfunctiondefinedby the bit of the outputof

( ):

if then else ; With .

This constructiongives . Each function is

definedeitherby q equations(because(n-q) arenull) or by theseed , and

their positions (set ).

6.4.2 Function Transformation - Algorithm E

Alice appliesthe following transformationto the expressionsrepresentingeachoutputyi,j of eachfunction fi (all the operationsareper-formed over GF(2)):

This transformationbuildsanew setof functions{ f’ i| } thataresentto Bob. Over a private channel, Alice transmits the error functions{ ei| } to the TPH.G, P, andS are kept secret by Alice.

6.4.3 TPH Storage Requirements

If weconsidertheG matrixas , theTPHhasto permanentlystoreA, S

andP. The matrix A hassize . Furthermore,the TPH receivesperror functions.

Eacherrorfunction mayberepresentedby aseedsi. In thiscase,theTPH

must storea pseudorandomfunction, and the communicationcomplexity

Ri

ei F l n,∈ 0 i p 1–≤ ≤

ei j, jth

ei 0 j n 1–≤ ≤

j Ri∈ ei j, ra= a∧ a 1+=( ) ei j, 0= 0 a q 1–≤ ≤

x∀ 0 1,{ }l w ei x( )( ),∈ q≤ ei

si

Ri

0 j k 1–≤ ≤

yi 0, ' … yi n, ' yi 0, … yi k, 1–SGP ei o, … ei n, 1–

+=

0 i p<≤

0 i p<≤

I A( )k n k–( )×

ei

Page 107: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 89

Protocol Description

consistsof aseed andthesetof theerrorpositionsfor eacherrorfunction

. Otherwise,thefunctions{ ei| }, whereeachfunctionconsistsof q

equations and their positions (the set) have to be transmitted.

The constructionof the error functions tries to minimize the complexityimposed to the TPH.

6.4.4 Remote Function Evaluation - Algorithm Q

In order to evaluate each functionf ’ i the following procedure applies:

• The TPH sends to the host;

• The host evaluates the functionf ’ i at the inputs ;

• The hostsendsbackthe result andthe input dataxi to the

TPH.

Theinitial value givenby theTPH,asdepictedin Figure6.1is arandom

seed.

We did not discusswhat the relationshipbetweenthe valuesy andm was,nor theproblemof thestorageof thesevaluesin memory. Thesetwo prob-lemswill be the focusof theChapter7. Thesimplestcaseis whentheval-uesy andmareidenticalandwhentheTPHhasenoughmemoryto securelystore the values involved in the computations.

Comparedwith thecasewithout privacy, thereis no modificationconcern-ing theinputsxi givenby thehost(Bob).Thereis anincreasein thenumberof outputs in comparison with the original functionfi.

6.4.5 Result Retrieval - Algorithm ED

For eachevaluationof a functionf ’ i theTPHstartsby receiving andcon-

secutively computing the following expressions:

si

ei 0 i p<≤

Ri

mi

xi mi( ) 0 1,{ }l∈

y'i 0 1,{ }n∈

m0

xi

Page 108: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

90

• ;

• ;

• ;

• becomes the first k bits of (theG matrix is in systematic form);

• .

6.4.6 Result Verification - Algorithm EV

TheTPH verifiesif . In orderto performthis, theTPH only requires

that the last bits of , called satisfy the equationdefinedby the

generator matrix of the code, as follows:

Is ?

If theansweris affirmative, thentheresult is acceptedsinceit is a word

at distance from a codeword of the codeC.

6.5 Security Evaluation

6.5.1 Complexity

We considerthe numberof non-null Booleanoutputsas our measureofcomplexity. In our approach,thecommunicationcomplexity over a privatechannelis equivalent to the parametersthat definethe several error func-tions . Eachfunctionis definedby a seed (or q equations)anda set

of q elements.In comparison,if the functions areexecutedon theTPH,

the communicationcomplexity is equivalent to the size of all thesefunc-tions. Therefore, our solution satisfies the communicationcomplexityrequirement.

zi ei xi mi( )=

ya y'i zi+=

yb yaP 1–=

yc yb

yi ycS 1–=

yb C∈

n k– yb yd

yc A yd=

y'i

zi

ei si Ri

f i

Page 109: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 91

Security Evaluation

Similar reasoningappliesto the computationalcomplexity imposedon theTPH.Nevertheless,thealgorithmsED andEV donotconsistof justevaluat-ing the function . Algorithm ED hasoneaddition,onepermutationand

onevectorby matrixmultiplication.Algorithm EV hasonevectorby matrixmultiplication. These operations are less complex than evaluating .

TheTPH storagecomplexity musttake into accountthesecretsrequiredtoperformtheED andEV algorithms(thematricesS, P andA andthedescrip-tion of thepseudorandomfunction).However, thecostassociatedwith thesesecrets is amortized during the evaluation of thep executions.

6.5.2 Privacy of Execution

Thesecurityevaluationof theprivacy propertyis built from thesameprin-ciplesasin chapter5. In the previous chapter, the securityevaluationcon-sideredonly onefunction andno cleartext resultwasgiven back.Herewewill focus on the impact of these modifications:

• We suggestedtheuseof thesamecode(definedby matricesS, G andP)for all functions.Using the samecodewith several functionsdoesnotsignificantly impactthe securityof the overall schemein termsof enu-meration attacks (section 4.5.1) since the number of combinationsbetweenall possiblefunctions,codes,permutationsanderror functionsis very high;

• Thefactthattheresultis givenbackto theuntrustedenvironmentis cru-cial. With sufficient cleartext pairsof inputs/outputs,the remotehost is

ableto interpolatethe function fi. In general,2l pairsof inputsandout-putsareneededto completelydefinethefunction.However, if it is possi-ble to identify inputs that give the sameoutput,as referredin section5.7.2, then fewer pairs are needed.We may then apply the techniquesmentioned in section 5.7.2 to avoid the information leakage aboutf ;

• Becauseof the importanceof having a matrix to hide the systematicform of thecode,theadditionalmatrixS is used.Thefunctionsfi arepar-tially revealed.Thereforeas was shown in [Can96], the matrix S isimportant to avoid the disclosure of the code;

ei

f i

Page 110: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

92

• The fact that, for a given function fi, the errorsalways have the samepositionscandecreasethecomplexity of theproblemof identifying thecode. However, the best known probabilistic algorithm presentedin[Val99] (discussedin section4.5.5) cannottake advantageof this factsincethesuccessprobabilitydependson theweightof errors.This suc-cess probability is negligible in our case;

• TheMajority Voting attacksdescribedin section4.5.5aremoreefficientin disclosingthesecretcode,becausetheerrorshave thesamepositionsfor a given function. The complexity of this attackdependsheavily onthe function fi. This is the reasonwhy we useddifferent positionsforeacherror function.Furthermore,this attackmay be defeatedby usinghighervaluesfor thesecurityparameterq, but thedrawbackof this solu-tion is its additional complexity.

Nevertheless,theexecutionsequenceof thedifferentfunctionsis disclosed.This callsfor techniquesthathidethesequenceof accessesto a givensetofcells,suchastheonesdescribedin [GO96]. This issueis furtherdiscussedin the next chapter.

6.5.3 Integrity of Execution

Weadoptedanew implementationof theresultverificationalgorithmEV. Inour solution,the verificationis doneusingthe actualerror patternandnotthe weight of errors as those described in chapter 5.

ThealgorithmEV acceptsa resultif yb is a codeword. This implies thatya

shouldalsobea codeword of thepermutedcodeGP. Thedecompositionofya yields:

ya = yi’ + r i

In orderfor ya to beacodeword,yi’ hasto beatdistancer i of acodewordof

the codeGP. If the host randomlypicks a word, thenthe probability is

equivalent to the inverse of the number of codewords, i.e.2-k.

δ

Page 111: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 93

Off-line V erifier s

A betterattackis to pick a valid outputof fi’ . Theattackwould take advan-

tageof the probability that a valid output fi’(x), alongwith an inputareacceptedby the integrity verificationprocessasa valid pair. Therefore,the integrity of execution can be reduced to:

The error function is constructedfrom a pseudorandomfunctionwith q

bits of output.Thereforethis probability is equalto 2-q if we assumethat isunfeasibleto get informationaboutthe error positions.With a reasonablecodesize(code[1024,524,101] andq=t=50 for example),this probabilityis negligible.

However, someof the inputsareprovidedby theTPH. In fact theverifica-tion consists of:

If then accept

As mentionedbefore,thebestattackis to chooseanoutputof thefunction,called . Thus, the integrity of execution property is equivalent to:

Under the assumptionof pseudorandomnessof the function usedto con-struct the function , this probability is the same as before.

6.6 Off-line Verifiers

In theprevioussolution,theverificationalgorithmEV is calledeachtime aresult is computedby the untrustedenvironment.Using an analogywithmemorycheckers[BEG+94]we call this verifier on-line. In orderto reducethe computationalburden associatedto the verification task, we try to

x' x≠

P ei x( )( ei x'( ) )= δ<

ei

yi' ei xi' mi( )+ codeword=

f i' xa xb( )

P ei xa xb( ) ei xi' mi( )=[ ] δ<

ei

Page 112: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

94

developsolutionswhich verify a setof resultswith a singlecall to theveri-fier. We call these verifiersoff-line.

The possibility of doing the off-line verificationat the endof all computa-tionsin thefunctionownerenvironmentis speciallyinteresting.We presenta solution for this scenariowherethe integrity of executionis verified byAlice afterwards,as shown in Figure 6.3. Our solution provides a simplecheck value with all the results computed at the remote host.

6.6.1 Function Transformation - Algorithm E

Let be a function as defined in section 6.4.1, namely satisfying:

Alice appliesthe following transformationto theoutputsyi,j ofthe functionfi (all the operations are performed over GF(2)):

Figure 6.3 Off-line Verifier with v erification performed by Alice

f

{y},check

E(f)

E

Alice Bob

V

E(f)

Qx

ED

TPH

yes/no

ei

x∀ 0 1,{ }l w ei x( )( ),∈ q≤

0 j k 1–≤ ≤

yi 0, ' … yi n, ' yi 0, … yi k, 1–SGP ei o, … ei n, 1–

+=

Page 113: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 95

Off-line V erifier s

This transformationbuilds a new setof functions{ f’ i| } that issent to Bob.

Over a privatechannel,Alice transmitsa nonce andthe error functions

{ ei| } (seedsandpositionslike in theprevioussolution)to theTPH.G, P, andS are kept secret by Alice.

6.6.2 Remote Function Evaluation - Algorithm Q

Each functionf ’ i is evaluated as follows:

• The TPH transmitsmi to Bob;

• Bob evaluates the functionf ’ i at the inputs ;

• Bob sends back the resulty’ i+1 and the input dataxi to the TPH.

6.6.3 Cleartext Result Retrieval - Algorithm ED

For eachfunctionexecution,theTPHstartsby consecutively computingthefollowing expressions:

, and .

The first k bits of , called , aremultiplied by the matrix S-1 revealing

the cleartext result .

6.6.4 Off Line Verification

The TPH computes for eachcomputedfunction. The last

bits of arecalled . h is a oneway collision free hashfunction

[Sti95] andthe first hash is calculatedusingthe nonce provided by

Alice.

0 i p 1–≤ ≤

h0

0 i p 1–≤ ≤

xi mi( ) 0 1,{ }l∈

r i ei xi mi( )= ya y'i r i+= yb yaP 1–=

yb yc

yi

hi 1+ h hi yd( )=

n k– yb yd

h1 ho

Page 114: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

96

At the end of the executions, the TPH sends the cleartext results{ yi| }, and the value to Alice.

Consideringthe G matrix as , Alice performsthe following opera-

tions: and after (p times).

At the end, the calculated should be equal to the received .

6.6.5 Security Evaluation

TheTPH storesa smallvalue thatassuresthe integrity of all theresults.

As a result,theTPH doesnot have to storeA, but it hasto storethedescrip-tion of the hash functionh.

We concentrateon theoff-line verification.Theadditionof the valuesas

thecheckvaluedoesnot work dueto thelinearity of thealgorithmE, apartfrom theadditionwith theerrorfunction.Eventhoughamalicioushostmaynotcalculatetheerrorvector , it knows thatby giving thecorrect to the

TPH, it will sucessfulycancelthe error includedin . If the overall

integrity valueconsistsof theadditionof values,thenanattackthatadds

a patternof valueswhoseadditionis null to thesetof thevalues would

not bedetected.This happensbecausetherelationshipbetweenthe and

is not verified for eachvalue,as in our solution.This is the reasonfor

using a collision-free hash function.

If thereis avalue thatdoesnotsatisfytheintegrity of executionproperty,

thenthis attackwill bedetecteddueto thefact that thereceivedhashvalueis goingto bedifferentfrom theonecalculatedwith overwhelmingprob-

ability. Thegoalof thenonce is to avoid replayattackswhereanoverall

set of previous values with a valid check value is resent.

We assumedthat eachfunction is only calculatedonceon a sequential

orderandwhereall thep functionsareexecuted.Otherwise,the intermedi-

0 i p 1–≤ ≤ hp

I A( )h1 h h0 y0SA( )= hi 1+ h hi yiSA( )=

hp hp

hi

yd

r i xi

r i y'i 1+

yd

y'i

yd

yc

yd

hp

h0

f i

Page 115: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 97

Conclusion

ary resultsand the sequenceof executionshave to be transmittedback toAlice in order for her to be able to perform the verification.

6.7 Conclusion

Oursolutionsprovideafundamentalbuilding block for securecomputinginpotentiallyhostileenvironments.The solutionspresentedapply to a moregeneralcomputationalmodel,whencomparedwith the previous solutionspresentedin chapter5. ThedifferencebetweenthecomputationalmodelsofChapters5 and6 is equivalentto thedifferencebetweencombinationalandsequentialcircuits.Theenhancementof thecomputationmodelis possibledue to the limited TPH.

Thescenariowith TPH raisesnew securityrequirements.Dueto thelimita-tions imposedby a TPH, suchasa smartcard,our solutionsrequireonly asmallfunctionto bedownloadedandexecutedon theTPH,while extendingthe TPH’s intrinsic securityto the untrustedenvironmentwherethe maincomputationsareexecuted.Furthermore,we presentedan off-line Verifier,whereasinglecheckvalueaccountsfor theintegrity of executionof asetoffunctions.

In our solutions,theerrorcorrectingcodeis only usedto createa structuresuitablefor the integrity verification,while the decodingalgorithm is notusedat all. The fact that the algorithmsED andEV arehighly coupledisone of the reasons for the high level of efficiency achieved by our solutions.

An advantageof the two solutionspresentedis that the differentfunctionsmay be executedin any orderbecauseeachtransformedfunction is inde-pendentof theothers.Therefore,oursolutionsapplyto computationalmod-els that include conditional jumps.

Nevertheless,theexecutionsequenceof thedifferentfunctionsis disclosedto theremotehost(Bob). In addition,wesupposedthattheTPHhasenoughmemoryto storeall thecleartext results.Thesetwo pointswill bethefocusof the next chapter.

Page 116: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

98

6.8 References

[BEG+94] Manuel Blum, Will Evans,PeterGemmell,SampathKannan,andMoni Naor. Checkingthecorrectnessof memories.Algorithmica, 12(2/3):225–244, August/September 1994.

[Can96] Anne Canteaut.Attaquesde Cryptosystèmesà Mots de PoidsFaible et Constructionde Fonctionst-Résilientes. PhD thesis,UniversitéParis VI, October 1996.

[GGM86] OdedGoldreich,Shafi Goldwasser, and Silvio Micali. How toconstructrandomfunctions.Journal of the ACM, 33(4):792–807,October1986.

[GO96] Oded Goldreich and Rafail Ostrovsky. Software protectionandsimulationon oblivious RAMs. Journal of the ACM, 43(3):431–473,May1996.

[Sav87] JohnE. Savage.The complexity of computing. Krieger, 1987.

[Sti95] DouglasR. Stinson. Cryptography: Theory and Practice. CRCPress, 1995.

[Val99] A. Valembois.Recognitionof binary linear codesas vector-sub-spaces.In Workshopon Coding and Cryptography’99,Bookof abstracts,pages 43–51, Paris, France, January 1999.

Page 117: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

99

CHAPTER 7 Code and DataProtection

7.1 Introduction

In thepreviouschapters,we focusedon theproblemof thecomputationoffunctionson untrustedenvironments.In Chapters5 and 6, we presentedsolutionsthat take advantageof interestingpropertiesof error correctingcodes.

Thesolutionspresentedin Chapter6 took into accounttheintegrity andpri-vacy of execution,while neglectingtheproblemof datastorage.Therefore,we implicitly consideredthatsecurestoragewasavailableto storethedatainvolvedin thecomputations.A limited TPH,suchasa smartcard,maynothave enoughmemoryto storeall the results.Thuswe envisageusing thememoryof amorepowerful component.Therefore,weaddresstheproblemof secure storage of data in untrusted memories.

We first considera scenariowherethe CPU is trustedand the memoryisconsidereduntrusted.WedefineaSecureMemoryManager(SMM) to han-dle the CPU requestsfor datastorageand retrieval. The SMM performsintegrity checkson memory accessesin order to detectdata tamperingattacks occurring while data resides in memory.

Page 118: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

100

We presentsolutionsfor memoryprotectionbasedon codingtheorytech-niques,sincethegoal is to latercombinethesesolutionswith thesolutionsdevelopedin thepreviouschapterfor codeprotection.Next, we consideramodel with untrustedmemory and untrustedCPU, and we combinetheSMM with the solution for code protection presentedin Chapter6 toaddresstheproblemsraisedby this model.We succinctlyanalyzethechar-acteristics and the weaknesses of this combined solution.

This chapterintroducesa techniquebasedon errorcorrectingcodesto dealwith memoryprotection.Then,we usethis techniqueto addresstheprotec-tion of thememoryspacewherethedatais stored.We presentanarchitec-ture for code and data protection that combines solutions for codeprotectionfrom Chapter6 andmemoryprotection,at theendof thechapter.

7.2 Memory Protection

In thissection,themainemphasisis placedondataprotectionasopposedtothe previous chaptersthat focusedon codeprotection.In the solution inChapter6, we implicitly assumedthat a securestoragemediumwasavail-able. Securestorageis neededto save the intermediaryresultsand datastructures used during the code execution.

Dueto theinherentlimitationsof storagecapacityin mostTPH implemen-tations,we suggestan approachfor securestorageof datain the untrustedhost. In the first solution, we only addressthe securestorageproblemassumingthat securityof the computationscanbe assuredby othermeanssuch as a trustedCPU or the solutionspresentedin chapter6. We thenpresenta comprehensive solution that assuresboth securestorageandsecure computation in untrusted environments.

7.2.1 Requirements

Datastoragein untrustedmemoryraisesseveral securityrequirements,asfollows:

Page 119: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 101

Memory Protection

• Privacy. The data stored in the memory should be protectedagainstunauthorized disclosure;

• Integrity. Unauthorizedmodification of data stored in the memoryshould be detectable;

• Access Pattern Protection. Unauthorizedmonitoringof memoryaccessoperationsconcerningthe locationof memorycells shouldbe prevent-able.

7.2.2 Model

Our memory protectionschemeis basedon a new componentcalled asecurememorymanager(SMM) thatis anextensionof thememorycheckerconceptintroducedby [BEG+94]. Themaindifferencebetweena memorychecker andanSMM is that thechecker only addressesintegrity, while anSMM alsoprovidesprivacy. Themodelconsistsof a powerful trustedCPUthat interacts with an untrusted memory, as depicted in Figure 7.1.

Inspiredby thememorycheckermodel,wedefineaSMM asaprobabilisticTuringmachinethatperformstheinterfacebetweenthetrustedCPUandthememory. All theinteractionsbetweentheCPUandthememoryarehandledby the SMM. The SMM usestwo pairsof tapesto communicatewith theCPUandthememory. Eachpair of tapesconsistsof a read-onlytapeanda

Figure 7.1 Secure Memory Manager - SMM

CPU

SMM

Trusted MemoryUntrusted

Page 120: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

102

write-only tape.In addition,theSMM includesaninternalread/writework-tape of limited capacity that is considered reliable and secret.

The SMM translatesthe operationsrequestedby the CPU in a way thatensuresthe protectionof the memorycontents.The memoryis consideredasbeingcontrolledby a powerful attacker, so thesecurememorymanagershouldwithstandpossibleattacksfrom thememory. As in thecaseof mem-ory checkers[BEG+94],after readingtheoperationrequestedby theCPU,theSMM shouldanswer(with ahighprobability)with thecorrectoutputor“BUGGY” if an error is found in the memory.

If a memorychecker verifiestheintegrity of eachoperation,it is calledon-line. Alternatively, if thecheckerwaitsuntil theendof asequenceof opera-tions to report an error, then the checker is called off-line. In addition,checkers which introduceoperationsthat imply the storageof checkinginformation in the untrustedmemoryare called invasive. Otherwise,theyarecallednon-invasive. Weconsiderthesamedefinitionsfor thecaseof theSMM.

The important characteristics of a SMM are:

• Thecomputationalcomplexity of eachmemoryoperationperformedbythe SMM;

• The amount of trusted and secret memory required by the SMM;

• The space overhead introduced by the SMM in the untrusted memory.

7.2.3 Related Work

The proposalsfor softwareprotection[Gol86][Ost90][GO96]tacklea set-ting wherea very powerful adversarycontrolsthememory. Theseschemesaddressall the requirementsstatedin section7.2.1.However, theoverheadintroducedby the techniquesproposedto addresseachof the requirementsis high. More efficient solutionsthatonly addressthe integrity requirementare called memory checkers [BEG+94].

Methodsto addresstheproblemof integrity of messagesarecalledMessageAuthenticationCodes(MACs) [Sti95]. It is possibleto constructvery effi-

Page 121: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 103

Memory Protection

cient MACs usinghashfunctions.Thesetechniquesaresuitablewhenthemessageis not dynamicaswill bediscussedin thenext chapter. Neverthe-less,when the accesspatternof modificationsis simple,as in the caseofstacksand queues,very efficient solutionsfor memorycheckers exist asdescribedin [DS98]. Thesesolutionsrely on thedifficulty of finding colli-sions among the outputs of the hash function.

For the moregeneralcaseof RandomAccessMemories(RAMs), the taskof designinga memory checker becomesharder. One solution is to useincrementalhashing[BGG94]. This techniqueallows for the hashof themessageto bemodifiedwhena block of themessagechangeswithout hav-ing to recalculatethehashfrom scratch.Theincrementalhashingandsign-ing techniquewasdesignedto withstandvirus attackson files or memory[BGG95].Thetechniquerequiresno reliableor privatememory. In ordertodesigna checker for RAMs, we needhashfunctionsthat are incrementalwith respectto block replacement,which is simplerandvery efficient usingXOR MACs[BGR95]. More complex incrementalschemesweredesignedto support delete, insert or even cut and paste operations [BGG95][BM97].

Nevertheless,it is possible to design more efficient checkers [Fis97][BEG+94], taking advantageof a limited private memory. On the otherhand,the techniqueof fingerprinting[KR87] canalsobeusedasa crypto-graphic checksumthat detectsmodificationsto the data.The fingerprintschemeis incrementalwith respectto singlecharacterreplacementandthesecurityof the schemerelieson the assumptionthat the fingerprintcannotbe identified. The performance of this algorithm was analyzed in [Yee94].

The solutionsreferredto above aresuitablefor off-line checkingbecausetheverificationprocessis cumbersome.Theverificationimpliesreadingallmemorycells.However, there-calculationof thenew integrity checkvaluesubsequentto a write operationis very efficient.Conversely, on-linecheck-ersfor RAMs verify theintegrity eachtime thedatais accessed.Therefore,the integrity checkmechanismmust be madeefficient at the expenseofincreased complexity to re-calculate the integrity check values.

Themainideabehindon-linecheckersconsistsof usingindividual integritycheckvaluesfor eachposition.Thentheproblemis thatpreviousvalid val-uescontinueto bevalid andthusthey canreplacemorerecentvalues.The

Page 122: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

104

solutionpresentedin [BEG+94] builds a completebinarytreeon top of thememory. In orderto authenticatea position,all thenodeson thepathfromthe root to the position and their children must be accessed.This is animprovementover the off-line solutionsthat accessall the memoryposi-tions (we have to access2 log n positions,wheren is thenumberof cells).However, whenonecell is modified,all the nodeson the path to the roothave to be modified.

7.2.4 Message Authentication

We develop solutions for memory protectionusing coding theory tech-niques,with the objective of combiningthesesolutionswith the solutionsdevelopedin the previous chapter. Our solutionsare inspiredin messageauthentication techniques.

In the coding theorycontext, messageauthenticationis basedon the ideathat the error vectoris usedto transmitauthenticationinformation,insteadof being a randomstring. This approachhasbeenusedon coding theorybasedcryptosystemsin [LW91]. Theauthorsdescribeda secretkey crypto-system,wheretheciphertext z correspondingto messagem hasthefollow-ing form:

.

The function e is a secretsharedbetweenthe two partiesinvolved in thecommunication.The error vector provides MessageAuthentication,dueto therelationshipbetweenthemessageandtheerrorvectorestablishedby functione. A messagem andanerrorvectorr areobtainedby thedecod-ing process.The verificationconsistsof evaluatingthe function e with thedecodedmessagem as input and checking if r=e(m). Nevertheless,theschemeproposedin [LW91] wasbrokendueto thelinearity of thefunctione that generated the error vectors [vT94].

This techniquefor messageauthenticationmaycreatea potentialexposuresincesomeinformation about the plaintext can be recoveredthroughtheerrorvector, which is not random.In orderto avoid thisflaw, theerrorfunc-

z mSGP e m( )+=

e m( )

Page 123: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 105

Off-Line Secure Memory Manager

tions shouldbelongto a family of functionssatisfyingthe propertiesenu-merated in sections 5.5.1 and 6.4.1.

Our solutionsaddressbothprivacy andintegrity of RAMs undercomputa-tional assumptions.The off-line and on-line solutionsare original tech-niquesbasedon the MessageAuthenticationtechniquedescribedabove.The off-line solution is efficient in the sensethat the verification processconsistsof simple XOR operations.Both memorymanagersare invasiveconsidering the same definition as stated in the case of memory checkers.

7.3 Off-Line Secure Memory Manager

In our solution, the SMM storesin secretmemorya checkvalue z, thatassurestheintegrity of all thememorycells.Thisvalueis updatedeachtimethe CPU requestsan operation.Therefore,the SMM translateseachmem-ory operationto a set of operations,necessaryto keepan updatedcheckvalue.The verificationmay be doneany time but it is a cumbersometaskbecause it implies accessing all memory cells.

7.3.1 Protocol Description

Let beageneratingmatrix for an Goppacode andt thenumber

of errorsthecodeis ableto correct.Let bea randompermutationmatrix and be a random invertible matrix.

Let bea functionasdefinedin section5.5.1.We assumethat this

functionbelongsto a family of functions,thereforeeachfunction is identi-fiedby aseeds. Theseeds is storedin thesecretandreliablememoryof theSMM. The function satisfies the weight constraint:

.

G n k d,[ , ] C

P n n×S k k×

f s F l n,∈

f s

x∀ 0 1{ , } l w f s x( )( ),∈ t=

Page 124: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

106

The untrustedmemoryM is a setof N memorycells M[i], wherei repre-sentstheaddress . Eachcell haslengthn. Thecheckvaluez storedin secret memory is initialized to 0, corresponding to an empty memory.

Write Operation

A write operationhastwo operands:thevaluev to bestoredandtheaddressi where the valuev should be stored.

Theencryptionis performedlike in theMcEliecescheme,however theerrorvector is generated in a special way, as follows:

.

The SMM computes the ciphertext: .

In order to write a valuev in location i, the SMM performsthe followingoperations:

• Read the existing value stored in the memory locationi;

• Decrypt as in the McEliece scheme obtaining and ;

• Xor to z;

• Write y to M[i];

• Xor to z.

Read Operation

A readoperationhasonly oneoperand,the addressi. On a readoperationthe SMM performs the following operations:

• Read the value stored at the addressi;

• Decrypt as in the McEliece scheme obtaining and ;

• Verify that .

0 i N<≤

ei

ei f s i v,( )=

y vSGP ei+=

M' i[ ]

M' i[ ] v' e'i

e'i

ei

M' i[ ]

M' i[ ] v' e'i

e'i f s i v',( )=

Page 125: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 107

Off-Line Secure Memory Manager

7.3.2 Off-line Verification

In orderto checkthe integrity of the memory, the SMM performsthe fol-lowing operations for each memory location:

• Read the memory cell ;

• Decrypt , obtaining and ;

• Verify that .

• Xor to z.

Theverificationcompleteswith successif afterperformingtheaboveoperations over all the memory cells.

7.3.3 Security Evaluation

In a write operation,it is alsopossibleto verify if . Addition-

ally, as in the memory checkers of [BEG+94] a time stamp may be

appendedto thestoredvaluey andincludedin thepseudorandomfunctionin order to checkthat the timestampreadis older than the current time.However, theseadditional verificationscan help detectother attacksbutthey donotsolve thereplacementof memorycellsby outdatedvalid values.

The integrity of the memorycells is assuredby the difficulty of creatingasetof cells that have the samecheckvaluez. This valueis kept in reliableandsecretmemory. In addition,thepatternsof errorsareunknown andit iscomputationallyhardto getany informationfrom them(apartfrom thelowHammingweightandlength).Therefore,theattackdescribedin [BM97] onXOR MACsdoesnot applyto our casebecausethedescriptionof thefunc-tion andz are secrets.

The integrity attackthat consistsof substitutinga currentvalue by avalue , such that , will require that:

with .

M' i[ ]

M' i[ ] v' e'i

e'i f s i v',( )=

e'i

z 0=

e'i f s i v',( )=

ti

f s

M i[ ]M' i[ ] M i[ ] M' i[ ]≠

f s i v,( ) f s i v',( )= v v'≠

Page 126: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

108

Theprobabilityof theabove statementis , assumingthatall theerror

patternsarepossibleoutputsof the function andthat it is computation-

ally unfeasibleto get information about the outputsof . For example,

usinga code[1024,524,101] this probability is negligible. This is alsotheprobabilityof an integrity attackconsistingof switchingpositionsbetweentwo different cells.

Thereis the possibility of exploiting the low weight of the outputsof ,

thatis performingthesubstitutionof M[i] by a linearcombinationof a sub-setof theotherpositions.Thesuccessprobabilityis equivalentto theproba-bility of finding a subset such that:

.

This is a hardproblembecausetheattacker hasto build a specificerrorpat-tern. We showed in chapter5 that matchinga given Hammingweight oferrors is hard. In chapter6, we proved that even with limited positions,matchinganerrorpatternhasa low probability. Hencethesuccessprobabil-ity of the problem considered here may be considered negligible.

Thesamereasoningappliesfor thedeletionor insertionof a setof memorycells.Then,thesuccessprobability is equalto finding a setwherethesumof the secret error vectors would be null.

The privacy of the datastoredin the memory relies on the assumptionsdefinedin chapter4 concerningtheencryptionwith a secretcode.The lin-earity of the transformationraisesthe problemsdiscussedin section4.5.5.If the samevalue v is storedin two different positions,then informationaboutthe error patternis disclosed.The techniquesalreadymentionedinsection4.5.4 to withstandthis attack may be usedat the expenseof anincreased complexity in the SMM.

1 nt

f s

f s

f s

U 0 … N 1–, ,{ }⊂

f s j v j,( )j U∈∑ f s i v,( )=

Page 127: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 109

On-Line Secure Memory Manager

7.4 On-Line Secure Memory Manager

On-lineSMMsfor RAMs verify theintegrity eachtimethedatais accessed.As a result,the integrity verificationmustbe efficient. The main ideacon-sists of using individual integrity check values for each position.

Oursolutionfor on-lineSMM is acombinationof thereplaydetectiontech-niquefrom [BEG+94] andthegenericintegrity verificationtechniqueusedwith the off-line SMM. The solution from [BEG+94] constructsa binarytree of sumsof the timestamps on top of the memoryto detectreplay

attacks.Theroot of this treeis storedin thesecurememoryof thechecker.Along with thevaluey, a timestamp is alsostoredin M[i]. Thetimestamp

can be a discrete value, like a counter incremented on each operation.

The timestamptreeshouldbe authenticatedbut without a timestamp.Wecanjust appendthe valueof a pseudorandomfunction to the timestampincleartext asin [BEG+94]dueto thefactthattheconfidentialityof thetimes-tamps is not required.

7.4.1 Write Operation

TheCPUasksfor a valuev to bestoredin positioni. Theerrorvector is

generated as follows:

;

The SMM computes the ciphertext: .

Then, the SMM performs the following operations:

• Read the existing value stored in the memory locationi;

• Verify that is earlier than the current time;

• Verify thatthesumof thevaluesstoredin thechildrenleaveson thepathfrom thei positionto theroot is equivalentto thevalueof theroot storedin secure memory;

ti

ti

ei

ei f s i ti v, ,( )=

y vSGP ei+=

M' i[ ]

t'i

Page 128: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

110

• Decrypt as in the McEliece scheme obtaining and ;

• Verify if ;

• Write y and the current time to M[i];

• Updatethesumsof thetimestamptree,on thepathfrom thepositioni tothe root.

7.4.2 Read Operation

In order to read addressi, the SMM performs the following operations:

• Read the existing value stored in the memory locationi;

• Verify that is earlier than the current time;

• Verify thatthesumof thevaluesstoredin thechildrenleaveson thepathfrom thei positionto theroot is equivalentto thevalueof theroot storedin secure memory;

• Decrypt as in the McEliece scheme obtaining and ;

• Verify if .

7.4.3 Security Evaluation

The integrity attacksdescribedin the previous sectionare subjectto thesameconclusionsdrawn in section7.3.3.The main problemwith on-lineSMM is thatpreviousvalid valuescontinueto bevalid andthuscanreplacemore recent values. This is known as a replay attack. As stated in[BEG+94], the binary treeis immuneto replayattacksdueto the fact thatreplayattackscanonly decreasethe timestampsstoredin the tree.There-fore, thevalueof theroot that is storedin securememoryandthatcontainsthe overall sum cannot be satisfied by using previously valid values.

7.5 Code and Data Protection

In the previous chapters,we considereduntrustedcomputationsusing animplicitly trustedmemory. In the previous threesections,we considered

M' i[ ] v' e'i

e'i f s i t'i v', ,( )=

ti

M' i[ ]

t'i

M' i[ ] v' e'i

e'i f s i t'i v', ,( )=

Page 129: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 111

Code and Data Protection

memoryprotectionusinga trustedprocessor. We usedcodingtheorytech-niquesin order to build an efficient architecturefor codeanddataprotec-tion.

In this section,we suggestan architecturefor codeanddataprotectionasdepictedin Figure7.2by combiningthefeaturesof thesolutionsfor securecomputationin chapter6 andtheSMM. Thissectionmainlypresentsguide-lines and openissuesconcerningthe architecture.To our knowledge,ourarchitectureis the only architecturefor codeanddataprotectionusinganuntrusted CPU. The existing proposals ([Bes79],[Ken80],[Yee94] and[GO96]) rely on a trusted CPU.

7.5.1 Architecture

In chapter6, we extendedthe inherentsecurityof a limited trustedTPH tothe computationsperformedin a powerful execution environment.Con-cretely, we addressed the problems of privacy and integrity of execution.

As in the caseof the SMM, we model the trustedCPU asa probabilisticTuring machinethat usestwo pairs of tapesto interactwith an untrustedCPU andthe SMM. Eachpair of tapesconsistsof a read-onlytapeandawrite-only tape. In addition, the trustedCPU usesan internal read/writeworktapeof limited capacity. Thecodeis transformedin orderbeexecutedontheuntrustedCPU,by analgorithmE asdefinedin chapter6. ThetrustedCPUreceivestheerror functionsover a privatechannelandstorestheminthe internal worktape.The knowledge of the error functions allows thetrustedCPUto retrieve thecleartext resultandto efficiently verify theinteg-rity of thecomputationperformedin theuntrustedCPU,asshown in chap-ter 6.

Now, thecleartext resultthatmaybeusedin subsequentcomputationswillbe transmittedto theSMM in orderto bestoredin untrustedmemory. ThetrustedCPU mustreceive the executionsequenceof the functionsandthememoryoperationsfrom the codeowner. This information must be pro-tectedagainstintegrity attacksandis storedin the internalworktapeof thetrustedCPU.TheSMM translatestheoperationsrequestedby theCPUin a

Page 130: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

112

way that ensuresthe privacy and integrity of the datastoredin untrustedmemory, as defined in the previous two sections.

Up to now, we have presentedthe problemsrelatedto the executiononuntrustedCPUsandto thestoragein untrustedmemoriesseparately. There-fore, there is room for enhancement, as follows:

• The secreterror-correcting code (matricesS, G and P) used by thetrusted CPU and SMM may be the same;

• Algorithm E cantake into accountthepositionswheretheresultsaretobestored.By building theerrorvectorsaccordingto this information,wemay avoid decryptionand re-encryptionin order to storea computedvalue in the untrustedmemory. This is not possibleif the SMM usestimestamps;

Figure 7.2 Code and Data Protection Architecture

Memory

CPU SMM

Trusted

CPUUntrusted Untrusted

Page 131: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 113

Code and Data Protection

• The integrity verificationsperformedby the SMM andthe trustedCPUmay be merged. The integrity of execution property may be verifiedwhenthecleartext resultis requiredastheinput of a subsequentcompu-tation(andafterbeingstoredin untrustedmemory),ratherthanimmedi-ately after the computation.

The precise evaluation of these enhancements is left open.

7.5.2 Characteristics

The characteristics of such an architecture are:

• Computationalcomplexity of the trustedprocessorand of the securememory manager;

• Sizeof the secureandreliablememoryof the trustedprocessorandofthe secure memory manager;

• Increase in the size of the code executed on the untrusted CPU;

• Increase in data stored in the untrusted memory;

• Communicationcomplexity betweenthe trustedand untrustedproces-sors;

• Communicationcomplexity betweenthe securememorymanagerandthe untrusted memory;

• Information leakage about the program;

• Information leakage about the data stored in untrusted memory.

7.5.3 Security

Wepresentedefficientsolutionsto codeprotection(chapter6) anddatapro-tection(chapter7). However, thesesolutionsconcealinformationaboutthecodeanddatastoredin thememory, namelythesequenceof executionandthe access pattern to the memory.

Theinformationconcealedby bothcodeprotectionanddataprotectioncanbeexploitedby anintegratedattack.Notethatcleartext datais givento theuntrustedCPU.Thesecurityanalysisof theSMMsdid not take into accountthefactthatcleartext datais revealed.Themainproblemis thatinformation

Page 132: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

114

aboutthesecretcodecanbedisclosed.However, this issuewasalreadydis-cussedin section6.5.2, wherewe showed that retrieving the secretcoderemains a hard problem, even with the knowledge of cleartext data.

Nevertheless,the proposedarchitectureconcealsthe accesspatternto thememoryandthesequenceof executionof thefunctions.In orderto hidethisinformation, we must break the link betweencleartext datagiven to theuntrustedCPU andciphertext storedin untrustedmemories(without com-promisingthe efficiency of the solutions).In this thesis,we do not presentsolutionsfor dealingwith theabove requirements.However, we give somehints to address this problem, as follows:

• Theprogramstructurecanbehiddenby requestingseveralcomputationsof functions using bogus data, or by using bogus functions;

• Performing bogus accesses may also be applied to the memory;

• A set of cleartext valuescan be maintainedin the secureand reliablememory, in orderto increasethecombinationsof cleartext datathatcanbegivento theuntrustedCPU,withoutcorrespondingto amemoryread.

Thesetechniquesbreakthe relationshipbetweenthe values and as

mentionedin chapter6, and illustratedby Figure 6.1. The goal is not tocompletelyhide thesequenceof executionandthememoryaccesspattern,but to createa large numberof combinationsin order to counterattacksexploiting the correlationbetweenciphertext outputs,valuesstoredin thememory and cleartext data given to the untrusted CPU.

The implementationof thesetechniquesmay be easily included in thealreadydefinedsolutionsfor codeprotectionandfor theSMM. This is pos-sible dueto the fact that the protectionmechanismsaddresseachfunctionindependently. In otherwords,the protectiontechniquedoesnot rely on aspecificsequenceof executionof the several functions.In the caseof theSMM, the protectionmechanismsdo not imposeany restrictionson theaccess pattern.

mi y'i

Page 133: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 115

Conclusion

7.6 Conclusion

We have built efficient solutions for the problem of securestorageinuntrustedmemories.Theconceptof SecureMemoryManagerwasdefinedto addressthis problem.Our goal was to usetechniquesthat allowed foreasyintegration with the techniquesdevelopedin chapter6 that addresscodeprotection.Therefore,we usedmemoryprotectionmechanismsbasedon codingtheory. We shouldemphasizethat thesecretsusedfor codepro-tection and memory protection are the same.

The solutionsfor memoryprotectionare very efficient from the point ofview of the required length of the secureworktape.However, we mayimplement more computationallyefficient SMMs using a larger securememory. For example,wemaystoretheerrorpatternsin securememory. Inthis case,the decodingoperationis avoided.Sucha solutionstill requireslessprivatestoragethanthestraightforwardsolutionbasedonstoringall thememory cells in secure storage.

Furthermore,we combinedthe solutionsfor codeprotectionin chapter6andmemoryprotectionin order to build an efficient architecturefor codeanddataprotection.To our knowledge,the presentedarchitectureis origi-nal. It shouldbeaddedthat therearenew featuressuchasthe integrity andthe privacy of execution with the help of a “small” trusted processor.

We mainly presentedguidelinesand openissuesconcerningthe architec-ture.The problemsof preventingthe disclosureof the sequenceof execu-tion of thefunctionsandthememoryaccesspatternwerenotaddressed.Wejust proposedsomeguidelinesto includethesefeaturesin our architecture.In addition,weshowedthatproviding thesefeaturesdoesnot imply modifi-cations in the protection mechanisms already developed.

Our architecture can be applied to the following scenarios:

• Software distribution. In this scenario,eachcopy of thesoftwareis dis-tributed with a limited TPH. The TPH actson behalf of the softwareownerandonly customerspossessinga valid TPH device areableto runthe software. This solution is an alternative to the applicationhosting

Page 134: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

116

scenario,wherea trustedcentralizedserver runstheapplicationsin orderto prevent disclosing information about the software;

• Securitymanagementof a networkof untrustedCPUs and memories.OnetrustedCPU including a limited amountof memorymay performthesecuritymanagementof anetwork of untrustedcomputersandmem-ories.ThetrustedCPUassurescodeanddataprotectionwhile thecom-putationsanddataaredistributedamonga setof untrustedcomponents(CPUs and memories).

7.7 References

[BEG+94] Manuel Blum, Will Evans,PeterGemmell,SampathKannan,andMoni Naor. Checkingthecorrectnessof memories.Algorithmica, 12(2/3):225–244, August/September 1994.

[Bes79]RobertBest.Microprocessorfor executingencryptedprograms.USPatent No. 4,168,396, September 1979.

[BGG94] Mihir Bellare,OdedGoldreich,andShafiGoldwasser. Incremen-tal cryptography: Thecaseof hashingandsigning.In Yvo G. Desmedt,edi-tor, Advancesin Cryptology—CRYPTO ’94, volume839of LectureNotesinComputer Science, pages 216–233. Springer-Verlag, 21–25August 1994.

[BGG95] Mihir Bellare,OdedGoldreich,andShafiGoldwasser. Incremen-tal cryptography andapplicationto virus protection.In Proceedingsof theTwenty-Seventh Annual ACM Symposiumon the Theory of Computing,pages 45–56, Las Vegas, Nevada, 29 May–1 June 1995.

[BGR95] Mihir Bellare,RochGuérin,andPhillip Rogaway. XOR MACs:New methodsfor messageauthenticationusingfinite pseudorandomfunc-tions.In Don Coppersmith,editor, Advancesin Cryptology—CRYPTO ’95,volume963of Lecture Notesin ComputerScience, pages15–28.Springer-Verlag, 27–31August 1995.

Page 135: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 117

References

[BM97] Mihir BellareandDanieleMicciancio.A new paradigmfor colli-sion-freehashing:Incrementalityat reducedcost. In Walter Fumy, editor,Advancesin Cryptology—EUROCRYPT’97, number1233in LectureNotesin ComputerScience,pages163–192,Konstanz,Germany, May 1997.Springer-Verlag.

[DS98] P. Devanbu and S.G. Stubblebine.Stackand QueueIntegrity onHostilePlatforms.In Proceedingsof IEEE Symposiumon SecurityandPri-vacy, 1998.

[Fis97] Marc Fischlin. Incrementalcryptography andmemorycheckers.InWalter Fumy, editor, Advancesin Cryptology—EUROCRYPT’97, number1233in lncs,pages393–408,Konstanz,Germany, May 1997.Springer-Ver-lag.

[GO96] Oded Goldreich and Rafail Ostrovsky. Software protectionandsimulationon oblivious RAMs. Journal of the ACM, 43(3):431–473,May1996.

[Gol86] OdedGoldreich.Towardsatheoryof softwareprotection(extendedabstract).In A. M. Odlyzko, editor, Advancesin Cryptology—CRYPTO ’86,volume263of LectureNotesin ComputerScience, pages426–439,Univer-sity of California, Santa Barbara, 11–15August 1986. Springer-Verlag.

[Ken80] StephenKent. ProtectingExternally SuppliedSoftware in SmallComputers. PhD thesis, MIT Laboratory for Computer Science, 1980.

[KR87] R. KarpandM. Rabin.Efficient randomizedpatternmatchingalgo-rithms.IBM Journal of Research and Development, 31(2), March 1987.

[LW91] Y. X. Li and X. M. Wang.A joint authenticationand encryptionschemebasedon algebraiccoding theory. In H. F. Mattson,T. Mora, andT. R. N. Rao, editors, Applied Algebra, Algebraic algorithms and ErrorCorrecting Codes9, number539 in LectureNotesin ComputerScience,pages 241–245. Springer-Verlag, 1991.

Page 136: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

118

[Ost90] Rafail Ostrovsky. Efficient computationon oblivious RAMs. InProceedings of the Twenty Second Annual ACM Symposium on Theory ofComputing, pages 514–523, Baltimore, Maryland, 14–16 May 1990.

[Sti95] DouglasR. Stinson. Cryptography: Theory and Practice. CRCPress, 1995.

[vT94] Johanvan Tilburg. Security-Analysis of a Class of CryptosystemsBased on Linear Error-Correcting Codes. PhD thesis,TechnischeUniver-siteit Eindhoven, 1994.

[Yee94] BennetYee. Using Secure Coprocessors. PhD thesis,School ofComputer Science - Carnegie Mellon University, May 1994.

Page 137: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

119

CHAPTER 8 Collected DataProtection

8.1 Introduction

In thischapter, weaddressaspecialareaof mobilecodeprotectionwhich isthesecurityof thedatacollectedby mobileagents.A typical illustrationforsucha scenariois a softwareagentthatdoesproductandmerchantbroker-ing on behalfof a customerwhenvisiting variousmerchantsystemsat dif-ferent locations.There are several agent-mediatedelectronic commercesystemsalreadydeployedasdescribedin [GMM98]. Securedatacollectionschemescan also be used to carry out a distributed auction where themobileagentcollectsbidsfrom severalbidders.Anotherexampleis thecol-lection of datain stockmarketswheredataareavailableat different loca-tions.In theseexamplestheemphasisonsecurityis shiftedfrom themobileprogramto the datathat is collectedfrom the visited hosts.The collecteddatais subjectto disclosure,modification,andrepudiationby singlehosts,agroup of colluding hosts, or network intruders.

We suggestan original integrity schemeto protect the datasubmittedtomobile agentsby competing hosts visited by the agent. The integrityschemeensuresthe protectionof eachpieceof dataagainst tamperingbypartiesother than thoseat the origin of the data(the host that previously

Page 138: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

120

submittedthe data).The integrity of the entiresetof datacollectedby themobile agentis assuredbasedon an original securecryptographicmecha-nism using discreteexponentials.Thanksto the propertiesof our mecha-nism, the data collection protocol offers three advantages:

• Eachhostcanupdatethedatait previously submittedwithout additionalmemory space;

• The integrity verificationmechanismis independentof the sequenceofindividual data submissions by different hosts;

• The integrity verificationis not computationallyintensive anddoesnotdependon thenumberof updates.Moreover, thecomplexity of theveri-fication does not increase significantly with the number of visited hosts.

Theupdatefacility is suitablefor commercialcompetitionasrequireddur-ing an auction,andit allows for the collectionof large quantitiesof infor-mationthat changefrequentlyasin the caseof dynamicscenariossuchasstockexchangemarkets.Unlike techniquesthat rely on appendingdata,inour casethereis no increasein spacerequirements.Thesecondpropertyofthe protocolallows for the collectionof datafrom hostswithout any con-straint on the itinerary performed by the mobile agent.

Thechapteris organizedasfollows.Section2 and3 presentthedatacollec-tion scenarioandprovide a modelfor sucha scenario.Section4 formalizesthe security requirements.Relatedwork is presentedin section 5. Thegenericcryptographictechniquefor dataintegrity is presentedin section6.Thedatacollectionprotocolbasedon this techniqueis describedin section7. Finally, section8 is devotedto the evaluationof the securitypropertiespreviously defined.

8.2 Data Collection System

Thepurposeof a datacollectionsystemis to allow mobileagentsto travelamonghostsof a network to collect individual datasegmentsfrom thesehostsandto returnthe setof datasegmentsto the originatorof the agent.Eachdatasegmentcollectedby the agentcaneitherbe the resultof somecomputationby theagent,basedon somelocal input,or simply theinput of

Page 139: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 121

Data Collection System

somedataby the visited host without any processingby the agent.Oursecurityschemeassuresthe integrity of datasegmentsagainst tamperinganddeletionattacksthatmight originatefrom a hostvisitedby theagent,asetof colludinghostsor anintruderon thenetwork. Thesecurityof thepro-cessusedto generatethe datasegmentsat eachhostis out of the scopeofour scheme,basedon the assumptionthat, even thougheachhost mightbehave maliciously against other hosts, each host can be trusted withrespect to the generation of its own data.

The migration processis anotherimportantaspectof the datacollectionschemewith respectto thesecurityof thecollecteddata.By controllingthemigrationprocess,malicioushostscanhave a significantimpacton thesetof datasegmentscollectedby theagent.Our dataintegrity schemedoesnotaddressthesecurityof theagent’s itinerary. Again, this calls for techniquesfocusingon the integrity of codeexecution in untrustedenvironmentsasdescribed in chapter 3.

Figure 8.1 Data collection scheme

H0

H1

H2

H3

Hn-1Hn

D1

Dn-1

D2

D3

Dn

Page 140: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

122

8.3 Model

In a typical datacollection scenario,the mobile agentis generatedby itsownerH0 andvisits intermediatehostsHi basedon certainmigrationdeci-sionswhich arebeyond the scopeof this thesis.EachintermediatehostHi

submitsa pieceof dataDi asdepictedin Figure8.1. In addition,eachhost

computesan integrity proof value aspart of the securedatacollection

scheme.This valuewill be integratedon the overall integrity proof value, includedin the agentandcomputedby the previous hostHi-1. The

new integrity value and the set of data segmentscollected

from the previously visited hostsD={D0, D1,..., Di} aretransmittedto thenext host.

Thedatacollectionschemeallows theagentto visit hoststhatwerealreadyvisitedandallows thesehoststo updatethedatapiecesthey havepreviouslysubmitted.When the data collection processterminates(or the agent iscalledback),theagentreturnsto theagentownerH0. At thispoint theagentreturnsto its originatorthesetD of datasegmentscollectedfrom all thevis-ited hostsand the final integrity proof value . The agentowner canthenverify theintegrity of thedatasegmentsin D using . Table1 sum-marizes the components involved in the secure data collection process.

H0 agent owner

Hi,visited hosts

Di,data collected from Hi

Pi, integrity proof associated with Di

D set of data collected, i. e.{D 0, D1,..., Di}

set of integrity proofs, i. e. {P0, P1,...,Pi}

integrity proof associated with all the elements of setP

Table 8.1 Data collection components

Pi

Γ P( )Γ P Pi{ }∪( )

Γ P( )Γ P( )

1 i n≤ ≤

1 i n≤ ≤

1 i n≤ ≤

P

Γ P( )

Page 141: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 123

Security Requirements

8.4 Security Requirements

Thedatacollectionprocessis exposedto a numberof attacksfrom networkintrudersandlegitimatehostsbehaving maliciouslywith respectto compet-ing partiesasexplainedin [KAG98].Theseattacksraisea numberof secu-rity requirements as follows:

• Data Integrity . Di cannotbe modifiedor updatedby partiesotherthanHi;

• Truncation Resilience.Only the datasegments , submitted

betweenthefirst malicioushostHi andanothermalicioushostHk canbetruncated from the set of data pieces;

• Insertion Resilience.No datasegmentcanbe insertedunlessexplicitlyallowed;

• Data Confidentiality. Di cannotbedisclosedto partiesotherthanHi andH0;

• Non-Repudiation of Origin. Hi cannotdeny having submittedDi onceit was actually included in the set of collected data.

Ourdefinitionof thedataintegrity requirementexpandsthepreviousdefini-tionsin [KAG98] and[Yee97]in thesensethata hostcanupdatethedataitpreviously submitted.We believe that theupdatefacility is requiredin freecompetitionanddynamiccommercialenvironments,like stockmarketsandauctions.Theinsertionresiliencepropertyaimsat restrictingthenumberofhosts that can participate thus enabling elementary access control.

Dataconfidentialityandnon-repudiationarenotmandatoryin all scenarios.In somereal life scenarioslike auctions,the confidentialityservicemighteven be conflicting with the free competitionmodel. It is still an openresearchproblem how to keep a secretfrom the execution environmentwhen this secrethas to be usedduring the agents’trip comprisingonlyuntrustedenvironments.Therefore,not beingableto carryany secretkeys,agentscannotaccesspreviouslyencrypteddataduringthetrip. This impliesthatthecollecteddatacannotbeusedasaninput for thenegotiationprocessfor example.Nevertheless,like the protocolsproposedin [KAG98], ourdata collection schemecan be easily enhancedwith data confidentiality

D j i j k< <,

Page 142: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

124

basedonpublickey encryptionandwith non-repudiationof origin basedondigital signatures.

A limitation of datacollectionschemesbasedon dataintegrity mechanismsis thedegreeof truncationresiliencethatcanbeoffered.As pointedout in[Yee97],thecollusionbetweentwo malicioushostsallows for thedeletionof the datacollectedon the pathbetweenthemby substitutingthe datasetwith a copy recordedprior to thebeginningof the truncatedpath.It seemsto be an inherentlimitation regardlessof the way the integrity function iscomputedin eachscheme.Solutionsbasedon time stampssuffer from theprobabilistic natureof the network transmissiondelays.One could alsothink of assuringtheintegrity of themigrationpathin additionto theinteg-rity of thecollecteddataasthesolutionfor thetruncationattack.Neverthe-less, the integrity of the migration process does not avoid possiblecollusionsbetweenhostsvisitedto performa truncationattack,but this canbealleviatedby keepingthehostsanonymous.Ontheotherhand,apossiblesolutionis the publicationof resultsafter the trip in orderto allow visitedhoststo verify and complain if needed,as suggestedin [KAG98]. Thisrequireshoststo maintaindatabaseswith all the datasubmittedto agents.Alternatively a pre-definedlist of hosts with a mandatorysubmissionschemecould also solve the truncationproblem.This may be donewithexplicit emptyoffers,andthemandatorysignalizationof theendof partici-pation on the process.

8.5 Related Work

Prior work addressingthe integrity of collecteddata[KAG98][Yee97]usesa techniquecalled hashchainingas the basicmechanismto achieve theintegrity of the datapiecessubmittedby visited hosts.The result of thechainedhashcomputationsis theproofof integrity for all thecollecteddata.This techniqueis suitableto createsecureaudit logs[BY97] dueto its effi-ciency in termsof computationalcomplexity andsizeof theintegrity proof.In thecaseof audit logs,it is importantto keepa tamper-proof recordof allthe operationsperformedin a resilient way for further analysis,so it isimportant to keep the order of the events.

Page 143: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 125

Related Work

The data collection schemesuggestedby [Yee97] and [KAG98] differsfrom thesolutionpresentedin this thesisregardingvariousaspects.Oneofthe objectives of the data collection schemespresentedin [Yee97] and[KAG98] is to preventhostsfrom updatingthedatathey previouslysubmit-ted.Theseschemesallow closedbids andincludedataconfidentialityandhost anonymity as a basicrequirementin order to assurefairnessamongcompetinghosts.Host anonymity is a solution to avoid that hostscannotquerythe previously visited hostsin orderto have accessto the submitteddata.Our solutionin contrastaddressesa dynamicscenarioincluding sev-eral roundsof competingoffers betweenbidders.As a result, unlike thesolutionsin [Yee97]and[KAG98],our schemeallows for multiple updatesof eachdatapieceby the submittinghost.Therefore,dataconfidentialityandhostanonymity arenotmandatoryrequirementsfor building afair com-petition scenario.

Furthermore,hashchainingas a basicdataintegrity mechanismdoesnotmeettherequirementsof our datacollectionscheme.Hashchainingis tiedto animplicit sequenceamongthevariousdatapiecesthatareprotectedandthe knowledgeof the sequenceis mandatoryfor the verification process,that is, the verificationprocesshasto computethe hashchainin the sameorderasthedatacollectionprocess.In dynamicscenariossuchasauctionsandstockmarketswhereeachdatapiecemaybeupdatedseveral times,thehashchainingmechanismwould requireto keeptrackof all thepastvaluesfor eachdatapiece.Ourschemeis thusbasedonanovel dataintegrity tech-niquecalleda setauthenticationcodethatallows for theverificationof themostrecentvalueof eachdatapiecewithout keepingtrack of pastvalues.With our set authenticationcode,the computationof the integrity checkvalueandits verificationcanbeperformedin randomorderwith respecttothe data pieces.

Ourschemeaimsatascenariothatfosterscompetitionby keepingtheinfor-mation from competingsourcesin cleartext and by authorizingfrequentupdates,whereas[KAG98] and[Yee97]assumea rigid scenariobasedonwidespreadconfidentiality. While our schemecanbeeasilyenhancedwithclassicalconfidentiality mechanisms,confidentiality can hardly be sup-pressedfrom thesolutionsin [KAG98] and[Yee97]becauseof thefairnessproperty between hosts.

Page 144: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

126

On the otherhand,on its itinerary from host to host, the agentcarriesanincreasingamountof datathatmightbeexploitedby amalicioushost.Theirconfidentialitycanbeachievedat eachstepof theagentitineraryby a sim-pleencipheringon thecurrenthost,beforetheagentmoveselsewhere.WithRSA-basedencryption,securitywill beensuredbut thedatacarriedby theagentcanbevery small: thesizeof thedatapaddingwill thenbeexcessive.Sliding encryption[YY97] aims at retainingequivalent security, using alarge key, while at the sametime, taking into accountthe limited storagecapacity of an agent.Sliding encryption is aimed at conservingspace,which might beof importancefor agentsthatcollectsmallamountsof dataon many differenthosts.Therefore,this solutionaddressesa differentprob-lem.

8.6 Set Integrity

This sectiondefinesanoriginal cryptographicmechanismat thecoreof theproposeddatacollection algorithm.We build a “set authentication code”using the difficulty of solving the discretelogarithm problem in a finitefield, in combinationwith a classicalcryptographichashfunction. Thismechanismprovides a methodto authenticatetogethera set of dataseg-ments in an order-independent fashion.

8.6.1 Generator sequences

Let p bea largeSophieGermainprime(alsocalleda strongprime), that iswhereq is also prime. Define g as a generatorof the cyclic

groupGF(p). Thenfor all x in , isalsoa generatorof the cyclic groupGF(p). Hencethe following sequence

is a sequence of generators in GF(p), as depicted in figure 8.2:

p 2q 1+=

X 1… q 3–( ) 2⁄{ }= g' g2x 1+ mod p=

Gi( )i 0≥

G0 g=

Gi 1+ Gi( )2xi 1+ 1+ mod p=

Page 145: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 127

Set Integrity

where is a sequence inX [Kob94].

Figure 8.2 Generator sequence

The advantageof this constructionis that the result is alwaysa generator,which has the properties referred in the next section.

8.6.2 Properties

• Property 1 - Security. With the knowledgeof any and , it is

computationallyUnfeasibleto compute . Solving for would

require an adversaryto solve a discretelogarithm to the base in

GF(p) [DH76];

• Property 2 - Commutativity. If is defined by the sequence

thenfor any definedfrom a permutationof ,

we have . This secondpropertyis basedon the commutativity

of the exponent field GF(p-1);

• Property 3 - Cancellation. With theknowledgeof and , it is

possible to compute as:

• Property 4 - Computational complexity. With theknowledgeof theset, the computationof requires2n multiplications,n addi-

xi( )i 0>

G0 G1 Gi Gi+1. . .

g2x1 1+

g2x1 1+( )… 2xi 1+( )

g

2x1 1+ 2xi 1+ 1+ 2xi 2+ 1+2x2 1+

g2x1 1+( )… 2xi 1+( ) 2xi 1+ 1+( )

Gi Gi 1+

xi 1+ xi 1+

Gi

Gi 0>

x j( )0 j i≤< G'i 0> x j( )0 j i≤<

Gi G'i=

Gi 1+ xi 1+

Gi

Gi Gi 1+( )1

2xi 1+ 1+-----------------------

mod p=

xi( )0 i n≤< Gi

Page 146: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

128

tions and only1 exponentiation since:

8.6.3 Set Integrity Function

The combinationof property 2 and3 allows us to work on setsinsteadofsequences,thus we define a set function which takes anunordered set of elements inX and produces an element in GF(p):

• (property 3)

where and .

Let h bea cryptographichashfunctionand a setof secretkeys

along with a set of data segments.Then if we apply to

, we form a set authenticationcode ,

with the following core properties:

• cannot be computed without the knowledge of .

• Removing or modifying a datasegment from , while maintain-

ing theintegrity of theset,requirestheknowledgeof thesecretvalue .

This combinationof cryptographictechniquesallows us to computea "setauthentication code" thatwewill useto securelycollectdatasegmentsfroma set of hosts.

Gi g2x1 1+( ) 2x2 1+( )… 2xn 1+( )

mod p=

Γ:X GF p( )→

Γ ∅( ) g=

Γ P x{ }∪( ) Γ P( )( )2x 1+ mod p=

Γ P x{ }–( ) Γ P( )1

2x 1+---------------

mod p=

P X⊂ x X∈

K i( )0 i< n≤

Di( )0 i n≤< Γ

P Pi h Di K i( ) 0 i n≤<,={ }= Γ P( )

Γ P( ) K i( )0 i< n≤

Di Γ P( )

K i

Page 147: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 129

Data Collection Protocol

8.7 Data Collection Protocol

In thissectionwedescribeourdatacollectionprotocolusingthesetauthen-ticationmechanism.Unlessotherwiseindicated,this sectionusesthenota-tion of the previous section, whereby h denotesa collision-free hashfunction (for exampleMD5 [Riv92]), p is a public prime and“|” denotesconcatenation.

Ourprotocoldoesnot rely onapublickey infrastructure.However, asharedkey betweenthesourceandeachof theparticipanthostsis needed.Thegen-erationof the individual integrity proof for eachdatasegmentby a visitedhostrequirestheknowledgeof a secretkey sharedbetweenthesourceandthe visited host.In orderto performthe verificationof the global integrityproof, thesourcehasto know all theindividualsecretssharedwith thehostsvisited by the agent.

8.7.1 Setup

EachhostHi>0 exchangesa secretsharedkey with the source

H0. For example, canbe exchangedusingthe Diffie-Hellmanprotocol

[DH76].

The source sendsan agentto visit a setof hosts with an

initial set authentication value and an empty data collection listD:

8.7.2 First visit

Each host visited by the agent for the first time, receives:

K i i 0< n≤,

K i

H0 H1 … Hn, ,{ }

Γ

Γ P( ) Γ= ∅( ) g mod p=

D ∅=

H i

Γ P( ) Γ= P1 … Pi 1–, ,{ }( )

D D1 D2 … Di 1–, , ,{ }=

Page 148: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

130

It computes and then sends:

The submission of an offer is not mandatory for each visited host.

8.7.3 Update

An offer is updated by host to a new value in 3 steps:

• The old offer is replaced by the new offer in D;

• An intermediatesetauthenticationvalue is derivedfrom bycancelling out ;

• Thenew setauthenticationvalue is computedtakinginto account.

The first stepis straightforward. In the secondstep,property 3 is usedtocompute a new set authenticationvalue that does not include

:

In the third step, we use the new value and update it with:

Pi h Di K i( )=

Γ P( ) Γ= P1 P2 … Pi 1– P, i, , ,{ }( )

D D1 D2 … Di 1– Di, , , ,{ }=

D j H j D' j

D j D' j

Γ P '( ) Γ P( )P j

Γ P ''( )P' j

Γ P '( )P j h D j K j( )=

Γ P '( ) Γ P P j{ }–( ) Γ P( )( )1

2P j 1+------------------

mod p= =

Γ P '( )P' j h D' j K j( )=

Γ P ''( ) Γ P ' P' j{ }∪( ) Γ P '( )( )2P' j 1+

mod p==

Page 149: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 131

Security Evaluation

8.7.4 Verification

Oncetheagentgoesbackto thesource , thesourcecanverify theinteg-

rity of the set of offers by usingproperty 4 to check that:

where is the integrity check value received by the source.

If thisconditionfails,noneof theoffersareconsideredasvalid. It shouldbenotedthat thecostof verificationis muchlower thanthecostof generationof . During thedatacollectionprocess,thesubmissionof

eachdatapieceDi requiresthe computationof a discreteexponentiationwhereasthe verification of the integrity value for the entire set of datarequires only a single exponentiation.

8.8 Security Evaluation

This sectionfocuseson the evaluationof the securitypropertiesdefinedbefore for secure data collection schemes.

8.8.1 Data Integrity

Dueto thesharedsecret,eachsegmentof collecteddatacanonly bemodi-fiedby its originator. Tamperingwith adatasegmentor unauthorizedmodi-fication thereof by intruders will be detected by the source. Datamodificationattemptsby an intruder may consistof the updateof a datasegment with a new value generatedby the intruder or of the

replacementof the currentdatasegmentwith an old valuethat wasprevi-ouslysubmittedby its legitimateorigin. Bothtypesof modificationattemptswouldrequiretheintruderto first cancelout theintegrity proofPi of thecur-

rentdatasegmentfrom theglobalintegrity proof . ComputingPi from

the actualdatasegment requiresthe knowledgeof the secretKi shared

H0

Γ P( ) g2P1 1+( ) 2P2 1+( )… 2Pn 1+( )

mod p=

Γ P( )

Γ Pi 0 i n≤<( ){ }( )

Di D'i

Γ P( )Di

Page 150: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

132

betweenthe origin of the datasegmentand the source.Appendinga newdatasegmentcomputedby the intrudersimilarly would requiretheknowl-edgeof thesharedsecretKi. Theintruderis thusunableto eithergetanoldvalueof Pi or to computeanew onethatis valid withoutknowing thesharedsecret.Anotherpossibleattackconsistsof retrieving pastvaluesof Pi com-puted by the origin of the data segment.A possiblemodification attackwould consist of deriving Pi from and . That would

requirethe computationof a discretelogarithm which is known to be ascomputationally unfeasible.

8.8.2 Truncation Resilience

Truncationof oneor several datasegmentsfrom a valid offer by a singleintrudercanbereducedto thedataintegrity problem.Thustruncationresil-iencerelieson the dataintegrity property. As alreadydiscussedin section8.4,collusioncanresultin the truncationof datasubmittedby all thehostsvisited on the path between two colluding hosts.

8.8.3 Insertion Resilience

No datacanbeinsertedby unauthorizedpartiesbecauseonly hosts shar-

ing a secret key with the source can generate a valid integrity proofPi.

8.8.4 Confidentiality and Non-Repudiation

As explainedin section8.4,dataconfidentialityandnon-repudiationarenotconsideredpart of mandatoryrequirementssincethe main purposeof oursecurityschemeis dataintegrity in a free competitionenvironment.None-theless,thesemissingfeaturescaneasilyberetrofittedin thedatacollectionschemeusing classicaldataencryptionand digital signaturemechanisms.For example,dataconfidentialitycaneasilybeensured,encryptingthedatawith the shared key.

Γ P( ) Γ P Pi{ }∪( )

H i

K i

Page 151: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 133

Conclusion

8.9 Conclusion

In this chapter, we describedan original protocol to protectdynamicdatacollectedby mobile agentswhenroamingthrougha setof hosts.We onlyconsideredperfectlyautonomousagents,i. e., without any communicationwith the source or with some kind of trusted party.

Unlike prior work, our protocolallows hoststo updatetheir own submis-sionswithout keepingtrack of pastvaluesandto submitdatain a randomorderthanksto theoriginal setauthenticationtechnique.Our protocoldoesnot rely on a public key infrastructure.However, a sharedkey betweentheorigin and each host is needed.

This techniquealsoallows the sourceto verify the integrity of all the col-lecteddatasegmentswithout knowing thesequenceof datasubmissionsbyeachhost.Moreover, thesizeof theintegrity proof is smallandindependentof thenumberof hostsor updates,andtheverificationis not computation-ally intensive.

8.10 References

[BY97] Mihir BellareandBennetYee.Forward integrity for secureauditlogs. Technicalreport,UC at SanDiego, Dept. of ComputerScienceandEngineering, nov 1997.

[DH76] Whitfield Diffie andMartin Hellman.New directionsin cryptogra-phy. IEEE Transaction on Information Theory, 22(6):644–654,November1976.

[GMM98] R. Guttman, A. Moukas, and P. Maes. Agent-mediatedelec-tronic commerce: A survey. Knowledge Engineering Review, June 1998.

[KAG98] G. Karjoth,N. Asokan,andC. Gulcu.Protectingthecomputationresultsof free-roamingagents.In Kurt RothermelandFritz Hohl, editors,

Page 152: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

134

Proc. of the Second International Workshop, Mobile Agents 98, pages195–207, 1998. Springer-Verlag Lecture Notes in Computer Science No. 1477.

[Kob94]Neal Koblitz. A course in number theory. Springer-Verlag, 1994.

[Riv92] RonaldL. Rivest. The MD5 message-digestalgorithm. InternetRequest for Comments, April 1992. RFC 1321.

[Yee97] Bennet Yee. A sanctuaryfor mobile agents.Technical ReportCS97-537,UC at SanDiego, Dept.of ComputerScienceandEngineering,April 1997.

[YY97] A. YoungandMoti Yung.Sliding encryption:a cryptographictoolfor mobile agents. In Proc. 4th International workshop fast softwareencryption 97, 1997.Springer-VerlagLectureNotesin ComputerScienceNo. 1267.

Page 153: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

135

CHAPTER 9 Conclusion

Mobile codeis generallyjustified on the groundsof greaterefficiency andincreasedflexibility evenif thesefeatureshave not beenfully exploitedyet.However, thisflexibility doesnotcomewithoutaprice:thereis anincreasedexposure to security threats.

Amongvarioussecurityconcernsraisedby mobilecode,we addressedtheonesrelatedto maliciousinteractionsbetweenmobilecodeandtheruntimeenvironment.We consideredtwo differenttypesof protectionmechanismsto counter possible malicious behaviors:

• Host protection aiming at preventing harmful operationscausedby amalicious mobile code on the resources of the runtime environment;

• Mobile code protection requiredto assurethe privacy and integrity ofmobile codeagainst possibleattacksfrom a maliciousexecutionenvi-ronment.

Based on recent research developments, we believe that a high level of hostprotection is achievable. Thereis currentlya trend towardsenablingfinergrainedaccesscontrol schemes.The deployment of theseschemeswillprobably enable widespread applications of mobile code in the near future.

Page 154: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

136

The protection of a mobile code against a malicious host is an openresearch topic. The problemasa whole is consideredhardandviewed asunfeasibleby someresearchers.We distinguish the problems related to codeprotection and those related to data protection.

The problems related to mobile code execution on an untrusted runtimeenvironment are quite atypical. We analyzedtwo aspectsof this problem:privacy of execution, treatedin Chapter2 andintegrity of execution treatedin Chapter3. Privacy of executionaimsat preventingthe disclosureof thecodesemanticsduring the executionof the codeon an untrustedrun-timeenvironment.Integrity of executionfocuseson thecorrectnessof codeexe-cution.An exhaustive studyof possibleapproachesto thesetwo problemswasexplored.In Chapters2 and3, we providedcomprehensive surveys oftheaboveproblems.Thesesurveysarecomprehensive in thesensethattheyincludeapproachesrangingfrom theoreticalcomputerscienceto practicalsolutions.

Concerningprivacy of execution, therearesolutionsofferingstrongsecurityin the field of securefunction evaluation and multiparty computations.However, thesesolutionsarefar from practicalusedueto their complexityand their limited coverage.Additionally, the overheadimposedby thesesolutionsmaycompromisethe fragile advantagesof themobilecodepara-digm. Namely, the complexity of non-interactive solutionsfor privacy isprohibitive for practicalapplications.Non-interactivity is a mandatoryfea-tureof autonomousmobilecode.Ontheotherhand,practicalsolutionssuchas codeobfuscationsuffer from the lack of solid assumptionson whichsecuritycanbe based.Solutions for protecting the privacy of mobile codeagainst the execution environment are still in their infancy. Thedefinitionofa setof requirementsfor thedesignof solutionstacklingprivacy of execu-tion was the final contribution of Chapter 2.

Integrity of execution is anothercrucial requirementfor the affirmation ofthe mobile codeparadigm.Without having a way of preventingor at leastdetectingthe correctnessof the execution of mobile code, applicationsappearto be restrictedto thoseinvolving only trustedparties.Onceagain,the field of theoreticalcomputersciencehasdevelopedseveral techniquesto addressthis problem.The ideabehindthesetechniquesis to provide aproof of correctnesstogetherwith the result,with the objective of making

Page 155: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 137

theintegrity verificationeasywhencomparedto thecomplexity of thecom-putationof theproof.More practicalapproachesprovide a log of executionwith the result. In the field of result checking,we found very interestingsolutions.However, they did not take into accountthemaliciousbehavior oftheexecutionenvironment.Anotherapproachis to performredundantcom-putationsandto electthe resulton a voting basis.We proposeda differentway of expressingthe requirementof integrity of execution in order toachieve more efficient solutions.

We believethat integrity of executionis necessarybut not sufficientwithoutprivacy for certainapplications. Whena malicioushostcanre-executethecodeanunlimitednumberof times,evenwithout tamperingor reverseengi-neeringthecode,it canchoosethebestresultfrom thesetof results.Appli-cationssuch as bargaining motivated this reflection. In order to developsolutions for these applicationswe need privacy and integrity of execution.

We usedtheclassof Booleanfunctionsasa computationalmodelto designoursolutionsfor privacy andintegrity of execution.Basedon thismodelthesecurity of the solutionscould be related to well known computationalassumptions.Unlike othermodelsthataresuitablefor formal securityeval-uation,Booleanfunctionsallow for therepresentationof realisticcomputa-tional models, such as Random Access Machines.

The cryptographic tools chosento addressthe code protectionproblemwere found in the field of coding theory. The main ideawas to constructprogramsthat wereresilient to executionerrors,asdatamay be protectedagainsttransmissionerrorsusingerrorcorrectingcodes.On theotherhand,coding theory includeshard instancesof problemsthat are usedto buildcryptosystems.The studyof the advantagesandweaknessesof thesesys-temsin Chapter4 revealedinterestingpropertieswhile providing guidelinesfor the design of secure solutions.

We definedthe properties that a framework for mobile code protectionshouldsatisfy. Namely, we neednon-interactive andefficient solutions.Wedevelopedoriginal solutionsto mobilecodeprotectionwithoutTPH.Thesesolutions,presentedin Chapter5, addressedboth privacy and integrity ofexecution.Nevertheless,thesolutionsdid not allow multi-stepapplications

Page 156: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

138

to beperformedin a non-interactive scenario.Thus,thesolutionwasboundto a single function execution (without interaction with the code owner).

We extendedthesolutionto a more powerfulcomputationalmodelusingalimited TPH in Chapter6. The possibility of using a limited TPH in theremotehostactingon behalfof the function owner wasconsideredasoneway to overcomethelimitation of thesolutiondevelopedin Chapter5. Fur-thermore,weconsideredthelimitedcapacityof theTPH. Theobjectivewasnot to executethefunctionsontheTPH,but to performthecomputationsontheuntrustedhostwhile having a "small" fragmentof thecomputationper-formedin theTPHin orderto verify and"complete"theuntrustedcomputa-tion. In otherwords,theaim is to extendtheintrinsicsecurityof theTPHtotheoverall environment.In addition,thesolutionsmustbeprovedlesscom-plex whencomparedto thecaseof downloadingthecodeinto theTPH andexecutingthe codethere.In the solutionspresentedin Chapter6, a smallpieceof codeis downloadedinto theTPH thatallows theintegrity verifica-tion and the calculationof the cleartext result to be performedwhile themain computation remains on the untrusted environment. In the firstscheme, theTPH verifiestheintegrity of theresulteach timea computationis done. Weproposedanothersolutionwheretheverificationof theresultsisdoneoff-line (at theendof a numberof computations)in orderto enhanceefficiency. This solutionis especiallyinterestingto constructanoverall ver-ification value transmittedback to the function owner. This verificationvalue can be considered an efficient proof of computation.

In Chapter6, we implicitly assumedthat a securestoragemediumin thetrustedTPH wasavailable.Due to the limited storagecapacityof a TPH,such as a smartcard,we thought of achieving securestoragewithin theuntrustedhost.In Chapter7, wesuggesteda schemebasedon thememorychecker conceptfor the protectionof the data stored in untrustedmemory.Memory checkersdealwith the problemof integrity of the datastoredinuntrustedmemories.We extendedthis conceptby includingdataprivacy inthe setof requirements.We definedthe conceptof a secure memoryman-ager, which is anothercontribution of this dissertation.In addition,wepro-posedan original architecture for codeanddata protectionthat combinedthe techniquesof memoryprotection(Chapter7) and of codeprotection(Chapter6). As opposedto our architecture,theexisting solutionsfor soft-wareprotectionhave alwaysconsideredthe computationastrusted.How-

Page 157: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Mobile Code Protection 139

Unanswered Questions

ever, our architecture is not fully defined, leaving some securityrequirements as open research topics.

Finally in Chapter8, we turnedour attentionto theproblemof dataprotec-tion in a specificscenario.We proposeda solutionfor dataprotectionin ascenariowhere mobilecodegathers dataamonga setof hosts. Thegoal isto protect collected segmentsagainst attackscarried out by competinghosts.Our solution hasthe interestingfeatureof allowing updatesof thedatasegmentsalreadysubmittedby agivenhost,while preservingtheinteg-rity of all the datasegmentswith a small authenticationvalue.Therefore,our solution is very efficient in competitive scenarios,suchas distributedauctionsandcomparativeshopping.Thislast solutionshowsthat it is possi-ble to addresssecurity of specificapplicationsin an efficient way usingmore traditional cryptographic tools.

Mobile codeprotectionraisesa large numberof new andatypicalsecurityissuesthat are far from beingsolved in practicalterms,but we believe tohave given someinterestingcontributions and we are optimistic aboutabright future for the field of mobile code protection.

9.1 Unanswered Questions

In this section, we present some possible directions for further research, asfollows:

• An implementationof theerrorfunction,whichoutputswordsof agivenweight wasnot presented.The constructionof efficient error functionsofferingstrongsecuritypropertieswouldbeanimportantadditionto oursolutions;

• We envisageusing more complex function transformationsin order toachieve strongersecurity properties.For example,using several errorcorrecting codes;

• The proposedarchitecturefor codeand dataprotectionwas not fullydefined.We did not addressthe issueof hiding the memoryaccesspat-tern, and that of hiding the sequence of computations;

Page 158: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

140

• We envisage extending the proposed solutions to practical programminglanguages. We are thinking about automatic tools such as obfuscators,but where the security of the transformations applied to the code arerelated to cryptographic problems, as in our schemes for code protection.

Remark: At the end of writing this thesis, the problem of giving the cleart-ext result back to the remote host was addressed in:

J. Algesheimer, C. Cachin, J. Camenisch and G. Karjoth. CryptographicSecurity for Mobile Code. To appear in 2001 IEEE Symposium on Securityand Privacy, May 13-16, 2001.

Page 159: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

141

Publications

S. Loureiro, R. MolvaMobile Code Protection with SmartcardsProceedings of the ECOOP 2000 workshop on Mobile Object SystemsSophia Antipolis, France, June 13th, 2000

S. Loureiro, R. Molva, Y.RoudierMobile Code SecurityProceedings of the ISYPAR 2000(4ème Ecole d’Informatique des Systèmes Parallèles Répartis)Toulouse, France, Feb 1-3, 2000

S. Loureiro, R. Molva, A.PannetratSecure Data Collection with UpdatesSpecialissue"Agents in ElectronicCommerce"of ElectronicCommerceResearch Journal. Yimming Yee and Jiming Liu, editors. To appear.(Preliminaryversionin Proceedingsof the Workshopon Agentsin Elec-tronic Commerce,First Asia Pacific Conferenceon IntelligentAgentTech-nology, pages 121-130, Hong-Kong, December 1999)

Page 160: Institut Eurécom Thèse présentée pour obtenir le grade de ... › ~nsteam › Papers › loureiro.pdf · présentée pour obtenir le grade de docteur de l'Ecole Nationale Supérieure

Publications

142

S. Loureiro, R. MolvaPrivacy for Mobile CodeProceedingsof the OOPSLA’99 Workshopon DistributedObjectSecurity,Denver, US, November 1999

S. Loureiro, R. MolvaProcessfor securingtheexecutionof amobilecodein anuntrustedenviron-ment. European Patent Application 99480057.1, July 1999

S. Loureiro, R. MolvaFunction Hiding based on Error Correcting CodesManuel Blum and C.H. Lee, editors,Proceedingsof Cryptec’99Interna-tional Workshopon CryptographicTechniquesandElectronicCommerce,pages 92-98, Hong-Kong, July 1999