Posts Tagged ‘decrypt smartcard’

PostHeaderIcon Pay TV Smartcards: Why Side Channels Were Born in Set-Top Boxes

The academic literature on side-channel attacks is full of smartcards, and the reason usually given is that smartcards are simple and well documented. That explanation is incomplete. Microcontrollers were also simple and well documented, and nobody built a research programme around them in the same decade.

What the set-top box offered was something else: a target that could be attacked continuously, in the attacker’s own home, with an immediate and unambiguous indication of success. Anyone who has done hardware work knows what that is worth. It is the difference between an experiment and a guess.

The three conditions

An attack campaign accelerates when three conditions hold, and the set-top box satisfied all three in a way no other consumer product did.

Physical access was unlimited. The card belonged to the subscriber, sat in a slot in the subscriber’s living room, and could be removed, replaced, powered from a bench supply, and put back without anyone noticing. There was no tamper evidence requirement in the field, and no remote attestation to detect that the card had been out of the box.

Time was unlimited. A smartcard does not expire on a schedule tied to an attack; the subscription runs for a month at a time, and the card is used several hours a day. An attacker could run a thousand experiments in the evening and watch television with the same card afterwards.

The success signal was binary and immediate. Either the picture decrypted or it did not. No measurement, no analysis, no interpretation of a log file — the television showed the answer. That is a fitness function with a one-second latency, and it is the single most valuable thing an attack campaign can have.

Condition Set-top box Typical embedded target
Physical access Unlimited, undetected Often none after deployment
Time on target Hours per day Minutes during servicing
Success signal Picture decrypts None, or a distant server
Cost of failure Replace the card Brick the product

The fourth row is the one that made the field so productive. A failed experiment cost a card, and cards were cheap and replaceable. Compare a modern automotive ECU, where a failed glitch may destroy a unit that costs more than the campaign, and the difference in experiment rate is two orders of magnitude.

What ECM and EMM actually carry

The conditional access system has two message streams, and confusing them is the most common analytical error in this area.

An ECM, the entitlement control message, carries the information needed to derive the control word that decrypts the current scramble. The control word changes on a short cycle — often every ten seconds or so — and the ECM carries it encrypted under a key that the card holds. The ECM is broadcast to everyone; only the card can use it.

An EMM, the entitlement management message, carries subscriber management: which services this card is entitled to, for how long, and what has changed. It is addressed to a specific card, and it is where a subscription upgrade or cancellation arrives.

Stream Audience Content Change rate
ECM All cards Encrypted control word Seconds
EMM One card Entitlements, keys Days to months

The distinction matters because the two streams have completely different attack surfaces. The ECM is a high-rate stream processed by a routine that runs every few seconds, so any fault in that routine is easy to trigger and easy to observe. The EMM is a low-rate stream processed occasionally, so a fault there is hard to time and its effect appears hours later.

An attack on the ECM routine produces a card that decrypts the current channel. An attack on the EMM handler produces a card that believes it is entitled to services it never bought. The second is more valuable and much harder, and the asymmetry explains why the historical record is dominated by the first.

The feedback loop is the accelerator

The deeper lesson from this era is about loop latency, and it generalises to every recovery job.

An attack is a search, and the speed of a search is set by how fast the result of one attempt arrives. With a one-second feedback loop an operator can run tens of thousands of attempts in a day. With a feedback loop measured in hours — because the result only appears when the device is reinstalled in its product and driven through a full cycle — the same operator runs a dozen attempts a day.

The ratio is three orders of magnitude, and it explains most of the difference between a technique that works in a laboratory and a technique that works in the field.

Feedback latency Attempts per day Campaign shape
Under a second 10,000+ Sweep the whole parameter space
Minutes Hundreds Targeted search with priors
Hours Dozens Each attempt must be planned
Days One or two Not a search; a hypothesis test

The practical implication for anyone assessing a target is that building a fast observation channel is often worth more than improving the attack itself. A device whose response can be read in ten milliseconds is a device whose parameter space can be mapped. A device whose response requires a full power cycle and a manual inspection is a device where only well-founded hypotheses are worth testing.

Why the card and not the box

The obvious question about this era is why the attack concentrated on the card. The set-top box was also in the subscriber’s home, also had power applied for years, and also contained secrets.

Three reasons made the card the better target, and they are instructive beyond this industry.

The card was the security boundary and the box was not. The box performed descrambling, but the key that made descrambling possible came from the card. Attacking the box yielded a box that worked until the operator changed the key distribution scheme; attacking the card yielded the key material itself, which worked against every box in the field.

The card was cheap and swappable. A failed attempt on a box cost the price of a box, which was a significant consumer appliance. A failed attempt on a card cost the price of a card, which was a few dollars, and the card could be replaced without the subscriber noticing a service interruption.

The card was a standard form factor. Every card used the same contact layout, the same voltage classes and the same protocol, so a rig built for one card worked on the next, and on the next operator’s cards. Nothing about the box had that property.

Property Card Set-top box
Holds the key material Yes Only during a session
Replacement cost A few dollars A consumer appliance
Standardised interface Yes Vendor-specific
Swap unnoticed by subscriber Yes No

The standardised interface is the reason this era produced so much published work. An attack developed on one operator’s card transferred immediately to another’s, so results compounded across the industry rather than staying inside one company.

What the era left behind

The techniques did not stay in the industry, and neither did the defensive patterns.

On the offensive side, the era produced the tooling that is now standard: programmable glitch generators with sub-nanosecond resolution, high-sample-rate acquisition with hardware triggering, and the practice of mapping a parameter space rather than trying one setting. Every one of those is now applied to microcontrollers, to automotive parts and to secure elements, with no television involved.

On the defensive side, the era produced the five-generation ladder described in the smartcard arms race, and it produced one conclusion that has been repeatedly relearned: a security boundary that does not account for physical possession is not a security boundary. Every scheme that assumed the attacker could not hold the device was broken, and every scheme that survived assumed he could.

That conclusion is the reason modern secure elements are specified in terms of what an attacker with the device in hand can do, rather than in terms of what an attacker on the network can do. It sounds obvious now. It was not obvious in 1995, and the industry paid for the education in cards.

Why the technique survived the product

Pay television as a business has changed beyond recognition, but the techniques developed against it did not stay there. They moved to any device with a card, a token, a dongle, or a removable security element — which is to say, to most of the systems that still rely on a separable secret.

The structural reasons those systems are still attractive are the same three conditions. A dongle is in the user’s hands. A token has no remote attestation. A card slot accepts anything shaped like a card. The cryptography inside may be thirty years newer, but the physical situation is unchanged, and the physical situation is what determines the experiment rate.

What this means for assessment work

Two practical conclusions follow, and they are both about what to measure first.

The first is to establish the feedback latency of the actual product rather than of the bench setup. A card in a reader answers in milliseconds; the same card in a product may only be exercised when the product boots, which is every few hours. The attack that is easy on the bench may be impractical in the product, and the difference is not the silicon.

The second is to establish which stream a target routine processes. In any system with a broadcast component and an addressed component, the broadcast path is high-rate and shallow, and the addressed path is low-rate and deep. The high-rate path is where faults are found; the low-rate path is where the value is.

The five generations of countermeasures that this era produced are set out in the smartcard arms race. The measurement budget that decides whether a timing route is viable at all is in before a timing attack, and the fault-injection search that the fast feedback loop makes possible is in glitch attacks as a search problem. Where the secret turns out not to be in the removable element at all, the four possible locations are in where the secret key lives.

The service we provide for this class of product is an assessment of the loop: how fast the product can be exercised, what it reveals per exercise, and whether that rate supports a search at all. It is a less exciting deliverable than a break, and it is the one that determines whether a break is a fortnight or a fantasy.