Systemsicherheit Teil 4: CSS und DeCSS Prof. Dr. DVD-Kopierschutz 1. CSS und DeCSS Überblick Die Schieberegister LFSR1 und LFSR2 Angriffe auf die Datenverschlüsselung Key Management Angriffe auf das Key Management Wo kommt die Information her? 2. DVD-Aufbau und Kopierschutz (ohne CSS) 3. Ausblick: DVD-Audio, Wasserzeichen, weitere Entwicklungen 4. CPPM/CPRM 2 Systemüberblick DVD Hidden Area DVD Player Player Keys Secret Key Region Code &c Per title Title Key Table of Encrypted Disk Keys Disk Key Hash Region Code Bus Key Bus Computer/Host Secret Key Bus Key 3 Die Schlüssel von CSS Authentication Key Dieser geheime Schlüssel (nur einer weltweit?) muss im DVD-Laufwerk und in der DVD Player-Software enthalten sein. Session Key (Bus Key) Dieser Schlüssel wird mit Hilfe der beiden beim Challenge-and-Response- Authentisierungsverfahren ausgetauschten Nonces berechnet Player Key K pi Jeder DVD-Player kann einen oder mehrere der 409 Player Keys K pi (i = 1,, 409) enthalten. Disk Key K d Dieser Schlüssel wird für jeden DVD-Titel neu erzeugt, mit allen 409 Player Keys und mit sich selbst verschlüsselt und auf der DVD abgelegt (hash, dk 1, dk 2,..., dk 409 ). Title Key K t Dieser Schlüssel ist im Header der einzelnen Files auf der DVD, mit K d verschlüsselt, abgelegt. XOR-verknüpft mit dem Sector Key dient er zur Entschlüsselung eines Sektors der Datei. Sector Key Jeder Sektor enthält einen 128-byte Header. Die Bytes 80-84 des Headers jedes Sektors bilden den Sector Key (im Klartext). 4 Überblick über den Ablauf Step 1: Gegenseitige Authentisierung Challeng-and-Response-Protokoll, siehe nächste Folie. Dabei wird der Secssion Key/Bus Key berechnet. Step 2: Berechnung des Disk Key K d repeat select next available Player Key K pi K d = DA(dk i, K pi ) until K d = D A (hash, K d ) Step 3: Send disk and title keys The title and bus keys are sent from the player to the host. The session key is used to encrypt the title and disk keys in transit to prevent a man-in-the-middle attack. Step 4: The DVD player sends a sector to the host. Step 5: The host decodes the title key using the disk key. Step 6: The host decodes the sector using the title key, and a the sector key in the sector s header. Gegenseitige Authentisierung Host Initialization done Decrypt and verify Challenge H Encrypt Challenge D Session key is encrypted Challenge H + Challenge D Request AGID Challenge H (nonce) Encrypted D AGID Encrypted Challenge H Challenge D (nonce) Success or Failure Drive Initialization done Encrypt Challenge H Decrypt and verify Challenge D Session key is encrypted Challenge H + Challenge D 5 6
Gegenseitige Authentisierung Encryption is similar to data encryption, but a permutation is done before the LFSR cipher. A different permutation box is used for each of the three keys. The secret key is used for the encryption. Linear Feedback Shift Register (LFSR) Pseudo-random bit stream One technique used to encode a stream is to XOR it with a pseudo-random bit stream. If this random-looking bit stream can be regenerated by the receiver of the message, the receiver will be able to decode the message by repeating the XOR operation. Linear Feedback Shift Register (LFSR) The LFSR is one popular technique for generating a pseudo-random bit stream. After the LFSR is seeded with a value, it can be clocked to generate a stream of bits. Unfortunately, LFSRs aren t truly random they are periodic and will eventually repeat. In general, the larger the LFSR, the greater its period. There period also depends on the particular configuration of the LFSR. If the initial value of an LFSR is 0, it will produce only 0 s, this is sometimes called null cycling LFSRs are often combined through addition, multiplexers, or logic gates, to generate less predictable bit streams. 7 8 Generic LFSR CSS: LFSR-17 output garbage 17 4 feedback path Feedback Function taps feedback path 15 Exclusive Or (XOR) 1 taps The register is seeded with an initial value. At each clock tick, the feedback function is evaluated using the input from the tapped bits. The result is shifted into the leftmost bit of the register. The rightmost bit is shifted into the output. Depending on the configuration (taps and feedback function), the period can be less than optimal. 9 output This register is initialized, or salted with two bytes of or derived from the key During the salting, a 1-bit is injected a bit 4, to ensure that the register doesn t start out with all 0s and null-cycle. The value being shifted in is used as the output, not the typical output bit, which in the case of CSS goes off into the ether. 10 CSS: LFSR-25 feedback path output 25 15 5 4 Exclusive Or (XOR) garbage taps This register is initialized, or salted with three bytes of or derived from the key During the salting, a 1-bit is injected a bit 4, to ensure that the register doesn t start out with all 0s and null-cycle. The value being shifted in is used as the output, not the typical output bit, which in the case of CSS goes off into the ether. 1 key key CSS: LFSR Addition 1 byte LFSR-17 8 ticks Optional bit-wise inverter 1 byte LFSR-25 8 ticks Optional bit-wise inverter carry-out from prior addition + 8-bit add Output byte carry-out 11 12
LFSR Output Inversion CSS: Data Decryption Bit-wise Invert Output Of LFSR Output byte from LFSRs Exclusive Or (XOR) Output data byte Authentication LFSR-17 Yes LFSR-25 Yes Input data byte Table-based substitution Session key Title Key Data No No Yes No Yes No Sector LFSR-17 is seeded with bytes 0 and 1 of the title key XORed with byte 80 and 81 of the sector header. A 1 is injected at bit 4, shifting everything right by one bit. LFSR-25 is seeded with bytes 2, 3, and 4 of title key XORed with bytes 82, 83, and 84 of the sector header. A 1 is injected at bit 4, shifting everything right by one bit. The output of LFSR-17 is bit-wise inverted before adding to LFSR-25. Much as with DES, a table-based substitution is performed on the input data. 13 14 O(2 16 )-Attacke mit 6 bekannten Outputbytes O(2 16 )-Attacke mit 5 bekannten Outputbytes XOR carry XOR carry 8 5 1 3 + 8-bit add Output 8 5 1 3 + 8-bit add Output XOR XOR 8 8 5 1 3 8 8 5 1 3 8 8 8 8 8 8 8 8 8 8 8 15 16 17 18
19 20 21 22 23 24
25 26 Ziel: Löse die Fixpunktgleichung K d = D A ( hash, K d ) mit Komplexität < O(2 40 ). Vorberechnung (Komplexität 16*2 16 ): for (K2=0x0, K2<=0xFF, K2++){ B(2)=A(1)^F(A(2))^K2; for (B(1)=0x0, B(1)<=0xFF, B(1)++{ C(2)=B(1)^F(B(2))^K2; speichere (K2,B(1),C(2)); } } Sortiere die Liste nach (C(2), B(1)); 1. Rate den Startwert (C(1), C(2)) von LFSR1 und berechne die ersten 5 Output-Bytes O 1 (1), O 1 (2), O 1 (3), O 1 (4), O 1 (5) (Komplexität O(2 16 )). 2. Rate B(1) und führe die Berechnungen auf den nachfolgenden Folien durch (Komplexität O(2 8 )). 27 28 29 30
31 32 3. Verwende die Tabelle, um für die jetzt berechneten Werte von B(1) und C(2) zulässige Werte für K2 zu finden; im Schnitt gibt es davon einen Wert (also keine Erhöhung der Gesamtkomplexität des Algorithmus). 33 34 Jetzt könnte B(2) berechnet werden; das bringt aber nichts 4. Für die zulässigen Werte für K2 berechne aus [O 1 (1) und K1], [O 1 (2) und K2], [O 1 (5) und K3] die Werte O 2 (1), O 2 (2) und die zwei möglichen Werte für O 2 (5). 5. Durch Erzeugen und Sortieren einer (nur einmal anzulegenden) Tabelle der Größe 2 24, die für jeden Startwert von LFSR2 die zugehörigen Werte O 2 (1), O 2 (2) und O 2 (5) enthält, kann man nun auch den Startwert von LFSR2 und damit C(3), C(4), C(5) erhalten. 35 36
37 38 39 40 41 42
6. Wir testen, ob wir C(1), C(2), B(1), {K2} und die richtige Variante von O2(5) geraten haben, indem wir den berechneten Wert von K2 mit dem geratenen vergleichen. 7. Die verbleibenden Werte testen wir mit der Gleichung K d = D A ( hash, K d ). 8. Die verbleibenden (in der Praxis wenigen) Möglichkeiten können durch probeweise Entschlüsselung der Videodaten verifiziert werden. 43 Woher kommt die Information? c-anonymous.c void CSSdescramble(unsigned char *sec,unsigned char *key) { unsigned int t1,t2,t3,t4,t5,t6; unsigned char *end=sec+0x800; t1=key[0]^sec[0x54] 0x100; t2=key[1]^sec[0x55]; t3=(*((unsigned int *)(key+2)))^(*((unsigned int *)(sec+0x56))); t4=t3&7; t3=t3*2+8-t4; sec+=0x80; t5=0; while(sec!=end) { t4=csstab2[t2]^csstab3[t1]; t2=t1>>1; t1=((t1&1)<<8)^t4; t4=csstab5[t4]; t6=(((((((t3>>3)^t3)>>1)^t3)>>8)^t3)>>5)&0xff; t3=(t3<<8) t6; t6=csstab4[t6]; t5+=t6+t4; *sec++=csstab1[*sec]^(t5&0xff); t5>>=8; } } 44 Quellen für DeCSS Anonymes Posting c-anonymous.c Axboe, Jens, dvd-2.2.13-5 Linux patch, 1999. Fawcus, D. and Roberts, Mark, css-auth package, December, 1999. Schneider, Bruce, Applied Cryptography, 2ed, Wiley, 1996, p. 372-379. Stevenson, Frank A., Cryptanalysis of Content Scrambling System, 8 Nov. 1999, as updated 13 Nov. 1999, http://www- 2.cs.cmu.edu/~dst/DeCSS/FrankStevenson/analysis.html Gallery of CSS Descramblers, http://www- 2.cs.cmu.edu/~dst/DeCSS/Gallery/ DeCSS Central, http://www.lemuria.org/decss/ Gregory Kesden, Carnegie Mellon University, 15-412 / Fall 2000. http://www-2.cs.cmu.edu/~dst/decss/kesden/ 45