Re: [PATCH 0/2] scsi: target: fix CHAP_N handling

John Garry <[email protected]> Tue, 2 Jun 2026 17:42:57 +0100
Newsgroups org.kernel.vger.target-devel,org.kernel.vger.linux-scsi
Organization Oracle Corporation
Message-ID <[email protected]>
On 02/06/2026 12:43, David Disseldorp wrote:
> The sashiko bot pointed out issues with CHAP_N handling recently, when
> reviewing a patch for a separate issue:
> https://urldefense.com/v3/__https://sashiko.dev/*/patchset/20260521151121.808477-1-hossu.alexandru*40gmail.com__;IyU!!ACWV5N9M2RV99hQ!MNesZJ3IsH9Mv0iZxHUcVmbC_3uwDkJgMhAX8i1TelyqqZD_dAq1cwIy6RtYI8D3boJh5iFeGhtTvfTX$
>    Since extract_param() unconditionally strips '0x' or '0b' prefixes and
>    alters the returned type, wouldn't a valid user with a name like '0xalice' or
>    '0bob' have their username mutated to 'alice' or 'ob'?

is there a real world case or vulnerability being fixed here?

> 
> I believe this behaviour is contrary to the iSCSI spec. I added some simple
> libiscsi tests to cover prefix stripping:
> https://urldefense.com/v3/__https://github.com/sahlberg/libiscsi/pull/472__;!!ACWV5N9M2RV99hQ!MNesZJ3IsH9Mv0iZxHUcVmbC_3uwDkJgMhAX8i1TelyqqZD_dAq1cwIy6RtYI8D3boJh5iFeGh1A_gMb$
> 
> These patches attempt to fix CHAP_N handling.
> 
> ----------------------------------------------------------------
> David Disseldorp (2):
>        scsi: target: add extract_param_str() helper
>        scsi: target: fix auth when CHAP_N carries a hex/b64 prefix
> 
>   drivers/target/iscsi/iscsi_target_auth.c |  8 ++---
>   drivers/target/iscsi/iscsi_target_nego.c | 37 ++++++++++++++++++++++++
>   drivers/target/iscsi/iscsi_target_nego.h |  1 +
>   3 files changed, 40 insertions(+), 6 deletions(-)
> 
>