================================= SMART CARDS - How Do They Work? ================================= SMART cards are already in use in the VideoCrypt and D2-MAC Eurocrypt scrambling systems. They are also widely used for pay telephone applications. At this stage the SMART card is throwaway technology. Despite being portrayed as being the ultimate in security, there are ways to hack the SMART card based systems though the cards are relatively secure. A SMART card has a microprocessor on the card. It may also have additional memory. This makes it somewhat different from memory only cards as used for prepaid services like telephone calls or rail travel. There are basically two classes of SMART cards; contactless and contact. The contact type SMART card requires direct electrical connection to the decoder. This is the type of SMART card used in the VideoCrypt system. It is the cheapest format. The non-contact type SMART card has not been used in decoder applications yet. It uses oscillators running at different frequencies to supply power to the card. A filter and rectifier arrangement circuit on the card picks up the signal generated by the descrambler and produces a DC voltage. Data can be transferred in a similar fashion. This type of card may be used in the future but the cost is prohibitive. The connector specifications for the contact SMART card have been established as an ISO standard. The ISO standard specifies eight connections of which only six are actively used. Many of the SMART cards used for payphones and banking applications follow the pattern that appears in the diagram. The typical payphone card is an EPROM memory card rather than a smart card. Videocrypt's card does not look like it follows the pattern but it does have the same six connections on the connector array. Due to the difficulties involved in reverse engineering a card, it is very difficult to extract the data from the card without destroying the card. The fact that the structure of the card is known does not imply that the actual program in the card is known. It should be stated that extracting the program from a smart card is not impossible. It will happen and according to one company, the first pirate. clones will appear with in the next few months. SMART CARD STRUCTURE ==================== The structure of the card is basically simple. It consists of a microprocessor and memory. This description fits the microcontrollers used to control receivers and video recorders. The type of memory used can vary. It generally involves Read Only Memory, Erasable Programmable Read Only Memory, Electrically Erasable programm- able Read Only Memory and Random Access Memory. The information stored in the ROM is fixed and cannot be altered without changing the design of the SMART card. The information in the EPROM generally has to be erased with ultra violet light. This would imply that once the card has been programmed, the information cannot be erased in the card. The EEPROM is more usable in SMART cards for one specific reason - it can be reprogrammed in the card. The manner in which the VideoCrypt cards can be turned on and off seems to indicated that the VideoCrypt SMART card uses EEPROM memory rather than EPROM. The microprocessor used on the France Telecom Visiopasse card is based on the 6805 microcontroller. This microcontroller is an eight bit type and has on chip ROM, EEPROM and RAM. The VideoCrypt card may be similar in structure. The specification for the Visiopasse PC2 card CPU : 6805 RAM : 128 Bytes ROM : 6144 Bytes EPROM: 8192 Bytes The specification for the Thomson STl834. CPU : 8 Bit RAM : 76 Bytes EPROM: 4095 Bytes Vcc: +5 Volts Vpp: +21 Volts ______________________________________ / \ | | | | | C1 C5 | | C2 C6 | | C3 C7 | | C4 C8 | | | | | | | \________________________________________/ These contacts have the following purpose: C1 VCC Supply voltage (+5 V, max. 200 mA) C2 RST Reset signal C3 CLK Clock signal C4 - reserved C5 GND Ground C6 VPP Programming voltage C7 I/O Data input/output C8 - reserved The actual card type used by Sky is believed to be a Motorola type though this has not been established. It would seem logical as the main crypto processor is a Motorola microcontroller. A Smart Card Memory Map ======================= -------------------- MASKED ROM | | | | This section contains the Card,s | | housekeeper programs and the | | Primary Decryption algroithm. This | | algorithm is used on all services. | | | | | | |------------------| EEPROM | | | | This section contains the service | | data, the authorisation, the card | | identity, the subsciber identity, the | | billing data and period data | | | | |------------------| RAM | | | | This section is used by the -------------------- decryption algorithm and other programs as a tempory storage area. The Smart Card's Chip Structure =============================== ---- EEPROM R/W Voltage | | ----------- -------------- | | | |----- Reset | |....| | | EEPROM | | Micro- |----------- Data Port | |....| Processor | | | | |----- Clock ----------- | | | |----- 5v Supply -------------- . . . . . . . . ------------ ----------- | | | | | | | | | | | Masked | | RAM | | ROM | | | | | | | | | | | | | ------------ ----------- The Smart Card's Microcontroller is fabricated on one chip. This chip contains EEPROM. If any attempt is made to scan the chip with an electron microscope, the EEPROM will be wiped. Since the design is all on a single chip the data flow between the memory areas cannot be directly examined. From this information, a memory map of a VideoCrypt SMART card can be guessed. The ROM area of the memory is the area where the main operational program and decryption algorithms are stored. The EEPROM area contains the service data, the pay per view data, the card identity data and the billing period data. The RAM is used for temporary storage of data. The ROM area of the card is not accessible. It cannot be read out by pumping the card. For this reason it holds the most critical information. The programs held in ROM are used for all services or channels that use the card. The algorithms will be identical but the keys will be totally different. This section will also hold the routine for decryption the data in the EEPROM area of the memory. The EEPROM contains the enabling data for each channel that the card user has paid for. The data entry for each channel would consist of a channel identifier, a billing period, a regional identifier, key data and authorisation data for the channel. The design of a SMART card is complex and prototyping can take a few months. The ROM in the card has to be mask programmed. This essentially means that the programs to be stored in the ROM are designed as part of the chip. The procedure is straightforward. The programs to be included in the ROM are developed on a SMART card emulator. This is a microprocessor development system that is configured to imitate a SMART card. It is hooked to a personal computer. The program developer will write the programs on the computer, test them, and if they run successfully, load them into the SMART card emulator. The SMART card emulator will then be plugged into a decoder to ensure that the programs work. The programs will then be supplied on floppy disc to the chip manufacturer. The manufacturer will program an EPROM with the programs and send it to the card issuer for verification. Once the EPROM is checked, the manufacturer will then produce the chips in sample quantity. These chips will also be tested for correct operation. The chips can then be mass produced. The chips are glued to a printed circuit board substrate with epoxy resin. The connection pins on the chip are wired to the connections on the substrate. The substrate connections are then wired to the connector array. The actual plastic card is injection moulded with an indent for the chip. The chip is then glued into the indent. The card is then tested to ensure that it is operational. The SMART card at this stage will only have the bare minimum of data. There will be no service data in the EEPROM. This data is programmed into the card by the card issuer. In VideoCrypt's case, the programming and card assembly would be carried out at the Gemplus factory in Scotland. SMART CARD OPERATION ===================== The SMART card is essentially a partial computer on a card. It is a partial computer because it requires other circuitry and inputs to operate. The first requirement is supply voltage. This is generally a 5 Volt DC supply. The second requirement is a clock signal. This is a stable frequency square wave of 5 volts amplitude. This frequency is derived from a crystal in the descrambler. The frequency used in the VideoCrypt card is 3.5 MHz. The third requirement is a reset line. This is used to initiate the l@ programs and routines in the card when the card is inserted into the socket. The fourth requirement is the EEPROM voltage. The EEPROM programming voltage is high, typically over twenty volts. This voltage is only on for a few milliseconds every three seconds. The chip would generate too much heat if it was continually fed with high voltage. The fifth requirement is the data port. The data flows to and from the card on one line. It is serial data. This port would be connected to the RAM in the card. The serial data would be clocked into the RAM. The microprocessor on the chip would then read the data in a parallel format. The data flows at 9600 Baud or at 9600 bits per second. The serial data line makes the card more secure. I When the card is inserted into the descrambler, the reset pin is activated. This zeroes the RAM and causes the microprocessor to select the boot-up program. This program will verify that the card is valid for the period and not on the blacklist. The card will then read the data from the descrambler. This data, along with service data from the EEPROM, will be used in the decryption algorithm stored in the ROM. The product of the decryption algorithm will then be passed back to the descrambler. In the VideoCrypt system, the information flowing to and from the card is not useful on its own. The data is not the actual key used to descramble the picture. This data is passed via the 8052 Housekee- per microcontroller to a secure microprocessor, the ZC404044 or ZC404047, where it is then used in a further algorithm to generate the seed for cutpoint generator. The secure microprocessor is actually a Mask ROM version of the 6805 microcontroller. Pay Per View is extremely easy to implement with a SMART card. The card user will purchase a number of credits or tokens each billing period. A typical number would be 99 tokens. The SMART card would be programmed so that the token counter would read 99 tokens. When ever the user wanted to watch a PPV film or event, a message would be shown on screen stating the number of tokens that the event is valued at. To watch the programme, the user would press the authorise or pay button on the front of the descrambler. The descrambler would then decrease the token register by the correct amount. Each service could have a token register. The actual operation of the counting mechanism would be more complex. It would be too easy to intercept the taken count value and substitute a continual 99 tokens. This type of hack is commonly used in computer games and is known as an "Infinite Lives POKE". At present the actual PPV algorithm for VideoCrypt lies mainly in the 8052. There is the possibility that the Infinite Lives Poke would work The issue of the O9 smart cards may have taken this into consideration. SMART CARD SECURITY AND ADDRESSING =================================== The VIdeoCrypt cards are valid once they leave the subscription centre. This means that they can be used in any VideoCrypt descrambler. They can be deactivated over the air by Sky. When this occurs, a section of the EEPROM in the card is overwritten so that when the card is inserted into the descrambler, it will not work. In order to reactivate the card, the program providers Sky send out a message to the descrambler to reprogram the overwritten section of EEPROM. This weakness was actually used to hack the VideoCrypt system though it was quickly discovered and countered. The details of the hack are given later. Other systems using SMART card use over the air enabling. In this case, the cards cannot be used immediately. They have to be inserted into the descrambler and the subscription centre has to be informed. The subscription centre will then activate the card. This method of addressing is more time consuming and thus less economical. it is basically a trade off between medium security and very high security. Reverse engineering a SMART card is not an economically viable hack. The chip on the SMART card is covered in epoxy resin. Trying to remove this resin can sometimes destroy the chip. If the memory and the microprocessor are on different chips, it would be barely possible to attack the connecting wires and monitor the data flow. if the memory and the microprocessor are on the same chip it is impossible. Using an electron microscope to read the memory may partially work on EPROM type SMART cards. Smart cards using EEPROM memory are reasonably secure against this hack. The scanning electron beam erases the EEPROM. It is possible that a method for reprogramming the EEPROM on a SMART card could be developed. Using such a method, the EEPROM contents of a valid card could be copied and loaded on to an old SMART card. There is virtually no problem in obtaining old Sky SMART cards. This hack has one fatal flaw. The ROM data on SMART cards is changed from billing period to billing period. Therefore the algorithms and the EEPROM data decrypting algorithm are different. One potential weakness on a multi service card would be a cloning of a fully authorised card using a SMART card with the minimum authorisation. This hack relies on the development of an EEPROM reading and writing method. It would appear that the SMART card is the most difficult aspect of the system to hack. It is certainly not economically viable to hack it. The use of a SMART card does not confer immunity to hacking upon a system. There are usually fatal flaws in the descrambler that the hacker can exploit. The VideoCrypt system has become a rather lucrative target after the Sky / BSB merger. There are now three movie channels, two foreign language channels, The Adult Channel and one sports channel using the system. Other users will adopt the system with in the next year or so.