Content Scrambling System (CSS) by bzs12927

VIEWS: 0 PAGES: 19

									 Content Scrambling System
           (CSS)

• This is a draft document. Please report errors, omissions, or ambiguities.

•This is a teaching tool, not a specification or technical document. It is overly
simplified, incomplete, and likely inaccurate (see above).

•It is not warranted for any purpose. Use at your own risk.




          Gregory Kesden, Carnegie Mellon University, 15-412/Fall 2000
               System Overview
              DVD Player                         Computer/Host

                                                 “Secret Key”

   DVD              Player Keys

Hidden Area         “Secret” Key
                                     Bus   Bus
                    Region Code      Key         Bus Key

                    &c


               Per title Title Key


         Table of Encrypted Disk Keys
         Disk Key Hash
         Region Code
                     Overview of Keys
Authentication Key
•   This “secret” is used as part of the mutual authentication process.
Session Key (Bus Key)
•   This key is negotiated during authentication and is used to encrypt the
    title and disk keys before sending them over the unprotected bus. The
    encryption is necessary to prevent eavesdropping.
Player Key
•   This key is Licensed by the “DVD Copy Control Association” to the
    manufacturer of a DVD player. It is stored within the player. It is used to
    establish the trustworthiness of the player. It is used to decrypt the disk
    key.
Disk Key
•   This key is used to encrypt title key. It is decrypted using the player key.
Sector Key
•   Each sector has a 128-byte plain-text header. Bytes 80 - 84 of each
    sector’s header contain an additional key used to encode the data within
    the sector.
Title Key
•   This key is XORed with a per-sector key to encrypt the data within a sector
                Overview of Process
Step 1: Mutual Authentication
    – The host and the drive use a challenge-response system to establish
      their trustworthiness to each other. In the process, they negotiate a
      session key.
Step 2: Decoding disk
    – The DVD player tries each of several player keys until it can decode
      the disk key. The disk key is a disk-wide secret.
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.
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.
                         Generic LFSR
                                                                     output




                                                          taps
   feedback path
                           Feedback Function



• 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.
                             CSS: LFSR-17
                                                                  garbage

                        17                             4

                feedback        15                         1         taps
                path

                               Exclusive Or (XOR)


                 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.
                             CSS: LFSR-25
                                                                             garbage

                 25

         feedback                          15             5    4      1        taps
         path

                                            Exclusive Or (XOR)

          output



•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.
                 CSS: LFSR Addition
key

                   1 byte
      LFSR-17
       8 ticks
                   Optional bit-wise inverter
                                                              Output byte
                                                + 8-bit add
key

                   1 byte
      LFSR-25                                                  carry-out
       8 ticks
                    Optional bit-wise inverter


      carry-out
      from prior
      addition
LFSR Output Inversion



             Bit-wise Invert Output Of LFSR
                    LFSR-17          LFSR-25
 Authentication     Yes              Yes
 Session key        No               No
 Title Key          No               Yes
 Data               Yes              No
                    CSS: Data Decryption

        Output byte from
            LFSRs
                                                                        Output data byte
                                            Exclusive Or (XOR)

                             Table-based
     Input data byte         substitution


• 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.
                        CSS: Key Decryption
Bytes of                                       2
                    0            1                           3             4
Ciphertext
                Table         Table         Table         Table         Table
                lookup        lookup        lookup        lookup        lookup
                         Lk            Lk            Lk            Lk
                   +             +             +             +             +     Lk


                Table         Table         Table         Table         Table
                lookup        lookup        lookup        lookup        lookup
                         Lk            Lk            Lk            Lk            Lk
                    +            +             +             +             +
Bytes of
Plaintext           1             2             3            4             5


 Note: Lk is the input byte decrypted using the same scheme as shown for data bytes,
 with the inverters set for the key type.
              Disk and Player Keys
•   Each player has a small number of keys
•   Each disk is encoded using a disk key.
•   Each disk contains a hidden sector. This sector is pre-written to
    all 0’s on writable DVDs.
•   This sector holds a table containing the disk key encrypted will all
    409 possible player keys.
•   It also holds the disk key encrypted with the disk key.
•   The player decrypts the appropriate entry in the table and then
    verifies that it has correctly decoding the disk key, by decoding
    the encrypted disk key.
•   The encryption mechanism is the same as we discussed earlier
    for other keys.
                 Mutual Authentication
                      Host                                           Drive
                              Request AGID
                                                             AGID
       Initialization done                                           Initialization done

                              ChallengeH (nonce)
                                                                     Encrypt
                                        Encrypted ChallengeH         ChallengeH
       Decrypt and verify
       ChallengeH
                                                ChallengeD (nonce)
                              EncryptedD

              Encrypt                                                Decrypt and verify
              ChallengeD                                             ChallengeD
                                            Success or Failure
 Session key is encrypted                                            Session key is encrypted
 ChallengeH + ChallengeH                                             ChallengeH + ChallengeH


•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.
       Weakness #1: LFSR Cipher
Brainless:
    – 240 isn’t really very big – just brainlessly brute-force the keys
With 6 Output Bytes:
    – Guess the initial state of LFSR-17.
    – Clock out 4 bytes.
    – Use those 4 bytes to determine the corresponding 4 bytes of
      output from LFSR-25.
    – Use the LFSR-25 output to determine LFSR-25’s state.
    – Clock out 2 bytes on both LFSRs.
    – Verify these two bytes. Celebrate or guess again.
    – This is a 216 attack.
     Weakness #1: LFSR Cipher (cont)
With 5 Output Bytes:
•   Guess the initial state of LFSR-17
•   Clock out 3 bytes
•   Determine the corresponding output bytes from LFSR-25
•   This reveals all but the highest-order bit of LFSR-25
•   Try both possibilities:
     – Clock back 3 bytes
     – Select the setting where bit 4 is 1 (remember this is the initial
       case).
     – It is possible that both satisfy this – try both.
•   Verify as before
•   This is a 225 attack
    Weakness #2: Mangled Output
                  (You might want to refer to the key decryption slide)



With Known ciphertext and plainttext
    – Guess Lk4
    – Work backward and verify input byte
    – This is a 28 attack.
    – Repeat for all 5 bytes – this gives you the 5 bytes of known
      output for prior weakness.
                      Region Code
One other detail:
•   Each DVD contains a region code that indicates the region of the
    world in which it is intended to be viewed.
•   Each player knows the region in which it was to be sold.
•   If the region code of the player doesn’t match the region code on
    the DVD, the player won’t deliver the data.
•   This is to help the MPAA ensure that DVDs don’t leak out into
    parts of the world ahead of the “first showing”, &c.
                                References
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.
Please note:
    You should be aware that, in light of a recent federal circuit court decision, it is probably
    unlawful for you to obtain the the first two sources. To the best of my non-expert and
    incomplete knowledge, the fourth source has not yet been subject to judicial review in
    the United States.
    These works are cited to “give credit where credit is due”. This citation should be
    viewed as proper attribution – not “suggested reading”.
    It is my understanding that the recent decision did not incriminate presentations of CSS,
    such as this one, in detail and form insufficient to constitute a working implementation.
    But, case law in this area is underdeveloped. As the meaning of the law is further
    exposed, we (you and I) may find ourselves unable to lawfully distribute or
    communicate this presentation or its content.
    Another note: Take legal advice from a licensed attorney, not from me.

								
To top