Skip to content

Commit 1d2b60a

Browse files
author
Nicholas Bellinger
committed
iscsi-target: Reject mutual authentication with reflected CHAP_C
This patch adds an explicit check in chap_server_compute_md5() to ensure the CHAP_C value received from the initiator during mutual authentication does not match the original CHAP_C provided by the target. This is in line with RFC-3720, section 8.2.1: Originators MUST NOT reuse the CHAP challenge sent by the Responder for the other direction of a bidirectional authentication. Responders MUST check for this condition and close the iSCSI TCP connection if it occurs. Reported-by: Tejas Vaykole <[email protected]> Cc: [email protected] # 3.1+ Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent 5256ffd commit 1d2b60a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/target/iscsi/iscsi_target_auth.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,16 @@ static int chap_server_compute_md5(
351351
pr_err("Unable to convert incoming challenge\n");
352352
goto out;
353353
}
354+
/*
355+
* During mutual authentication, the CHAP_C generated by the
356+
* initiator must not match the original CHAP_C generated by
357+
* the target.
358+
*/
359+
if (!memcmp(challenge_binhex, chap->challenge, CHAP_CHALLENGE_LENGTH)) {
360+
pr_err("initiator CHAP_C matches target CHAP_C, failing"
361+
" login attempt\n");
362+
goto out;
363+
}
354364
/*
355365
* Generate CHAP_N and CHAP_R for mutual authentication.
356366
*/

0 commit comments

Comments
 (0)