home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_ietf_i / draft-ietf-ipsec-cbc-00.txt < prev    next >
Text File  |  1997-07-03  |  13KB  |  386 lines

  1.  
  2. Network Working Group                                        W A Simpson
  3. Internet Draft                                              [DayDreamer]
  4. expires in six months                                          July 1997
  5.  
  6.  
  7.                   ESP with Cipher Block Chaining (CBC)
  8.                       draft-ietf-ipsec-cbc-00.txt
  9.  
  10.  
  11. Status of this Memo
  12.  
  13.    Was draft-simpson-cbc-00.txt.
  14.  
  15.    This document is an Internet-Draft.  Internet Drafts are working doc-
  16.    uments of the Internet Engineering Task Force (IETF), its Areas, and
  17.    its Working Groups.  Note that other groups may also distribute work-
  18.    ing documents as Internet Drafts.
  19.  
  20.    Internet Drafts are draft documents valid for a maximum of six
  21.    months, and may be updated, replaced, or obsoleted by other documents
  22.    at any time.  It is not appropriate to use Internet Drafts as refer-
  23.    ence material, or to cite them other than as a ``working draft'' or
  24.    ``work in progress.''
  25.  
  26.    To learn the current status of any Internet-Draft, please check the
  27.    ``1id-abstracts.txt'' listing contained in the internet-drafts Shadow
  28.    Directories on:
  29.  
  30.       ftp.is.co.za (Africa)
  31.       nic.nordu.net (Europe)
  32.       ds.internic.net (US East Coast)
  33.       ftp.isi.edu (US West Coast)
  34.       munnari.oz.au (Pacific Rim)
  35.  
  36.    Distribution of this memo is unlimited.
  37.  
  38. Abstract
  39.  
  40.    This document describes the Cipher Block Chaining (CBC) mode, used by
  41.    a number of Internet Encapsulating Security Payload (ESP) transforms.
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. Simpson                   expires in six months                 [Page i]
  54. DRAFT                           CBC mode                       July 1997
  55.  
  56.  
  57. 1.  Introduction
  58.  
  59.    The Encapsulating Security Payload (ESP) [RFC-1827] provides confi-
  60.    dentiality for IP datagrams by encrypting the payload data to be pro-
  61.    tected.  This specification describes the ESP use of the Cipher Block
  62.    Chaining (CBC) mode.
  63.  
  64.    CBC is used to mask patterns of identical blocks within the same
  65.    datagram.  Together with an Initialization Vector (IV) that is dif-
  66.    ferent for every datagram, identical plaintext payloads will each
  67.    encrypt to different ciphertext payloads.
  68.  
  69.    As an added benefit, when the cipher output is effectively random in
  70.    appearance (a characteristic of a good cipher), masking the plaintext
  71.    with previous ciphertext will trivially strengthen the entropy of the
  72.    next input to the cipher.
  73.  
  74.    CBC was first defined for DES in [FIPS-81], and generalized by
  75.    [ISO-8732] and [ISO/IEC-10116].
  76.  
  77.    For a technical exposition on CBC, see [MOV97].
  78.  
  79.    For more explanation and implementation information for CBC, and a
  80.    useful comparison with other modes of operation, see [Schneier95].
  81.  
  82.  
  83. 2.  Description
  84.  
  85.                       P1             P2             Pi
  86.                       |              |              |
  87.                IV->->(X)    +>->->->(X)    +>->->->(X)
  88.                       v     ^        v     ^        v
  89.                    +-----+  ^     +-----+  ^     +-----+
  90.                 k->|  E  |  ^  k->|  E  |  ^  k->|  E  |
  91.                    +-----+  ^     +-----+  ^     +-----+
  92.                       |     ^        |     ^        |
  93.                       +>->->+        +>->->+        +>->->
  94.                       |              |              |
  95.                       C1             C2             Ci
  96.  
  97.    An Initialization Vector (IV) is XOR'd with the first plaintext block
  98.    (P1).  The keyed encryption function (Ek) generates the ciphertext
  99.    (C1) for the block.
  100.  
  101.    For successive blocks, the previous ciphertext block is XOR'd with
  102.    the current plaintext (Pi).  The keyed encryption function (Ek) gen-
  103.    erates the ciphertext (Ci) for that block.
  104.  
  105.  
  106.  
  107.  
  108. Simpson                   expires in six months                 [Page 1]
  109. DRAFT                           CBC mode                       July 1997
  110.  
  111.  
  112.                       C1             C2             Ci
  113.                       |              |              |
  114.                       +>->->+        +>->->+        +>->->
  115.                       v     v        v     v        v
  116.                    +-----+  v     +-----+  v     +-----+
  117.                 k->|  D  |  v  k->|  D  |  v  k->|  D  |
  118.                    +-----+  v     +-----+  v     +-----+
  119.                       |     v        |     v        |
  120.                IV->->(X)    +>->->->(X)    +>->->->(X)
  121.                       |              |              |
  122.                       P1             P2             Pi
  123.  
  124.    To decrypt, the order of the manipulations is reversed (as shown).
  125.  
  126.  
  127. 3.  Initialization Vector
  128.  
  129.    CBC requires an Initialization Vector (IV).  The IV conceals initial
  130.    blocks that repeat in multiple datagrams.
  131.  
  132.    For ESP, each datagram generates its IV from material carried in the
  133.    datagram.  This ensures that decryption of each received datagram can
  134.    be performed, even when some datagrams are lost, duplicated, or re-
  135.    ordered in transit.
  136.  
  137.    Security Notes:
  138.  
  139.       Each IV is intended to be unique over the lifetime of the ESP
  140.       cipher session-key(s).  A counter is most commonly used to gener-
  141.       ate the IV, providing an easy method to prevent repetition.
  142.  
  143.       Incorporating the anti-replay ESP Sequence Number as part of the
  144.       IV can provide both uniqueness and mutual protection between the
  145.       first block and the Sequence Number.  Modification of the Sequence
  146.       Number to avoid anti-replay measures will prevent correct decryp-
  147.       tion of the first block, which is most likely to contain datagram
  148.       headers required for delivery.  Attempts to modify the IV to
  149.       deliberately redirect transport headers will also likely be
  150.       detected by the transport checksums.
  151.  
  152.       However, cryptanalysis might use the rare serendipitous occurrence
  153.       when the counter increments in exactly the same fashion as a cor-
  154.       responding bit position in the first block.  Design of specific IV
  155.       generation techniques must take this into account.
  156.  
  157.       Alternatively, a pseudo-random number generator can be used to
  158.       generate the IV.  Care should be taken that the periodicity of the
  159.       number generator is long enough to prevent repetition during the
  160.  
  161.  
  162.  
  163. Simpson                   expires in six months                 [Page 2]
  164. DRAFT                           CBC mode                       July 1997
  165.  
  166.  
  167.       lifetime of the session-key(s).
  168.  
  169.       Historically, another pseudo-random number source has been the
  170.       final ciphertext block of a previous datagram, extending CBC to an
  171.       entire stream of data.  This is a common link-level configuration,
  172.       but does not meet the IP requirement to function reliably with
  173.       lost, duplicated, and re-ordered datagrams.  Also, this could be
  174.       vulnerable to a datagram insertion attack similar to the splicing
  175.       attack described later.
  176.  
  177.       Ideally, the IV would be based on explicit fields carried in each
  178.       datagram, but generated pseudo-randomly and protected from disclo-
  179.       sure [VK83].  This completely protects the first block from unde-
  180.       tectable modification.  One such method could use the same cipher
  181.       and key(s) in Electronic CodeBook (ECB) mode, enciphering the ESP
  182.       Security Parameters Index concatenated with the ESP Sequence Num-
  183.       ber, to generate a keyed hash for an IV.
  184.  
  185.  
  186. 4.  Integrity
  187.  
  188.    CBC does not provide integrity for the datagram.  A single ciphertext
  189.    bit change will affect the current block, and a single corresponding
  190.    bit of the following block.  The remaining blocks will be unaffected,
  191.    without any subsequent indication of the alteration.
  192.  
  193.    Blocks can be easily appended to the datagram.  When a different ses-
  194.    sion-key was used to encrypt the appended blocks, the trailing blocks
  195.    will be uninterpretable.  When the same session-key was applied, even
  196.    though that session-key is unknown, only the first two appended
  197.    blocks will be garbage, and the remainder will decrypt correctly.
  198.    Either case could be detrimental to the intended operations.
  199.  
  200.    Therefore, depending upon the threat environment, when the ESP data
  201.    is not otherwise verified (externally using AH or internally by the
  202.    plaintext payload itself), it is recommended (but not required) that
  203.    an Authenticator be provided.
  204.  
  205.    Security Notes:
  206.  
  207.       Historically, Cipher Block Chaining was designed for uni-
  208.       directional streams of data.  When a block is damaged in transmis-
  209.       sion, on decryption both it and the following block will be gar-
  210.       bled, but all subsequent blocks will automatically be re-
  211.       synchronized.
  212.  
  213.       The cut and paste splicing attack described by [Bellovin95,
  214.       Bellovin96] exploits the self-synchronization of CBC.  If multiple
  215.  
  216.  
  217.  
  218. Simpson                   expires in six months                 [Page 3]
  219. DRAFT                           CBC mode                       July 1997
  220.  
  221.  
  222.       users of a service have legitimate access to the same key, this
  223.       feature can be used to insert or replay previously encrypted data
  224.       of the other users, revealing their original plaintext.  The usual
  225.       (ICMP, TCP, UDP) transport checksum can detect this attack, but on
  226.       its own is not considered cryptographically strong.  In this situ-
  227.       ation, user or connection oriented integrity checking is needed.
  228.  
  229.  
  230. 5.  Collisions
  231.  
  232.    The "birthday paradox" probability of identical ciphertexts is
  233.    squareroot(pi/2) * 2**(blocksize/2).  Additional 2**(blocksize/2+n)
  234.    ciphertexts yield 2**(2**n) collisions.
  235.  
  236.    Each such collision reveals a linear relation between two (random)
  237.    unknown plaintexts and two (random) known ciphertexts.  So, an
  238.    observer learns that Pi = Pj + K for some i, j, and a known constant
  239.    [Maurer91, Knudsen94].
  240.  
  241.    A datagram generally consists of several ciphertext blocks.  The num-
  242.    ber of datagrams that can be safely exchanged under a single session-
  243.    key is a function of the total size of the datagrams.  Ciphers using
  244.    CBC need to refresh keys more frequently than might otherwise be
  245.    expected.
  246.  
  247.    Security Notes:
  248.  
  249.       For a 64-bit block cipher, the basic collision rate is on the
  250.       order of 48 GigaBytes.  While at first glance that might seem like
  251.       a lot of data, a telephone conversation generates about 7,200
  252.       bytes a second, or 93 GigaBytes per hour, not including necessary
  253.       transport headers.  Thus, for this application, the key would
  254.       require refreshment at least twice an hour to avoid linear crypt-
  255.       analysis.
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273. Simpson                   expires in six months                 [Page 4]
  274. DRAFT                           CBC mode                       July 1997
  275.  
  276.  
  277. Security Considerations
  278.  
  279.    Specific security limitations are described as notes in the relevant
  280.    sections.
  281.  
  282.  
  283. Acknowledgements
  284.  
  285.    Most of the text of this specification was derived from earlier work
  286.    by Perry Metzger and William Allen Simpson in multiple Request for
  287.    Comments.
  288.  
  289.    The mathematical explanation of the collision rate was provided by
  290.    Bart Preneel, based on "folklore" from the late 1980s and analysis in
  291.    the early 1990s.
  292.  
  293.    The telephone analogy was provided by Bob Baldwin.
  294.  
  295.  
  296. References
  297.  
  298.    [Bellovin95]
  299.             Bellovin, S., "An Issue With DES-CBC When Used Without
  300.             Strong Integrity", Presentation at the 32nd Internet Engi-
  301.             neering Task Force, Danvers Massachusetts, April 1995.
  302.  
  303.    [Bellovin96]
  304.             Bellovin, S., "Problem Areas for the IP Security Protocols",
  305.             Proceedings of the Sixth Usenix Security Symposium, July
  306.             1996.
  307.  
  308.    [ISO-8732]
  309.             "Banking -- Key management (wholesale)", International Orga-
  310.             nization for Standardization, 1988.
  311.  
  312.    [ISO/IEC-10116]
  313.             "Information Processing -- Modes of Operation for an n-bit
  314.             block cipher algorithm", International Organization for
  315.             Standardization, 1991.
  316.  
  317.    [FIPS-81]
  318.             US National Bureau of Standards, "DES Modes of Operation",
  319.             Federal Information Processing Standard Publication 81,
  320.             December 1980.
  321.  
  322.    [Knudsen94]
  323.             Knudsen, L., PhD thesis, 1994.
  324.  
  325.  
  326.  
  327.  
  328. Simpson                   expires in six months                 [Page 5]
  329. DRAFT                           CBC mode                       July 1997
  330.  
  331.  
  332.    [Maurer91]
  333.             Maurer, U., "Self-Synchronizing Stream Ciphers", Euro-
  334.             Crypt'91.
  335.  
  336.    [MOV97]  Menezes, A.J., van Oorschot, P., and Vanstone, S., "Handbook
  337.             of Applied Cryptography", CRC Press, 1997.
  338.  
  339.    [RFC-1827]
  340.             Atkinson, R., "IP Encapsulating Security Protocol (ESP)",
  341.             Naval Research Laboratory, July 1995.
  342.  
  343.    [Schneier95]
  344.             Schneier, B., "Applied Cryptography Second Edition", John
  345.             Wiley & Sons, New York, NY, 1995.  ISBN 0-471-12845-7.
  346.  
  347.    [VK83]   Voydock, V.L., and Kent, S.T., "Security Mechanisms in High-
  348.             level Networks", ACM Computing Surveys, Vol. 15, No. 2, June
  349.             1983.
  350.  
  351.  
  352.  
  353. Contacts
  354.  
  355.    Comments about this document should be discussed on the ipsec@tis.com
  356.    mailing list.
  357.  
  358.    Questions about this document can also be directed to:
  359.  
  360.       William Allen Simpson
  361.       DayDreamer
  362.       Computer Systems Consulting Services
  363.       1384 Fontaine
  364.       Madison Heights, Michigan  48071
  365.  
  366.           wsimpson@UMich.edu
  367.           wsimpson@GreenDragon.com (preferred)
  368.           bsimpson@MorningStar.com
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384. Simpson                   expires in six months                 [Page 6]
  385.  
  386.