Implementations
⋆
LouisGoubin,Jean-MihelMasereel, andMihaëlQuisquater
VersaillesSt-Quentin-en-YvelinesUniversity
45avenuedesEtats-Unis
F-78035VersaillesCedex
{Louis.Goubin,Jean-Mihel.Mas ereel ,Mi hael. Quisq uate r}uv sq.f r
Abstrat. Obfusationisamethodonsistinginhidinginformationof
somepartsofaomputerprogram.AordingtotheKerkhos
prini-ple,aryptographialalgorithm shouldbe keptpubliwhile thewhole
seurity shouldrelyonthe sereyof thekey.Insomeontexts, soure
odesarepublilyavailable,whilethe keyshouldbekeptseret;thisis
thehallenge ofodeobfusation.Thispaperdealswiththe
ryptanal-ysisofsuhmethodsofobfusationappliedtotheDES.Suhmethods,
alledthenaked-DESandnonstandard-DES,wereproposedbyChow
etal.[5℄in2002.Somemethodsfortheryptanalysisofthenaked-DES
were proposedby Chow etal. [5℄, Jaobet al. [6 ℄, and Linkand
Neu-man[7 ℄.Intheirpaper,LinkandNeuman[7℄proposedanothermethod
fortheobfusationoftheDES.
Inthispaper,weproposeageneralmethodthatappliestoallshemes.
Moreover,weprovideatheoretialanalysis.Weimplementedourmethod
with a C ode and applied it suessfully to thousands of obfusated
implementationsofDES(bothnakedandnon-standardDES).Ineah
ase,wereoveredenoughinformationtobeabletoinvertthefuntion.
Keywords:Obfusation,ryptanalysis,DES,symmetriryptography,
blokipher.
1 Introdution
In reentyears, the possibility of obfusatingprograms has been investigated.
From a theoretial point of view, Barak et al. [1℄ have proven impossibility
results for the task of obfusating omputer programs. In partiular, it turns
out that there exists a family of programs suh that: on the one hand eah
programisnonlearnable(i.e.itsexeutiondoesnotgiveanyinformationabout
itsoriginalsoureode),butontheotherhandeveryobfusator(i.e.theprogram
produinganobfusation)failsompletelywhengivenanyprogramofthisfamily
as input. However it has not been proved that spei instanes, partiularly
ryptographiprimitives,areimpossibletoobfusate.
⋆
AES,theotherfortheDES. TheAESobfusationwasryptanalysedbyBillet
et al. [2,3℄ in 2004. Chow et al. [5℄ also mountedan attak ontheir rst DES
obfusationversion(allednaked-DES).Jaobetal.[6℄andLinkandNeuman
[7℄,proposedtwootherattaksonthenaked-DES.Here,breakingthe
naked-DES meansreoveringtheseretkey.
Aseond versionof DES obfusation,allednonstandard-DES, wasgiven
byChowetal.[5℄.Thisnonstandard-DESisobtainedbyobfusatingtheusual
DESomposedwithinitialandnalseretpermutations.Inthisontext,
break-ingsuhanonstandard-DESimplementationmeansreoveringtheseretkey
andtheseretinitial andnalpermutations.
Moreover,manyindustrialatorshavedevelopedobfusatedimplementations
of ryptographialgorithms, in partiular for DRM, Pay-TV, and intelletual
propertyprotetion.(e.g.loakware[12℄,retroguard[13℄, Yguard[14℄).
Thispaperisstruturedasfollows:InSetion2,wegiveanoverviewofthe
obfusationmethodsgivenbyChowetal.andbyLinkandNeumann.Setion3
isdevotedtoourattakonthenaked-DES.InSetion 4,weadapt ourattak
to thenonstandard DES. Setion5is devoted toourimplementationof this
attak. In Setion 6, we ompare our attak to the oneof Wyseur et al. [11℄.
Finally,weonludein Setion7.Allproofsareavailablein theappendies.
2 DES Obfusation Methods
Chow et al. [5℄ proposed two types of DES obfusation. The rst one, alled
naked-DES,produesanusualDES.Theseondone,alledthe
nonstandard-DES,isaslightmodiationofthestandardDESalgorithm.Thislastversion
istheonetheyreommend.
Letusdesribethenaked-DES(seeFigure7).ThestandardDESis
imple-mentedbymeansofmanyfuntions.Therstoneisananefuntion
M
1
,whih istheompositionoftheinitialpermutation,theexpansion(slightlymodiedinordertodupliateallthe32rightbits),andabit-permutation
φ
0
: IF
96
2
→
IF
96
2
.Therole of
φ
0
isto send48 bitsto theorrespondingS-boxentries,the48 re-maining bitsbeingsentrandomlyto theT-boxentries (seeFigure 8). EightoftheseT-boxesarederivedfromtheeightS-boxesoftheDES(seeFigure1),and
the fourremaining T-boxesare identities (or moregenerallybit permutations,
seeFigure8(
T
12
)).AnanefuntionM
2
,
1
followstheT-boxes.Thisane fun-tionistheompositionofthePandXoroperationofthestandardDES,andabit-permutation
φ
1
(see Figure7). Eahof the16rounds istheomposition of theT-boxesandananefuntionM
2
,i
.Thelastroundisfollowedbyanane funtionM
3
whih istheompositionofaseletionfuntion,andthenal per-mutation. This funtion takesforargumentstheoutputs ofthe anefuntionM
2
,
16
ofthelastroundandreturnstheiphertext(seeFigure 7).IF
s
2
,b
k,l
(s
= 4
or8
). These permutations are referred by Chow et al. [5℄ as io-blok enoding bijetions. Twenty-four or twelve of these io-blok enodingbijetions are onatenatedin order to obtainnonlinear permutations on
IF
96
2
,P
i,j
.EahomponentA
i
isobfusatedbetweenpermutationsP
i,
1
andP
i,
2
.The resulting funtionsP
i,
1
◦
A
i
◦
P
i,
2
are stored in arrays in order to be used by the obfusated program. When onsidering onseutive omponents, the nalpermutation ofthe rst omponent, and the initial permutation of the seond
omponent,anelledout(seeFigure7) i.e.:
(
P
i,
1
◦
A
i
◦
P
i,
2)
◦
(
P
j,
1
◦
A
j
◦
P
j,
2) =
P
i,
1
◦
(
A
i
◦
A
j
)
◦
P
j,
2
.
Thisnaked-DES wasryptanalysedbytheauthorsthemselves[5℄.
Inordertorepairthesheme,theyproposedthenonstandard-DES.It
on-sistsinaddingtwoanebijetions
M
0
andM
4
beforeandafterthenaked-DES, respetively(seeFigure7).ItisnotspeiedbyChowetal.[5℄whetherM
0
andM
4
areblokenoded(i.e.respetivelypreededandfollowedbynonlinear ran-dom permutations). In this paper, weonsider thatM
0
andM
4
are not blok enoded.Furtherimprovementonthe attak ofthenaked-DES were givenbyLink
andNeumann[7℄.Theysuggestedanothersolutionwhihonsistsinmergingthe
T-boxesand theane funtion
M
2
,i
of eah round. This way, we donothave aess to the T-boxes outputs. Moreover, theM
2
,i
funtions of the dierent roundsareblokenodedin anotherway.Inthis paper, we desribe an attak that defeats bothnonstandard-DES
andtheLinkandNeumann'sshemes.
3 Attak on the Naked-DES
Asmentionedbefore,thenaked-DES proposed byChowetal.[5℄wasalready
ryptanalysedinthepapers[5,6,7℄.Inthissetion,weshowhowtoryptanalyse
the improved versionof the naked-DES proposed by Link and Neumann[7℄.
Notethat ourmethod alsoworksforthenaked-DES proposedbyChowetal.
attak.Roughlyspeaking,therstphaseonsistsingeneratingpairsofmessages
(
X
,X
′
)suhthattherightpartoftheimages,through
IP
andtherstroundof aregularDES,areequal(foragivenkeyK
)(seeFigure2.b).Theseondphase onsists in evaluating thosepairsof messages(
X, X
′
)
onthenaked-DES and
in heking a ondition that we speify below. The pairs that satisfy the test
provideakeyandidate.
Fig.2.OneroundofDES,andattakpriniple
Letusgointothedetails.Rememberthat
f
(
., K
)
denotesthefuntionofthe regularDES,wewillalsodenoteitbyf
K
(
.
)
(seeFigure2.a).LetX
beaninitial message,(
L
0
, R
0)
denotes its image throughIP
, and(
L
1
, R
1)
is the image of(
L
0
, R
0)
throughtherstround, i.e.(
L
1
, R
1) = (
R
0
, L
0
⊕
f
(
R
0
, K
))
.Consider afuntionf
,vetorsX
and∆
,thederivativef
(
X
)
⊕
f
(
X
⊕
∆
)
willbedenoted byD
∆
f
(
X
)
.Letusrstmotivateouralgorithm.LetK
beaxedunknownkey. Assumewewanttondtherstround6-bitsubkeyorrespondingtoS
i
(forthe sakeoflarity,wewill restrainourselvestoi
= 1
). Wegenerateandidatekeys suhthat onlythe 6keybits ofS
1
oftherst roundare modied.Foreah of thesekeys,weomputepairsofmessages(X
,X
′
)suhthat,
1.
∆
=
R
0
⊕
R
′
0
iszero,exeptfortheseond andthirdbits.2.
L
′
0
=
L
0
⊕
D
∆
f
K
(
R
0)
Observethat the seond and third bits of
R
0
only aet the output ofS
1
(seeFigure2.a).Therefore,f
(
R
0
, K
)
andf
(
R
′
0
, K
)
areidentialexeptforthe fourbitsorrespondingtotheoutputofS
1
.Underthese onditions,in thenext roundwehave
R
1
=
R
′
1
andL
′
1
(=
R
′
0
)
is idential to
L
1(=
R
0)
exept for at most two bits. Consider nowthese two messagesX
andX
′
appliedtothenaked-DESwiththeorretkeyandidate.
We observe that these bits (non-zero bits of
L
′
1
⊕
L
1
) inuene at most two io-blokenoding bijetionsb
i,
3
andb
j,
3
(see Figure8). If thekeyandidate is wrong, wewill haveR
1
6=
R
′
1
. Therefore many bits will hange at the outputRandomlyhooseamessage
X
.Compute
(
L
0
, R
0) =
IP
(
X
)
withIP
publi.Choose
∆
suhthatonlytheseondandthirdbitsaredierentfrom 0. Foranypossibleandidatevalueof6-bitsubkey:•
ComputeL
′
0
=
L
0
⊕
D
∆
f
K
(
R
0)
.•
ComputeX
′
=
IP
−
1
(
L
′
0
, R
0
⊕
∆
)
.•
ApplyX
andX
′
tothe obfusatedDES andsavethevalues
Y
andY
′
attheendoftherstround.
•
CompareY
andY
′
andomputein howmanyio-blokenoding
bije-tionstheydier.
•
Rejettheandidateifthisnumberisstritlygreaterthan2.Otherwise,theandidateisprobablyorret.
This way, we anreoverthe48 keybits of the rstround of theDES. The8
remainingbitsarefoundbyexhaustivesearh.
Remark 1. This algorithm an produe morethan oneandidate forthe 6-bit
subkey.Itwillprovidewrong6-bitsubkeysintwosituations.
1. Dueto the balanepropertyoftheS-boxesand thefat they mapsix bits
to four bits, four dierent inputs produe the same output. Therefore for
eahS-box,threewrong6-bitsubkeyswillproduethesameoutputasthe
orretkey.Toavoidthisproblem,weanlaunhthisalgorithmwithanother
randominitialmessage,orsimplyanother
∆
.Infat,weonlyhavetohange thevaluesofthebitsofR
0
and∆
orrespondingtotheinputofS
1
(thebits 32,1,...,5). Atually, we an hoose dierent pairs(
X, X
′
)
suh that the
intersetionof thekeyandidates assoiatedto eahof themis theorret
key.
2. The seond one is due to a propagation phenomena. Suppose we have a
wrong6-bit subkeyproduing awrong
S
1
output. It means that there are more than three bits of dierene between(
L
1
, R
1)
and(
L
′
1
, R
′
1
)
. These dierenesouldbemappedtothesameio-blokenodingbijetion,leadingtotheippingofonlytwoio-blokenodingbijetionsattheoutputof
M
2
,
1
. Inthisase,welaunhthisalgorithmwithseveralvaluesforR
0
.Itleadsto severallistsofkeyandidatesandtheorretkeybelongstotheintersetion.Thisway,wrongkeyswillbedisarded.
4 Attak on the Nonstandard-DES
This setionisdediatedto anattakonthenonstandard-DES.Remind that
thenonstandard-DESisanaked-DESwheretheanefuntions
M
1
andM
0
arereplaedbyM
1
◦
M
0
andM
4
◦
M
3
respetively(whereM
0
andM
4
aremixing bijetions,seeChowetal.[5℄).Asmentionedbefore, weassumethattheinputsthat all the other funtions are io-blok enoded using bijetions on
IF
4
2
(thesame priniple applies for the obfusation proposed by Link and Neuman [7℄
wherethebijetionsaredenedon
IF
8
2
).Moreover,weassumethattheT-Boxesfollow the sameordering in the dierent rounds. In what follows, we will not
onsider
IP
(insideM
1
)w.l.o.g,forthesakeoflarity.Inwhatfollows,thetermpreimage willimpliitlyrefertothepreimagewith
respet to the linear bijetion
M
0
. Moreover, we say that a bit of a vetor is touhing an io-blok enoding bijetion if this bijetion depends on this bit.Similarly,wewillsaythatavetortouhes anS-Boxifnon-zerobits touhit.
Our attak on the nonstandard-DES is based on the one on the
naked-DES. Our approah is based ona trunated dierential attak. It onsists in
omputingtheimagesofarandomvetor
X
0
atdierentlevelsintheobfusated DES.Weomparethese values(alled initial-entries)totheorrespondingim-ages of
X
0
⊕
∆
, where∆
satises some onditions depending on the ontext. ThisapproahallowsprovidinginformationaboutthekeyandthematrixM
−
1
0
,gradually. The full key and the matrix
M
−
1
0
will be known at the end of theproess. Thewaywestore informationabout
M
−
1
0
onsistsin onsidering listsofandidatesforpreimagesofunspeiedanonialvetors.Listsofandidates
ontainingonlyonevetorarealleddistinguishedlists.Thisvetoristhena
ol-umnof
M
−
1
0
.Notethattheselistsareatuallyvetorspaesandanbesharedbyseveralanonialvetors.Inpratie,alist
E
willbesharedbydim
E
anon-ialvetors(thatarenotneessaryspeied).Ouralgorithmworkssequentiallyand onsistsin speifying theseanonialvetorsand shortening thelists.Our
methodanthereforebeunderstoodasalteringproess.Thedierentlters
aredesribedbelow.
Setion4.1desribesapreliminarystepalmostindependentofthestruture
oftheblokipher.Itonsistsinndingvetorspaesassoiatedtoapartiular
io-blok enoding bijetion at the input of the rst round. This step allows
gettingglobalinformationabout
M
−
1
0
.Setion 4.2 desribes a set of lters intending to rene information about
M
0
−
1
.Thesestepsarehighlyrelatedtothestudiedblokipher.Therstlter, desribedinSetion4.2,allowsdistinguishingliststhatareassoiatedtoanon-ial vetors belonging either to right bits or left bits of the input of the rst
round (
L
0
orR
0
). The seond lter, desribed in Setion 4.2, extrats all the lists(markedasrightinthepreviouslter)touhingasingleS-box(wewillseethattheselistsplayanimportantrole).Thethirdlter,desribedinSetion4.2,
gathersthelists(markedasleft inthepreviouslter)insetsassoiatedtothe
outputofS-boxes.Setion4.2linksT-Boxes(obfusationofthekeyedS-boxes)
to S-Boxes.This information allowsthelast lter, presentedin Setion 4.2, to
preiselyspeifythe1-to-1linkbetweenthelists(markedasleft)andthe(left)
anonialvetors.
Setion 4.3explains how to extratthe keyandhowto reoverthe full
in-vertiblematries
M
−
1
4.1 Blok LevelAnalysis of
M
1
◦
M
0
Reoveringof the
B
k
's. DenotebyK
k
thespae({0}
4
k
−
4
×
IF
4
2
× {0}
96
−
4
k
)
,and by
K
k
, the spae(IF
4
k
−
4
2
× {0}
4
×
IF
96
−
4
k
2
)
. In what follows, the vetorspae spanned by a set of vetors
S
will be denotedh
S
i
. Also,e
i
denotes the ith
anonial vetor (the position of the one is omputed from the left and startfrom one) ofthe vetorspaeIF
64
2
.The sets{
e
i
∈
IF
64
2
|
i
= 1
. . .
32}
and{
e
i
∈
IF
64
2
|
i
= 33
. . .
64}
will bedenotedbyS
L
andS
R
,respetively.Ideally, wearelookingfor24vetorspaessuhthat theirvetorsinuene
only one io-blok enoding bijetion at the output of
M
1
◦
M
0
. This would allow modifying only the input of one partiular io-blok enoding bijetion.Unfortunately,duetothedupliationofthebitsin
M
1
(beauseoftheexpansionE
) this goal is impossible to reah. We will therefore try to approximate this situation and deal with the drawbaks afterwards. First we will have to givesomenotations,denitions andproperties.
Denoteby
F
: IF
64
2
→
IF
96
2
theobfusationofM
1
◦
M
0
(seeFigure7). LetX
be avetorinIF
96
2
.Denote byπ
k
theprojetionπ
k
: (IF
4
2
)
24
→
IF
4
2
:
X
= (
x
1
, . . . , x
24)
7→
x
k
. Letb
k
be thek
th
io-blok enoding bijetion at the
outputof
M
1
◦
M
0
.ThefuntionF
iswrittenasF
(
X
) = (
b
1
◦
π
1
◦
M
1
◦
M
0(
X
)
, b
2
◦
π
2
◦
M
1
◦
M
0(
X
)
, . . . , b
24
◦
π
24
◦
M
1
◦
M
0(
X
))
.
Denition1. Let
k
beaninteger,k
∈
[1
,
24]
.WedenotebyB
k
thevetorspae{
X
∈
IF
64
2
|
π
k
◦
M
1(
X
) = 0}
. In other words, it is the subspae of vetorX
suh that for any non-zeroomponente
i
ofX
,M
1(
e
i
)
does not touhb
k
, i.e.B
k
=
h
e
j
|
π
k
◦
M
1(
e
j
) = 0i
.Denition2. Let
k
beaninteger,k
∈
[1
,
24]
.Wedenote byE
k
the subspae of vetorX
suhthat forany non-zeroomponente
i
ofX
,M
1(
e
i
)
touhesb
k
,i.e.E
k
=
h
e
j
|
π
k
◦
M
1(
e
j
)
6= 0i
.Fig.3.Example
Remark 2. Note that
IF
64
2
is thediret sumofB
k
andE
k
for anyk
,i.e.IF
We will denote by
B
k
the subspaeM
−
1
0
(B
k
)
, and byE
k
the subspaeM
−
1
0
(E
k
)
.Proposition1. Forany
k
integer,k
∈
[1
,
24]
,B
k
=
{
∆
∈
IF
64
2
|
D
∆
F
(IF
64
2
)
⊂
K
k
}
,theprobabilitythat∆
belongstoB
k
,when∆
israndomlyhosen,isgreater orequalto1
2
4
=
1
16
,and60
≤
dim(
B
k
)
<
64
.CombiningDenition2andProperty1,thevetorspae
E
k
anbedesribedas thesetofvetors∆
suhthat foranyvetorX
0
∈
IF
64
2
,M
0(
X
0)
⊕
M
0(
X
0
⊕
∆
)
hasin totalat mostfournon-zeroomponentse
i
, allofthem touhingthek
th
io-blokenodingbijetionthrough
M
1
.DuetoProperty1,itiseasiertoreover a basis forB
k
's, than forE
k
's. That is why we will rst reoverall theB
k
's. UsingProperty1,weonlyhavetoomputeD
∆
F
(
X
0)
forrandom∆
∈
IF
64
2
anddeterminetowhih spae
K
k
itbelongs.UsingB
k
's,wewillreoverE
k
's,orat least,24vetorspaesE
b
k
ontainingE
k
withminimaldimension.Reovering of the
E
b
k
's. Letus nowexplainhowto reoverE
b
k
.First,letus remark thatforanyX
∈
IF
64
2
andforany∆
∈
IF
64
2
,wehaveD
∆
F
(
X
)
∈
K
k
if andonlyifD
∆
π
k
◦
M
1
◦
M
0(
X
)
∈
K
k
.Letusintroduethefollowinglemma. Lemma1. Letk
be an integer belonging to[1
,
24]
. IfE
j
∩ E
k
=
{0}
for any integerj
distintfromk
belonging to[1
,
24]
,thenE
k
=
\
j
6
=
k
B
j
.
Sine
M
0
isabijetion,thislemmameansthat ifE
j
∩ E
k
=
{0}
foranyintegerj
∈
[1
,
24]
dierent fromk
, thenE
k
=
T
j
6
=
k
B
j
. Nevertheless, due to thebit-dupliation, there exist indies
k
andj
suh thatE
j
∩ E
k
6=
{0}
(and thenE
j
∩
E
k
6=
{0}
). DenotebyJ
k
theset{
j
| E
j
∩ E
k
=
{0}}
,byE
b
k
thesubspaeT
j
∈
J
k
B
j
,andbyE
b
k
thesubspaeT
j
∈
J
k
B
j
wherek
isanintegerbelongingto[1
,
24]
.Proposition2. Foranyinteger
k
∈
[1
,
24]
,E
k
⊆
E
b
k
.Letus introdueaproperty that willallow usto giveanother haraterization
of
J
k
.Proposition3. Foranyinteger
i
∈
[1
,
24]
andfor any integerj
∈
[1
,
24]
dim(E
i
∩ E
j
) = 64 + dim(
B
i
∩
B
j
)
−
dim(
B
j
)
−
dim(
B
i
)
.
A straightforwardappliation of this property to the denition of
J
k
leads toJ
k
=
{
j
∈
[1
,
24]
|
64 = dim(
B
j
) + dim(
B
k
)
−
dim(
B
k
∩
B
j
)}
.This harater-izationwill beusefulin orderto omputeE
b
k
.Ifdim(
E
b
k
) + dim(
B
k
)
>
64
then4.2 Bit Level Analysis of
M
−
1
0
Intheprevioussetion,wewerelookingfordierenes
∆
assoiatedtoaspei io-blokenodingbijetion.ItallowedustogetsomeinformationaboutM
−
1
0
.Inthissetion,wereneoursearhandthiswillallowustogetenoughinformation
about
M
−
1
0
inordertoapplyourmethod onthenaked-DEStononstandard-DES.Ouralgorithmworkssequentiallyandonsistsinalteringproess.The
dierentltersaredesribedbelow.
Searh for Candidates for Preimages of Elements Belonging to the
Sets
S
L
andS
R
. Consider∆
be an element ofIF
64
2
suh thatM
0(
∆
) =
e
i
ande
i
∈ S
L
. The only non-zero bit ofM
1
◦
M
0(
∆
)
touhes only one io-blok enodingbijetion(reallthat wedonotonsiderIP
).Therefore,∆
belongsto a singleE
b
k
. Assume now that∆
∈
IF
64
2
suh thatM
0(
∆
) =
e
i
ande
i
∈ S
R
thenM
1
◦
M
0(
∆
)
has exatly two non-zero bits that may touh the same or twodistintio-blokenodingbijetionsorequivalently∆
belongstooneortwo spaesE
b
k
. In what follows, we will alldouble anelement∆
∈
IF
64
2
suh thatM
0(
∆
)
∈ S
R
andthetwonon-zerobitsofM
1
◦
M
0(
∆
)
touh thesameio-blok enodingbijetion.Forexample,onFigure8,thebitR
2
ouldbeadouble,sine itstwoinstanesareintheinputofT
1
.Byonsideringintersetionsbetweenthe spaesE
b
k
,takenpairwise,weandistinguishpreimagesofelementsofS
R
from doublesorpreimagesofelementsofS
L
.Notethat theintersetions betweenspaes
E
b
k
takenpairwise providemore information.Indeed,E
b
i
∩
E
b
j
ontainspreimagesofunknownanonialvetors. In partiular, ifdim(
E
b
i
∩
E
b
j
) = 1
thenE
b
i
∩
E
b
j
=
h
M
−
1
0
(
e
k
)i
for somek
. In thisase,wealreadyknowthepreimageofanunknownanonialvetor.Whendim(
E
b
i
∩
E
b
j
)
>
1
weanstilltakeadvantageofthisfatevenifitrequiressome extrasearhes.Reovering Middle Bits. Inorder toapply our attakpresented in Setion
3, we needto exatlyknow the preimageof anonial vetorstouhing onlya
singleS-Boxoftherstround (e.g.Rightbits2,3,6,7,10,...).Inwhat follows,
wewill refertosuhaanonialvetorasamiddle bit.If amiddle bitis nota
double,thenitstwoopiestouhtwodierentio-blokenodingbijetions.The
rst opy is in input of an S-box, leadingto at least two bits of dierene at
theend of therst round ofaregular DES,and 4bits in ourase,due to the
expansion.Theseondopyisaby-passedbit(seeFigure1),leadingtoonlyone
bitofdiereneattheendoftherstround.ConsidertheboldpathinFigure8
startingfrom
R
3
bit, inorder tohaveaglobalview.Letusexplainhowweuse thisproperty.Reallthat
X
0
istheinitial-vetordened in Setion4. Foreah dierene∆
belongingtothelistsmarkedasinputofthestudiedT-box,weapplyX
0
⊕
∆
totheobfusatedDESbymakinganinjetionfault.ThismeansthatwesettheT-Ifonlyoneio-blokenodingbijetion(at theoutputoftherstround)diers
fromtheorrespondinginitial-entry,wededuethat
∆
ouldbethepreimageof amiddlebit.Therefore,alistontainingpreimagesofseveralanonialvetorsanbedividedintotwoshorterlists;onelistontainingpreimagesofmiddlebits
whiletheotherontainspreimagesofnon-middlebits.
Fig.4.Injetionfault
Remark 3. IfaT-boxistouhedbymorethanthreemiddlebitsorleftbits,we
deduethatthis T-boxdoesnotontainanyS-box.Notealsothatdoublesan
onlybepreimagesofmiddlebits.Finally,aT-boxtouhedbyadoubleontains
neessarilyanS-box.
Reovering Left Bits. In order to apply our attak presented in Setion
3, we need to know whih group of four anonial vetorsare xored with the
output of eah S-box of the rst round. First, we determine the io-blok
en-oding bijetions that are touhed by the outputs of the studied S-box and
we denote by
BS
this set of bijetions. In Figure 8, we an see thatBS
=
{
b
1
,
3
, b
3
,
3
, b
8
,
3
, b
12
,
3
, b
15
,
3
, b
20
,
3
, b
24
,
3}
fortheS-boxS
1
. Theelementsb
i,
3
ofBS
areharaterisedbyD
∆
m
b
i,
3◦
π
i
◦
M
2
,
1◦
T
◦
M
1◦
M
0(
X
0)
6= 0
,forall∆
m
belonging toalistmarkedasamiddlebitofthestudiedS-box.Then,westoreinanextralist
L
eah∆
markedasleftbitstouhingexatlytwobijetionsofBS
.Thislist ontains all thepreimages assoiated to anonialvetorsthat are potentiallyxoredwiththeoutputoftheS-box.Finally, wend
∆
l
∈ hLi
suhthat forany bijetionb
i,
3
∈
BS
wehaveD
∆
m
⊕
∆
l
b
i,
3
◦
π
i
◦
M
2
,
1
◦
T
◦
M
1
◦
M
0(
X
0) = 0
,where∆
m
belongstoalistmarkedasamiddlebit ofthestudiedS-box. Thisproess is repeated with dierent∆
m
orX
0
, until we nd four linearly independent∆
l
orequivalentlythe vetorspae spanned by the preimages of the searhed anonialvetors.Wethenomputetheintersetionbetweenthisspaeandallthelists.Itallowsusto splitsomeofthemin shorterlists(the intersetionand
theomplementary spaeofthe intersetion).It mayleadto listsontaininga
betweenT-boxesandS-boxes.DuetotheremarkinSetion4.2,weknowwhih
are the T-boxes ontaining an S-box. The probability that a seleted T-box,
denoted by
T
1
, ontainsS
1
is1
/
8
. We determine the two T-Boxes that are touhed by aanonial vetorassoiated to a list marked asrightbit,non-middlebit andassoiatedto
T
1
. SeletingoneoftheseT-Boxesrandomly,the probabilitythatit ontainsS
2
is1
/
2
.Outoftheset ofunseleted T-Boxes,we selettheonethatistouhedbyaanonialvetorassoiatedtoalistmarkedasrightbit,non-middlebit andassoiated tothepreviousseletedT-Box.We
ontinue theproessuntilall T-Boxeshavebeenseleted (seeFigure 5). Note
thattheprobabilitytodeterminetherightorrespondeneis
1
/
8
×
1
/
2 = 1
/
16
.Fig.5. Chaining
Bit Positions. Atthisstage,wehavereoveredbetweenothers,32preimages
orresponding to unspeied left anonial vetors. In order to determine the
orrespondene,weusethefollowingobservationontheDES:
Outofthe four left bitsthat arexoredwith the outputof aspeiedS-Box,
exatly twobeome(inthe seondround)middlebits.
Now,wejust have to apply eah of the preimagesto the obfusated DES and
hekwhether theimageofthisvetorin frontoftheseondroundisamiddle
bit(f.4.2).AssumingthattheT-Boxesfollowthesameorderinginthedierent
rounds, preimagesorrespondingtoamiddle bit (resp.non-middlebit) anbe
distinguishedbyobservingtheindiesofthetouhedT-Boxes.
Forexample,fortherstS-box,amongthepreimagesofthefouridentied left
anonialvetors,
oneofsuhvetorsisthepreimage of
e
23
(resp.e
31
)ifitisthepreimageof amiddlebitofS
6
(resp.S
8
)in theseondround.oneofsuhvetorsisthepreimageof
e
9
(resp.e
17
)ifitisnotthepreimage ofamiddlebitand itisin theinputofS
2
andS
3
(resp.S
4
andS
5
)ofthe seondround.4.3 The Attak
InSetion4.2,wehaveshownhowtoreoverallthepreimagesoftheleft
anon-ial vetors.Inother words,wehavereoveredhalfof
M
−
1
but theirorrespondinganonialvetoris howeverunknown.Therefore,some
olumns of
M
−
1
0
are known up to their positions. Finally, the remaining listsmarkedasmiddlebits ontainpreimages ofsomeanonialvetors
e
i
1
, . . . , e
i
n
(theirnumberisthedimensionofthevetorspaespannedbythelist).Inthis
ase, we selet linearly independent vetors in the list and we assoiate eah
of them to oneof theanonialvetor
e
i
j
.Therefore, we arein theontext oftheattakofthenaked-DESuptosomeadaptations.Inpartiular,wehaveto
hoose
X
0
belongingtothevetorspaespannedbytheknownolumnsofM
−
1
0
.Theevaluationoftherstroundon
X
0⊕
∆
mayleadtosomediulties.Indeed, wehave to hoose∆
belonging to the preimage of middle bits spae whih is notneessarily inludedin thevetorspaespanned by theknown olumns ofM
0
−
1
. It turns out that we have to try all the andidates for this part of the matrixM
−
1
0
.Foreah of theseandidates, wemount anattaklikewedidonthe naked-DES, whih provides 48-bit key andidates. Note that wrong keys
maybereovered.Moreimportantly, heremaybenokeyforthisandidatefor
this partof thematrix
M
−
1
0
. Inotherwords,it meansthatwehavetodisardthisandidate.
In order to determine the remaining part of
M
−
1
0
(olumns assoiated tonon-middlebits),weapplyasimilarpriniplethatweusedforthenaked-DES.
Indeed,weknowthekeyandweknowthat forthenaked-DES forany
initial-message
X
0
there always exists adierene∆
with non-zerorightomponent suhthattherightpartofthedierential(evaluatedinX
0
)oftherstroundis zero.Itmeansthatin theontextofthenonstandard-DES,wrongandidatesfor
M
−
1
0
anbedisarded.DenotebyK
thespaespannedbytheknownolumns ofthe andidateforM
−
1
0
andbyU
theunknown olumnsof theandidateforM
0
−
1
.WehaveK
⊕
U
= IF
64
2
.TheandidateforM
−
1
0
anbedisardedifthereexists
X
0
∈
K
suhthat there doesnotexist∆
withanon zero-omponentinU
suh thattherightpartofthedierential(evaluated inX
0
)iszero.Atthis stage,wehavea48-bit keyandidateandaandidatefor
M
−
1
0
.Wemakeanexhaustivesearhinordertodeterminethe8remainingbitsofthekey.
Foreahofthemwetrytosolvealinearsysteminordertondthematrix
M
4
. Ifthere isnosolutionforM
4
wededuethat the8-bitkeyandidateis wrong. Ifallthe8-bitkeyandidatesare wrong,wedisardthispartiularM
−
1
0
. Notethatthismethodalsoworksif
M
4
hasio-blokenodingbijetionsatitsoutput.Attak on Link andNeumann obfusation: Ourmethods only usethe outputs
oftherstandseond round.Inpartiular,weneverusetheoutputsofthe
T-boxes.Therefore,ourtwoattaks(naked-DES,andnonstandard-DES)anbe
This attak was implemented with a Code. At eah stage of theattak, the
number ofandidates dereases both forthe keyand for
M
−
1
0
. Finally, it willlead toa unique48-bit keyandidate, aunique
M
−
1
0
andidate, and auniqueM
4
andidate.Wehavetestedourattakon thousandsofrandomly generated obfusated implementations of DES (both naked and nonstandard DES).Figure6showstheneessarytimeto ompletetheattak.Weanobservethat
95%oftheattaksrequirelessthan 50seonds,and 75%lessthan17 seonds.
The mean timeis about17 seonds. However,the attaks were exeuted ona
standardPC.Theodewasnotoptimizedandtheperformaneanbefurther
improved.
0
10
20
30
40
50
60
70
80
90
100
0
5
10
15
20
25
30
35
40
45
50
%
ti
m
e
(
s
e
c
)
Fig.6.Repartitionoftheattaksdurations
6 Comparison to Wyseur et al.'s Work
Inthissetion,wetrytolarifythedierenesbetweenourpaperandtheoneof
Wyseuretal.[11℄.Themain advantageoftheirmethodisthattheyareableto
reoverthekeyforthe nonstandard-DES evenwhen thetransformations
M
0
andM
4
arenonlinear.Nevertheless,theydonotreoverthesetransformations, and the only knowledge of the keyis useless. They laim that theproblem isstraightforwardinthelinearaseprovidedthekeyisknown.Asfarasweknow
andwithoutanyadditionaltriks,thisissuerequirestheuseofalgorithmsthat
allowndingthelinearbijetions
A
andB
satisfyingtheequationG
=
A
◦
F
◦
B
, giventhenonlinearfuntionsF
andG
.Thesealgorithmsareexponentialinthe number of variables ofF
(see Patarin et al. [9℄). Our method reovers these transformationsinashort amountoftime,whentheyarelinear.Thenonlinearaseisstillanopenproblem.Finally,Wyseuretal.[11℄onsideranobfusation
In this paper, we have given new tehniques of ryptanalysis for the urrent
obfusation methods of DES. These tehniques rely on a theoretial analysis
and have also been implemented as a C program. We have implemented our
methodwithaCodeandhaveapplieditsuessfullytomorethanathousand
obfusatedimplementationsofDES(bothnakedandnonstandardDES).All
thestudiedinstaneshaveleadtoauniqueandidatefortheDESkeyandforthe
M
0
andM
4
seretlineartransformations.Thekeyandthetwolineartransforms havebeenobtainedwithin 17seondsinaverage.Referenes
1. B. Barak, O. Goldreih, R. Impagliazzo, S. Rudih, A. Sahai, S.P. Vadhan, and
K.Yang. Onthe(im)possibilityofobfusatingprograms. InProeedingsofthe21st
AnnualInternationalCryptologyConfereneonAdvanesinCryptology-CRYPTO
'01,Aug.19-23,2001,pages118.Springer-Verlag,2001
2. O.Billet. CryptologieMultivariablePh.D.thesisUniversityofVersailles,Deember
2005.
3. O.Billet,H.Gilbert,andC.Eh-Chatbi. CryptanalysisofawhiteboxAES
imple-mentation. InHelenaHandshuhand M.AnwarHasan,editors, SeletedAreasin
Cryptography, volume3357 ofLeture Notes inComputer Siene,pages 227240.
Springer,2004.
4. S.Chow,P.Eisen,H.Johnson,andP.vanOorshot.White-boxryptographyandan
AESimplementation. In
9
th
AnnualWorkshoponSeleted AreasinCryptography,
Aug.15-162002,volume2595ofLNCS,pages250270.Springer-Verlag,2002.
5. S.Chow,H.Johnson,P.vanOorshot,andP.Eisen.Awhite-boxDES
implementa-tionforDRMappliations. InProeedingsofACMCCS-9WorkshopDRM,Nov.18
2002,volume2696ofLNCS,pages115.Springer-Verlag,2003.
6. M. Jaob, D. Boneh,and E. Felten. Attakinganobfusated ipher by injeting
faults.InProeedings2002ACMWorkshoponDigitalRightsManagement,
Novem-ber18,2002, WashingtonDC,USA.,2002.
7. H.E. Linkand W.D. Neumann. Clarifyingobfusation: Improvingtheseurity of
white-boxenoding. 2004. http://eprint.iar.org/.
8. J. Patarin and L. Goubin. Asymmetri ryptographywith S-boxes. InPro. 1st
International Information and Communiations Seurity Conferene, pages 369
380,1997.
9. J. Patarin,L. GoubinandN. Courtois ImprovedAlgorithms for Isomorphismsof
Polynomials. InProeedingsofEurorypt'98,volume1403ofLNCS,pages184200.
Springer-Verlag,1998.
10. http://www.itl.nist.gov/pspubs/p46-2.htm
11. B. Wyseur, W. Mihiels, P. Gorissen, and B.Preneel. Cryptanalysis of
White-BoxDESImplementationswithArbitraryExternalEnodings. CryptologyePrint
Arhive,Report2007/104,2007,http://eprint.iar.org/
12. http://www.loakware.om
Proof ofProperty 1:Let
E
betheset{
∆
∈
IF
64
2
|
D
∆
F
(IF
64
2
)
⊂
K
k
}
.Let
∆
be an element belonging toB
k
. LetX
be anelement belonging toIF
64
2
.D
∆
F
(
X
) = (
D
∆
(
b
1
◦
π
1
◦
M
1
◦
M
0(
X
))
, . . . , D
∆
(
b
24
◦
π
24
◦
M
1
◦
M
0(
X
)))
Aording to the denitions, if
∆
∈
B
k
thenM
0(
∆
)
∈ B
k
or equivalentlyπ
k
◦
M
1
◦
M
0(
∆
) = 0
.WrittingD
∆
(
b
k
◦
π
k
◦
M
1
◦
M
0(
X
))
as(1)
,wehave:(1) =
b
k
◦
π
k
◦
M
1
◦
M
0(
X
)
⊕
b
k
◦
π
k
◦
M
1
◦
M
0(
X
⊕
∆
)
=
b
k
◦
π
k
◦
M
1
◦
M
0(
X
)
⊕
b
k
(
π
k
◦
M
1
◦
M
0(
X
)
⊕
π
k
◦
M
1
◦
M
0(
∆
))
=
b
k
◦
π
k
◦
M
1
◦
M
0(
X
)
⊕
b
k
(
π
k
◦
M
1
◦
M
0(
X
)
⊕
0)
=
b
k
◦
π
k
◦
M
1
◦
M
0(
X
)
⊕
b
k
◦
π
k
◦
M
1
◦
M
0(
X
) = 0
This meansthat
D
∆
F
(
X
)
belongs toK
k
or equivalently∆
belongs toE
. WeonludethatB
k
⊂
E
.Let
∆
be any element ofE
. Aording to the denition ofE
, we havein partiularD
∆
(0)
∈
K
k
.Thismeansthatb
k
(0)
⊕
b
k
◦
π
k
◦
M
1
◦
M
0(
∆
) = 0
,
orequivalently
b
k
(0) =
b
k
◦
π
k
◦
M
1
◦
M
0(
∆
)
.
Wededuethat
π
k
◦
M
1
◦
M
0(
∆
) = 0
beauseb
k
isabijetion.Aordingto thedenitions, itmeansthatM
0(
∆
)
∈ B
k
orequivalently∆
belongstoB
k
. ThereforeE
⊂
B
k
.WeonludethatE
=
B
k
.Notethatinfat
B
k
isthekernelofπ
k
◦
M
1
◦
M
0
.Sinerank(
π
k
◦
M
1
◦
M
0)
is less or equal to 4, and greater or equal to 1, we have simultaneously60
≤
dim(
B
k
)
≤
63
and theprobability that∆
belongs toB
k
when∆
israndomlyhosen,isequalto
dim(
B
k)
2
64
.Theresultsfollows.⊓
⊔
Proof of Lemma 1: Firstreall that
B
k
=
h
e
j
|
π
k
◦
M
1(
e
j
) = 0i
andE
k
=
h
e
j
|
π
k
◦
M
1(
e
j
)
6= 0i
. Letj andk betwodistint integers,thenthe following onditionsareequivalent.
E
j
∩ E
k
=
{0}
.
π
k
◦
M
1(
e
i
) = 0
orπ
j
◦
M
1(
e
i
) = 0
foranyintegeri
∈
[1
,
64]
.π
k
◦
M
1(
X
) = 0
orπ
j
◦
M
1(
X
) = 0
foranyvetorX
∈
IF
64
2
.Weonludethatif
X
∈ E
j
andE
j
∩E
k
=
{0}
thenπ
k
◦
M
1(
X
) = 0
orequivalentlyX
∈ B
k
.Consider
X
6= 0
belonging toT
j
6
=
k
B
j
. We have thatπ
j
◦
M
1(
X
) = 0
for anyonludethatall thebitsof
M
1(
X
)
thattouhb
j
(j
6=
k
)arezeros.Therefore, foranynon-zeroomponente
i
ofX
,M
1(
e
i
)
touhesb
k
orequivalentlyX
∈ E
k
, andT
j
6
=
k
B
j
⊂ E
k
.Let us use an argumentby ontraposition.Consider
e
i
∈
/
T
j
6
=
k
B
j
. Then, thereexists
j
6=
k
, suh thate
i
∈ B
/
j
, i.e.π
j
◦
M
1(
e
i
)
6= 0
or equivalentlye
i
∈ E
j
. Therefore, aording to the previous three equivalent onditions,e
i
∈ E
/
k
. We dedue thatfor anye
i
∈ E
k
wehavee
i
∈
T
j
6
=
k
B
j
.It meansthatE
k
=
h
e
i
|
e
i
∈
E
k
i ⊂
T
j
6
=
k
B
j
.WeonludeE
k
=
T
j
6
=
k
B
j
.Proof of Property 2:Let
e
i
be anelement ofE
k
andj
beanelement ofJ
k
. Wehaveπ
k
◦
M
1(
e
i
)
6= 0
andE
j
∩ E
k
=
{0}
.Itimpliesthatπ
j
◦
M
1(
e
i
) = 0
,ande
i
∈ B
j
. Therefore,e
i
∈
T
j
∈
J
k
B
j
,andh
e
i
|
e
i
∈ E
k
i ⊂
E
b
k
.⊓
⊔
Proof ofProperty 3:Wewillrstprovethat
(B
i
∩ B
j
)
⊕ hE
i
∪ E
j
i
= IF
64
2
.Consideraanonialvetor
e
k
∈ B
/
i
∩ B
j
.Thisisequivalenttoπ
i
◦
M
1(
e
k
)
6= 0
orπ
j
◦
M
1(
e
k
)
6= 0
.Inotherwordse
k
∈ E
i
ore
k
∈ E
j
,orequivalentlye
k
∈ hE
i
∪ E
j
i
. Thismeansthat foranyanonialvetorse
k
ofIF
64
2
,wehaveeithere
k
belongs toB
i
∩ B
j
ore
k
belongstohE
i
∪ E
j
i
.Assume thatthereexists aanonialvetor
e
k
∈
(B
i
∩ B
j
)
∩ hE
i
∪ E
j
i
. Wehaveπ
i
◦
M
1(
e
k
) =
π
j
◦
M
1(
e
k
) = 0
,andeitherπ
i
◦
M
1(
e
k
)
6= 0
orπ
j
◦
M
1(
e
k
)
6= 0
.It leadstoaontradition.Hene(B
i
∩B
j
)∩hE
i
∪E
j
i
ontainsnoanonialvetors.Assume now that there exists an element
∆
∈
(B
i
∩ B
j
)
∩ hE
i
∪ E
j
i
having a non-zero omponente
k
. The vetor∆
belongs to(B
i
∩ B
j
)
, henee
k
belongs to(B
i
∩ B
j
)
. Moreover∆
belongs tohE
i
∪ E
j
i
, henee
k
belongs tohE
i
∪ E
j
i
. Thereforee
k
belongsto(B
i
∩ B
j
)
∩ hE
i
∪ E
j
i
whih is impossible.Weonlude that(B
i
∩ B
j
)
∩ hE
i
∪ E
j
i
=
{0}
.Therefore(B
i
∩ B
j
)
⊕ hE
i
∪ E
j
i
= IF
64
2
.Wededuethat
64 = dim(hE
i
∪ E
j
i) + dim(B
i
∩ B
j
)
= dim(E
i
+
E
j
) + dim(B
i
∩ B
j
)
= dim(E
i
) + dim(E
j
)
−
dim(E
i
∩ E
j
) + dim(B
i
∩ B
j
)
Moreover