Skip to content

Commit 63afedf

Browse files
Nicholas Bellingergregkh
Nicholas Bellinger
authored andcommitted
iscsi-target: Reject mutual authentication with reflected CHAP_C
commit 1d2b60a upstream. 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]> Signed-off-by: Nicholas Bellinger <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4b6b037 commit 63afedf

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
@@ -315,6 +315,16 @@ static int chap_server_compute_md5(
315315
pr_err("Unable to convert incoming challenge\n");
316316
goto out;
317317
}
318+
/*
319+
* During mutual authentication, the CHAP_C generated by the
320+
* initiator must not match the original CHAP_C generated by
321+
* the target.
322+
*/
323+
if (!memcmp(challenge_binhex, chap->challenge, CHAP_CHALLENGE_LENGTH)) {
324+
pr_err("initiator CHAP_C matches target CHAP_C, failing"
325+
" login attempt\n");
326+
goto out;
327+
}
318328
/*
319329
* Generate CHAP_N and CHAP_R for mutual authentication.
320330
*/

0 commit comments

Comments
 (0)