📄 ms-chap.txt
字号:
OUT 16-octet PasswordHash )
{
Use the MD4 algorithm [4] to irreversibly hash Password
into PasswordHash. Only the password is hashed without
including any terminating 0.
}
The "use Windows NT compatible challenge response" flag, if 1,
indicates that the Windows NT response is provided and should be
used in preference to the LAN Manager response. The LAN Manager
response will still be used if the account does not have a Windows
NT password hash, e.g. if the password has not been changed since
the account was uploaded from a LAN Manager 2.x account database.
The LAN Manager response need not be provided (set to 0's) if the
implementation expects all user accounts to be stored only in
fresh Windows NT account databases or ones where all uploaded
passwords have been changed. However, doing so may sacrifice
downward compatibility with non-Windows-NT servers.
If the flag is 0, the Windows NT response is ignored and the LAN
Manager response is used. If the password is LAN Manager
compatible, interoperability may be achieved without providing the
Windows NT challenge response (set to 0's), and providing only the
LAN Manager response. This is what Microsoft Windows95 does,
though this may change in the future. Doing so may sacrifice
interoperability with OEM-specific versions of Windows NT designed
for maximum security in Windows-NT-only networks.
Implementors seeking the broadest possible interoperability are
advised to supply both responses when the password is LAN Manager
compatible. This is what Microsoft Windows NT does.
Cobb [Page 7]
Memo Microsoft PPP CHAP Extensions March 1997
The Name field identifies the authenticatee's user account name.
The Windows NT domain name may prefix the user's account name in
the typical Windows NT format, e.g. "redmond\stevec" where
"redmond" is a Windows NT domain containing the user account
"stevec". If a domain is not provided, the backslash should also
be omitted, e.g. "stevec".
5. Success Packet
The Success packet is identical in format to the standard CHAP
Success packet.
6. Failure Packet
The Failure packet is identical in format to the standard CHAP
Failure packet. There is, however, formatted text stored in the
Message field which, contrary to the standard CHAP rules, does
affect the protocol. The Message field format is:
"E=eeeeeeeeee R=r C=cccccccccccccccc V=vvvvvvvvvv"
where
The "eeeeeeeeee" is the decimal error code (need not be 10
digits) corresponding to one of those listed below, though
implementations should deal with codes not on this list
gracefully.
646 ERROR_RESTRICTED_LOGON_HOURS
647 ERROR_ACCT_DISABLED
648 ERROR_PASSWD_EXPIRED
649 ERROR_NO_DIALIN_PERMISSION
691 ERROR_AUTHENTICATION_FAILURE
709 ERROR_CHANGING_PASSWORD
The "r" is a flag set to "1" if a retry is allowed, and "0" if
not. When authenticator sets this flag to "1" it disables
short timeouts, expecting the authenticatee to prompt the user
for new credentials and resubmit the response.
The "cccccccccccccccc" is 16 hex digits representing an ASCII
representation of a new challenge value. This field is
optional. If it is not sent, authenticator expects the
resubmitted response to be calculated based on the previous
challenge value plus decimal 23 in the first octet, i.e. the
one immediately following the Value Size field. Windows95
authenticators may send this field. Windows NT authenticators
do not, but may in the future. Both systems implement
authenticatee support of this field.
Cobb [Page 8]
Memo Microsoft PPP CHAP Extensions March 1997
The "vvvvvvvvvv" is the decimal version code (need not be 10
digits) indicating the MS-CHAP protocol version supported on
the server. Currently, this is interesting only in selecting
a Change Password packet type. If the field is not present
the version should be assumed 1.
Implementations should accept but ignore additional text they do
not recognize.
7. Change Password Packet (version 1)
The version 1 Change Password packet does not appear in standard
CHAP. It allows the authenticatee to change the password on the
account specified in the previous Response packet. The version 1
Change Password packet should be sent only if the authenticator
reports ERROR_PASSWD_EXPIRED (E=648) in the Message field of the
Failure packet.
This packet type is supported by Windows NT 3.5 and 3.51. It is
not supported by Windows95, though this may change in the future.
See also Change Password Packet (version 2).
The format of this packet is as follows:
1 octet : Code (=5)
1 octet : Identifier
2 octets: Length (=72)
16 octets: Encrypted LAN Manager Old password Hash
16 octets: Encrypted LAN Manager New Password Hash
16 octets: Encrypted Windows NT Old Password Hash
16 octets: Encrypted Windows NT New Password Hash
2 octets: Password Length
2 octets: Flags
Code
5
Identifier
The Identifier field is one octet and aids in matching
requests and replies. The value is the Identifier of the
received Failure packet to which this packet responds plus 1.
Length
72
Cobb [Page 9]
Memo Microsoft PPP CHAP Extensions March 1997
Encrypted LAN Manager New Password Hash
Encrypted LAN Manager Old Password Hash
These fields contain the LAN Manager password hash of the new
and old passwords encrypted with an 8-octet key value [6], as
output by the pseudo-code routine LmEncryptedPasswordHash
below.
LmEncryptedPasswordHash(
IN 0-to-14-oem-char Password,
IN 8-octet KeyValue,
OUT 16-octet Cypher )
{
LmPasswordHash(
Password,
giving PasswordHash )
PasswordHashEncryptedWithBlock(
PasswordHash,
KeyValue,
giving Cypher )
}
PasswordHashEncryptedWithBlock(
IN 16-octet PasswordHash,
IN 7-octet Block,
OUT 16-octet Cypher )
{
DesEncrypt(
1st 8-octets PasswordHash,
1st 7-octets Block,
giving 1st 8-octets Cypher )
DesEncrypt(
2nd 8-octets PasswordHash,
1st 7-octets Block,
giving 2nd 8-octets Cypher )
}
Encrypted Windows NT New Password Hash
Encrypted Windows NT Old Password Hash
These fields contain the Windows NT password hash of the new
and old passwords encrypted with an 8-octet key value [6], as
output by the pseudo-code routine NtEncryptedPasswordHash
below.
Cobb [Page 10]
Memo Microsoft PPP CHAP Extensions March 1997
NtEncryptedPasswordHash(
IN 0-to-14-oem-char Password
IN 8-octet Challenge
OUT 16-octet Cypher )
{
NtPasswordHash(
Password,
giving PasswordHash )
PasswordHashEncryptedWithBlock(
PasswordHash,
Challenge,
giving Cypher )
}
Password Length
The length in octets of the LAN Manager compatible form of the
new password. If this value is less than or equal to 14 it is
assumed that the encrypted LAN Manager password hash fields
are valid. Otherwise, it is assumed these fields are not
valid, in which case the Windows NT compatible passwords must
be provided.
Flags
Bit field of option flags where 0 is the least significant bit
of the 16-bit quantity:
0 : Set 1 indicates that the encrypted Windows NT
hashed passwords are valid and should be used. If
0, the Windows NT fields are not used and the LAN
Manager fields must be provided.
For the broadest possible interoperability,
implementations are encouraged to provide both the
Windows NT and LAN Manager fields when the password
is LAN Manager compatible. This is what Windows NT
does.
1-15 : Reserved, always set 0.
Cobb [Page 11]
Memo Microsoft PPP CHAP Extensions March 1997
8. Change Password Packet (version 2)
The version 2 Change Password packet does not appear in standard
CHAP. It allows the authenticatee to change the password on the
account specified in the previous Response packet. The version 2
Change Password packet should be sent only if the authenticator
reports ERROR_PASSWD_EXPIRED (E=648) and a version of 2 or more in
the Message field of the Failure packet.
This packet type is supported by Windows NT 3.51. It is not
supported by Windows NT 3.5 or Windows95, though the latter may
change in the future. The version 2 change password packet type
is preferable to the version 1 type and should be offered and
accepted where possible.
The format of this packet is as follows:
1 octet : Code (=6)
1 octet : Identifier
2 octet : Length (=1070)
516 octets : Password Encrypted with Old NT Hash
16 octets : Old NT Hash Encrypted with New NT Hash
516 octets : Password Encrypted with Old LM Hash
16 octets : Old LM Hash Encrypted With New NT Hash
24 octets : LAN Manager compatible challenge response
24 octets : Windows NT compatible challenge response
2-octet : Flags
Code
6
Identifier
The Identifier field is one octet and aids in matching
requests and replies. The value is the Identifier of the
received Failure packet to which this packet responds plus 1.
Length
1118
Password Encrypted with Old NT Hash
This field contains the PWBLOCK form of the new Windows NT
password encrypted with the old Windows NT password hash, as
output by the NewPasswordEncryptedWithOldNtPasswordHash
routine below:
Cobb [Page 12]
Memo Microsoft PPP CHAP Extensions March 1997
datatype-PWBLOCK
{
256-unicode-char Password
4-octets PasswordLength
}
NewPasswordEncryptedWithOldNtPasswordHash(
IN 0-to-256-unicode-char NewPassword,
IN 0-to-256-unicode-char OldPassword,
OUT datatype-PWBLOCK EncryptedPwBlock )
{
NtPasswordHash(
OldPassword,
giving PasswordHash )
EncryptPwBlockWithPasswordHash(
NewPassword,
PasswordHash,
giving EncryptedPwBlock )
}
EncryptPwBlockWithPasswordHash(
IN 0-to-256-unicode-char Password,
IN 16-octet PasswordHash,
OUT datatype-PWBLOCK PwBlock )
{
Fill ClearPwBlock with random octet values
lstrcpyW( to ClearPwBlock.Password, from Password )
ClearPwBlock.PasswordLength = lstrlenW( Password )
Rc4Encrypt(
ClearPwBlock,
sizeof( ClearPwBlock ),
PasswordHash,
sizeof( PasswordHash ),
giving PwBlock )
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -