audk/NetworkPkg/IScsiDxe
Laszlo Ersek 54e90edaed NetworkPkg/IScsiDxe: fix IScsiHexToBin() buffer overflow
The IScsiHexToBin() function documents the EFI_BUFFER_TOO_SMALL return
condition, but never actually checks whether the decoded buffer fits into
the caller-provided room (i.e., the input value of "BinLength"), and
EFI_BUFFER_TOO_SMALL is never returned. The decoding of "HexStr" can
overflow "BinBuffer".

This is remotely exploitable, as shown in a subsequent patch, which adds
error checking to the IScsiHexToBin() call sites. This issue allows the
target to compromise the initiator.

Introduce EFI_BAD_BUFFER_SIZE, in addition to the existent
EFI_BUFFER_TOO_SMALL, for reporting a special case of the buffer overflow,
plus actually catch the buffer overflow.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3356
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210608121259.32451-10-lersek@redhat.com>
2021-06-09 17:25:03 +00:00
..
ComponentName.c NetworkPkg/IScsiDxe: Fix various typos 2020-02-10 22:30:07 +00:00
IScsiAuthenticationInfo.c NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiCHAP.c NetworkPkg/IScsiDxe: assert that IScsiBinToHex() always succeeds 2021-06-09 17:25:03 +00:00
IScsiCHAP.h NetworkPkg/IScsiDxe: clean up "ISCSI_CHAP_AUTH_DATA.OutChallengeLength" 2021-06-09 17:25:03 +00:00
IScsiConfig.c NetworkPkg/IScsiDxe: Fix various typos 2020-02-10 22:30:07 +00:00
IScsiConfig.h NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiConfigNVDataStruc.h NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiConfigStrings.uni NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiConfigVfr.vfr NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiDhcp.c NetworkPkg/IScsiDxe: Enhance the check for array boundary 2020-04-26 06:20:32 +00:00
IScsiDhcp.h NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiDhcp6.c NetworkPkg/IScsiDxe: Enhance the check for array boundary 2020-04-26 06:20:32 +00:00
IScsiDhcp6.h NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiDns.c NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiDns.h NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiDriver.c NetworkPkg/IScsiDxe: Fix various typos 2020-02-10 22:30:07 +00:00
IScsiDriver.h NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiDxe.inf NetworkPkg/IScsiDxe: fix potential integer overflow in IScsiBinToHex() 2021-06-09 17:25:03 +00:00
IScsiDxe.uni NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiDxeExtra.uni NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiExtScsiPassThru.c NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiIbft.c NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiIbft.h NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiImpl.h NetworkPkg/IScsiDxe: fix potential integer overflow in IScsiBinToHex() 2021-06-09 17:25:03 +00:00
IScsiInitiatorName.c NetworkPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:15 -07:00
IScsiMisc.c NetworkPkg/IScsiDxe: fix IScsiHexToBin() buffer overflow 2021-06-09 17:25:03 +00:00
IScsiMisc.h NetworkPkg/IScsiDxe: fix IScsiHexToBin() buffer overflow 2021-06-09 17:25:03 +00:00
IScsiProto.c NetworkPkg/IScsiDxe: Fix various typos 2020-02-10 22:30:07 +00:00
IScsiProto.h NetworkPkg/IScsiDxe: Fix various typos 2020-02-10 22:30:07 +00:00