Skip to content

Commit cd3fb56

Browse files
committed
Fixed vulnerabilities TALOS-2023-1732, TALOS-2023-1733, and TALOS-2023-1738 reported by Cisco TALOS. The fix to TALOS-2023-1738 prevents TALOS-2023-1733 from occurring in the first place.
1 parent b12e49c commit cd3fb56

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

Server/Source/http-s.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,15 @@
330330
#define HTTPs_PATH_SEP_CHAR_DFLT '/'
331331

332332

333+
/*
334+
*********************************************************************************************************
335+
* FORM DEFINES
336+
*********************************************************************************************************
337+
*/
338+
339+
#define HTTPs_FORM_BOUNDARY_STR_LEN_MAX 72u
340+
341+
333342
/*
334343
*********************************************************************************************************
335344
* STATIC ERR FILE LEN DEFINES

Server/Source/http-s_mem.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,6 @@
4949
#define HTTPs_CFG_POOLS_INIT_NBR 1
5050

5151

52-
/*
53-
*********************************************************************************************************
54-
* FORM DEFINES
55-
*********************************************************************************************************
56-
*/
57-
58-
#define HTTPs_FORM_BOUNDARY_STR_LEN_MAX 72u
59-
60-
6152
/*
6253
*********************************************************************************************************
6354
*********************************************************************************************************

Server/Source/http-s_req.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,12 @@ static void HTTPsReq_ProtocolVerParse (HTTPs_INSTANCE *p_instance,
15341534
* If the user selected a second (image) file "file2.gif", the user agent might construct the parts as follows:
15351535
*
15361536
* Content-Type: multipart/form-data; boundary=AaB03x
1537+
*
1538+
* (4) RFC 2046 Section "5.1.1 Common Syntax" states the following:
1539+
*
1540+
* "Boundary delimiters must not appear within the encapsulated material, and must be no longer than 70 characters,
1541+
* not counting the two leading hyphens."
1542+
*
15371543
*********************************************************************************************************
15381544
*/
15391545

@@ -1676,8 +1682,14 @@ static void HTTPsReq_HdrParse (HTTPs_INSTANCE *p_instance,
16761682
p_val++; /* Remove space before boundary val. */
16771683
p_val = HTTP_StrGraphSrchFirst(p_val,
16781684
len);
1679-
len = p_field_end - p_val;
1685+
len = (p_field_end - p_val);
16801686

1687+
/* Make sure 'len' val does not exceed boundary thresh. */
1688+
/* (See Note #4). */
1689+
if (len >= HTTPs_FORM_BOUNDARY_STR_LEN_MAX) {
1690+
*p_err = HTTPs_ERR_REQ_FORMAT_INVALID;
1691+
return;
1692+
}
16811693
/* Copy boundary val to Conn struct. */
16821694
Str_Copy_N(p_conn->FormBoundaryPtr,
16831695
p_val,
@@ -1806,7 +1818,7 @@ static void HTTPsReq_HdrParse (HTTPs_INSTANCE *p_instance,
18061818
if (p_val != DEF_NULL) {
18071819
len = p_field_end - p_val;
18081820

1809-
if (len > p_cfg->HdrRxCfgPtr->DataLenMax) {
1821+
if (len >= p_cfg->HdrRxCfgPtr->DataLenMax) {
18101822
HTTPs_ERR_INC(p_ctr_errs->Req_ErrHdrDataLenInv);
18111823
*p_err = HTTPS_ERR_REQ_HDR_INVALID_VAL_LEN;
18121824
return;

0 commit comments

Comments
 (0)