rfc1994.txt 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. Network Working Group W. Simpson
  2. Request for Comments: 1994 DayDreamer
  3. Obsoletes: 1334 August 1996
  4. Category: Standards Track
  5. PPP Challenge Handshake Authentication Protocol (CHAP)
  6. Status of this Memo
  7. This document specifies an Internet standards track protocol for the
  8. Internet community, and requests discussion and suggestions for
  9. improvements. Please refer to the current edition of the "Internet
  10. Official Protocol Standards" (STD 1) for the standardization state
  11. and status of this protocol. Distribution of this memo is unlimited.
  12. Abstract
  13. The Point-to-Point Protocol (PPP) [1] provides a standard method for
  14. transporting multi-protocol datagrams over point-to-point links.
  15. PPP also defines an extensible Link Control Protocol, which allows
  16. negotiation of an Authentication Protocol for authenticating its peer
  17. before allowing Network Layer protocols to transmit over the link.
  18. This document defines a method for Authentication using PPP, which
  19. uses a random Challenge, with a cryptographically hashed Response
  20. which depends upon the Challenge and a secret key.
  21. Table of Contents
  22. 1. Introduction .......................................... 1
  23. 1.1 Specification of Requirements ................... 1
  24. 1.2 Terminology ..................................... 2
  25. 2. Challenge-Handshake Authentication Protocol ........... 2
  26. 2.1 Advantages ...................................... 3
  27. 2.2 Disadvantages ................................... 3
  28. 2.3 Design Requirements ............................. 4
  29. 3. Configuration Option Format ........................... 5
  30. 4. Packet Format ......................................... 6
  31. 4.1 Challenge and Response .......................... 7
  32. 4.2 Success and Failure ............................. 9
  33. SECURITY CONSIDERATIONS ...................................... 10
  34. ACKNOWLEDGEMENTS ............................................. 11
  35. REFERENCES ................................................... 12
  36. CONTACTS ..................................................... 12
  37. Simpson [Page i]
  38. RFC 1994 PPP CHAP August 1996
  39. 1. Introduction
  40. In order to establish communications over a point-to-point link, each
  41. end of the PPP link must first send LCP packets to configure the data
  42. link during Link Establishment phase. After the link has been
  43. established, PPP provides for an optional Authentication phase before
  44. proceeding to the Network-Layer Protocol phase.
  45. By default, authentication is not mandatory. If authentication of
  46. the link is desired, an implementation MUST specify the
  47. Authentication-Protocol Configuration Option during Link
  48. Establishment phase.
  49. These authentication protocols are intended for use primarily by
  50. hosts and routers that connect to a PPP network server via switched
  51. circuits or dial-up lines, but might be applied to dedicated links as
  52. well. The server can use the identification of the connecting host
  53. or router in the selection of options for network layer negotiations.
  54. This document defines a PPP authentication protocol. The Link
  55. Establishment and Authentication phases, and the Authentication-
  56. Protocol Configuration Option, are defined in The Point-to-Point
  57. Protocol (PPP) [1].
  58. 1.1. Specification of Requirements
  59. In this document, several words are used to signify the requirements
  60. of the specification. These words are often capitalized.
  61. MUST This word, or the adjective "required", means that the
  62. definition is an absolute requirement of the specification.
  63. MUST NOT This phrase means that the definition is an absolute
  64. prohibition of the specification.
  65. SHOULD This word, or the adjective "recommended", means that there
  66. may exist valid reasons in particular circumstances to
  67. ignore this item, but the full implications must be
  68. understood and carefully weighed before choosing a
  69. different course.
  70. MAY This word, or the adjective "optional", means that this
  71. item is one of an allowed set of alternatives. An
  72. implementation which does not include this option MUST be
  73. prepared to interoperate with another implementation which
  74. does include the option.
  75. Simpson [Page 1]
  76. RFC 1994 PPP CHAP August 1996
  77. 1.2. Terminology
  78. This document frequently uses the following terms:
  79. authenticator
  80. The end of the link requiring the authentication. The
  81. authenticator specifies the authentication protocol to be
  82. used in the Configure-Request during Link Establishment
  83. phase.
  84. peer The other end of the point-to-point link; the end which is
  85. being authenticated by the authenticator.
  86. silently discard
  87. This means the implementation discards the packet without
  88. further processing. The implementation SHOULD provide the
  89. capability of logging the error, including the contents of
  90. the silently discarded packet, and SHOULD record the event
  91. in a statistics counter.
  92. 2. Challenge-Handshake Authentication Protocol
  93. The Challenge-Handshake Authentication Protocol (CHAP) is used to
  94. periodically verify the identity of the peer using a 3-way handshake.
  95. This is done upon initial link establishment, and MAY be repeated
  96. anytime after the link has been established.
  97. 1. After the Link Establishment phase is complete, the
  98. authenticator sends a "challenge" message to the peer.
  99. 2. The peer responds with a value calculated using a "one-way
  100. hash" function.
  101. 3. The authenticator checks the response against its own
  102. calculation of the expected hash value. If the values match,
  103. the authentication is acknowledged; otherwise the connection
  104. SHOULD be terminated.
  105. 4. At random intervals, the authenticator sends a new challenge to
  106. the peer, and repeats steps 1 to 3.
  107. Simpson [Page 2]
  108. RFC 1994 PPP CHAP August 1996
  109. 2.1. Advantages
  110. CHAP provides protection against playback attack by the peer through
  111. the use of an incrementally changing identifier and a variable
  112. challenge value. The use of repeated challenges is intended to limit
  113. the time of exposure to any single attack. The authenticator is in
  114. control of the frequency and timing of the challenges.
  115. This authentication method depends upon a "secret" known only to the
  116. authenticator and that peer. The secret is not sent over the link.
  117. Although the authentication is only one-way, by negotiating CHAP in
  118. both directions the same secret set may easily be used for mutual
  119. authentication.
  120. Since CHAP may be used to authenticate many different systems, name
  121. fields may be used as an index to locate the proper secret in a large
  122. table of secrets. This also makes it possible to support more than
  123. one name/secret pair per system, and to change the secret in use at
  124. any time during the session.
  125. 2.2. Disadvantages
  126. CHAP requires that the secret be available in plaintext form.
  127. Irreversably encrypted password databases commonly available cannot
  128. be used.
  129. It is not as useful for large installations, since every possible
  130. secret is maintained at both ends of the link.
  131. Implementation Note: To avoid sending the secret over other links
  132. in the network, it is recommended that the challenge and response
  133. values be examined at a central server, rather than each network
  134. access server. Otherwise, the secret SHOULD be sent to such
  135. servers in a reversably encrypted form. Either case requires a
  136. trusted relationship, which is outside the scope of this
  137. specification.
  138. Simpson [Page 3]
  139. RFC 1994 PPP CHAP August 1996
  140. 2.3. Design Requirements
  141. The CHAP algorithm requires that the length of the secret MUST be at
  142. least 1 octet. The secret SHOULD be at least as large and
  143. unguessable as a well-chosen password. It is preferred that the
  144. secret be at least the length of the hash value for the hashing
  145. algorithm chosen (16 octets for MD5). This is to ensure a
  146. sufficiently large range for the secret to provide protection against
  147. exhaustive search attacks.
  148. The one-way hash algorithm is chosen such that it is computationally
  149. infeasible to determine the secret from the known challenge and
  150. response values.
  151. Each challenge value SHOULD be unique, since repetition of a
  152. challenge value in conjunction with the same secret would permit an
  153. attacker to reply with a previously intercepted response. Since it
  154. is expected that the same secret MAY be used to authenticate with
  155. servers in disparate geographic regions, the challenge SHOULD exhibit
  156. global and temporal uniqueness.
  157. Each challenge value SHOULD also be unpredictable, least an attacker
  158. trick a peer into responding to a predicted future challenge, and
  159. then use the response to masquerade as that peer to an authenticator.
  160. Although protocols such as CHAP are incapable of protecting against
  161. realtime active wiretapping attacks, generation of unique
  162. unpredictable challenges can protect against a wide range of active
  163. attacks.
  164. A discussion of sources of uniqueness and probability of divergence
  165. is included in the Magic-Number Configuration Option [1].
  166. Simpson [Page 4]
  167. RFC 1994 PPP CHAP August 1996
  168. 3. Configuration Option Format
  169. A summary of the Authentication-Protocol Configuration Option format
  170. to negotiate the Challenge-Handshake Authentication Protocol is shown
  171. below. The fields are transmitted from left to right.
  172. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  173. | Type | Length | Authentication-Protocol |
  174. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  175. | Algorithm |
  176. +-+-+-+-+-+-+-+-+
  177. Type
  178. 3
  179. Length
  180. 5
  181. Authentication-Protocol
  182. c223 (hex) for Challenge-Handshake Authentication Protocol.
  183. Algorithm
  184. The Algorithm field is one octet and indicates the authentication
  185. method to be used. Up-to-date values are specified in the most
  186. recent "Assigned Numbers" [2]. One value is required to be
  187. implemented:
  188. 5 CHAP with MD5 [3]
  189. Simpson [Page 5]
  190. RFC 1994 PPP CHAP August 1996
  191. 4. Packet Format
  192. Exactly one Challenge-Handshake Authentication Protocol packet is
  193. encapsulated in the Information field of a PPP Data Link Layer frame
  194. where the protocol field indicates type hex c223 (Challenge-Handshake
  195. Authentication Protocol). A summary of the CHAP packet format is
  196. shown below. The fields are transmitted from left to right.
  197. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  198. | Code | Identifier | Length |
  199. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  200. | Data ...
  201. +-+-+-+-+
  202. Code
  203. The Code field is one octet and identifies the type of CHAP
  204. packet. CHAP Codes are assigned as follows:
  205. 1 Challenge
  206. 2 Response
  207. 3 Success
  208. 4 Failure
  209. Identifier
  210. The Identifier field is one octet and aids in matching challenges,
  211. responses and replies.
  212. Length
  213. The Length field is two octets and indicates the length of the
  214. CHAP packet including the Code, Identifier, Length and Data
  215. fields. Octets outside the range of the Length field should be
  216. treated as Data Link Layer padding and should be ignored on
  217. reception.
  218. Data
  219. The Data field is zero or more octets. The format of the Data
  220. field is determined by the Code field.
  221. Simpson [Page 6]
  222. RFC 1994 PPP CHAP August 1996
  223. 4.1. Challenge and Response
  224. Description
  225. The Challenge packet is used to begin the Challenge-Handshake
  226. Authentication Protocol. The authenticator MUST transmit a CHAP
  227. packet with the Code field set to 1 (Challenge). Additional
  228. Challenge packets MUST be sent until a valid Response packet is
  229. received, or an optional retry counter expires.
  230. A Challenge packet MAY also be transmitted at any time during the
  231. Network-Layer Protocol phase to ensure that the connection has not
  232. been altered.
  233. The peer SHOULD expect Challenge packets during the Authentication
  234. phase and the Network-Layer Protocol phase. Whenever a Challenge
  235. packet is received, the peer MUST transmit a CHAP packet with the
  236. Code field set to 2 (Response).
  237. Whenever a Response packet is received, the authenticator compares
  238. the Response Value with its own calculation of the expected value.
  239. Based on this comparison, the authenticator MUST send a Success or
  240. Failure packet (described below).
  241. Implementation Notes: Because the Success might be lost, the
  242. authenticator MUST allow repeated Response packets during the
  243. Network-Layer Protocol phase after completing the
  244. Authentication phase. To prevent discovery of alternative
  245. Names and Secrets, any Response packets received having the
  246. current Challenge Identifier MUST return the same reply Code
  247. previously returned for that specific Challenge (the message
  248. portion MAY be different). Any Response packets received
  249. during any other phase MUST be silently discarded.
  250. When the Failure is lost, and the authenticator terminates the
  251. link, the LCP Terminate-Request and Terminate-Ack provide an
  252. alternative indication that authentication failed.
  253. Simpson [Page 7]
  254. RFC 1994 PPP CHAP August 1996
  255. A summary of the Challenge and Response packet format is shown below.
  256. The fields are transmitted from left to right.
  257. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  258. | Code | Identifier | Length |
  259. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  260. | Value-Size | Value ...
  261. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  262. | Name ...
  263. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  264. Code
  265. 1 for Challenge;
  266. 2 for Response.
  267. Identifier
  268. The Identifier field is one octet. The Identifier field MUST be
  269. changed each time a Challenge is sent.
  270. The Response Identifier MUST be copied from the Identifier field
  271. of the Challenge which caused the Response.
  272. Value-Size
  273. This field is one octet and indicates the length of the Value
  274. field.
  275. Value
  276. The Value field is one or more octets. The most significant octet
  277. is transmitted first.
  278. The Challenge Value is a variable stream of octets. The
  279. importance of the uniqueness of the Challenge Value and its
  280. relationship to the secret is described above. The Challenge
  281. Value MUST be changed each time a Challenge is sent. The length
  282. of the Challenge Value depends upon the method used to generate
  283. the octets, and is independent of the hash algorithm used.
  284. The Response Value is the one-way hash calculated over a stream of
  285. octets consisting of the Identifier, followed by (concatenated
  286. with) the "secret", followed by (concatenated with) the Challenge
  287. Value. The length of the Response Value depends upon the hash
  288. algorithm used (16 octets for MD5).
  289. Simpson [Page 8]
  290. RFC 1994 PPP CHAP August 1996
  291. Name
  292. The Name field is one or more octets representing the
  293. identification of the system transmitting the packet. There are
  294. no limitations on the content of this field. For example, it MAY
  295. contain ASCII character strings or globally unique identifiers in
  296. ASN.1 syntax. The Name should not be NUL or CR/LF terminated.
  297. The size is determined from the Length field.
  298. 4.2. Success and Failure
  299. Description
  300. If the Value received in a Response is equal to the expected
  301. value, then the implementation MUST transmit a CHAP packet with
  302. the Code field set to 3 (Success).
  303. If the Value received in a Response is not equal to the expected
  304. value, then the implementation MUST transmit a CHAP packet with
  305. the Code field set to 4 (Failure), and SHOULD take action to
  306. terminate the link.
  307. A summary of the Success and Failure packet format is shown below.
  308. The fields are transmitted from left to right.
  309. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  310. | Code | Identifier | Length |
  311. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  312. | Message ...
  313. +-+-+-+-+-+-+-+-+-+-+-+-+-
  314. Code
  315. 3 for Success;
  316. 4 for Failure.
  317. Identifier
  318. The Identifier field is one octet and aids in matching requests
  319. and replies. The Identifier field MUST be copied from the
  320. Identifier field of the Response which caused this reply.
  321. Simpson [Page 9]
  322. RFC 1994 PPP CHAP August 1996
  323. Message
  324. The Message field is zero or more octets, and its contents are
  325. implementation dependent. It is intended to be human readable,
  326. and MUST NOT affect operation of the protocol. It is recommended
  327. that the message contain displayable ASCII characters 32 through
  328. 126 decimal. Mechanisms for extension to other character sets are
  329. the topic of future research. The size is determined from the
  330. Length field.
  331. Security Considerations
  332. Security issues are the primary topic of this RFC.
  333. The interaction of the authentication protocols within PPP are highly
  334. implementation dependent. This is indicated by the use of SHOULD
  335. throughout the document.
  336. For example, upon failure of authentication, some implementations do
  337. not terminate the link. Instead, the implementation limits the kind
  338. of traffic in the Network-Layer Protocols to a filtered subset, which
  339. in turn allows the user opportunity to update secrets or send mail to
  340. the network administrator indicating a problem.
  341. There is no provision for re-tries of failed authentication.
  342. However, the LCP state machine can renegotiate the authentication
  343. protocol at any time, thus allowing a new attempt. It is recommended
  344. that any counters used for authentication failure not be reset until
  345. after successful authentication, or subsequent termination of the
  346. failed link.
  347. There is no requirement that authentication be full duplex or that
  348. the same protocol be used in both directions. It is perfectly
  349. acceptable for different protocols to be used in each direction.
  350. This will, of course, depend on the specific protocols negotiated.
  351. The secret SHOULD NOT be the same in both directions. This allows an
  352. attacker to replay the peer's challenge, accept the computed
  353. response, and use that response to authenticate.
  354. In practice, within or associated with each PPP server, there is a
  355. database which associates "user" names with authentication
  356. information ("secrets"). It is not anticipated that a particular
  357. named user would be authenticated by multiple methods. This would
  358. make the user vulnerable to attacks which negotiate the least secure
  359. method from among a set (such as PAP rather than CHAP). If the same
  360. Simpson [Page 10]
  361. RFC 1994 PPP CHAP August 1996
  362. secret was used, PAP would reveal the secret to be used later with
  363. CHAP.
  364. Instead, for each user name there should be an indication of exactly
  365. one method used to authenticate that user name. If a user needs to
  366. make use of different authentication methods under different
  367. circumstances, then distinct user names SHOULD be employed, each of
  368. which identifies exactly one authentication method.
  369. Passwords and other secrets should be stored at the respective ends
  370. such that access to them is as limited as possible. Ideally, the
  371. secrets should only be accessible to the process requiring access in
  372. order to perform the authentication.
  373. The secrets should be distributed with a mechanism that limits the
  374. number of entities that handle (and thus gain knowledge of) the
  375. secret. Ideally, no unauthorized person should ever gain knowledge
  376. of the secrets. Such a mechanism is outside the scope of this
  377. specification.
  378. Acknowledgements
  379. David Kaufman, Frank Heinrich, and Karl Auerbach used a challenge
  380. handshake at SDC when designing one of the protocols for a "secure"
  381. network in the mid-1970s. Tom Bearson built a prototype Sytek
  382. product ("Poloneous"?) on the challenge-response notion in the 1982-
  383. 83 timeframe. Another variant is documented in the various IBM SNA
  384. manuals. Yet another variant was implemented by Karl Auerbach in the
  385. Telebit NetBlazer circa 1991.
  386. Kim Toms and Barney Wolff provided useful critiques of earlier
  387. versions of this document.
  388. Special thanks to Dave Balenson, Steve Crocker, James Galvin, and
  389. Steve Kent, for their extensive explanations and suggestions. Now,
  390. if only we could get them to agree with each other.
  391. Simpson [Page 11]
  392. RFC 1994 PPP CHAP August 1996
  393. References
  394. [1] Simpson, W., Editor, "The Point-to-Point Protocol (PPP)", STD
  395. 51, RFC 1661, DayDreamer, July 1994.
  396. [2] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2, RFC
  397. 1700, USC/Information Sciences Institute, October 1994.
  398. [3] Rivest, R., and S. Dusse, "The MD5 Message-Digest Algorithm",
  399. MIT Laboratory for Computer Science and RSA Data Security,
  400. Inc., RFC 1321, April 1992.
  401. Contacts
  402. Comments should be submitted to the ietf-ppp@merit.edu mailing list.
  403. This document was reviewed by the Point-to-Point Protocol Working
  404. Group of the Internet Engineering Task Force (IETF). The working
  405. group can be contacted via the current chair:
  406. Karl Fox
  407. Ascend Communications
  408. 3518 Riverside Drive, Suite 101
  409. Columbus, Ohio 43221
  410. karl@MorningStar.com
  411. karl@Ascend.com
  412. Questions about this memo can also be directed to:
  413. William Allen Simpson
  414. DayDreamer
  415. Computer Systems Consulting Services
  416. 1384 Fontaine
  417. Madison Heights, Michigan 48071
  418. wsimpson@UMich.edu
  419. wsimpson@GreenDragon.com (preferred)
  420. Simpson [Page 12]