|
|
|
|
@ -77,6 +77,9 @@ static int DetectHttpHostRawSetupSticky(DetectEngineCtx *de_ctx, Signature *s, c
|
|
|
|
|
static InspectionBuffer *GetRawData(DetectEngineThreadCtx *det_ctx,
|
|
|
|
|
const DetectEngineTransforms *transforms, Flow *_f,
|
|
|
|
|
const uint8_t _flow_flags, void *txv, const int list_id);
|
|
|
|
|
static InspectionBuffer *GetRawData2(DetectEngineThreadCtx *det_ctx,
|
|
|
|
|
const DetectEngineTransforms *transforms, Flow *_f, const uint8_t _flow_flags, void *txv,
|
|
|
|
|
const int list_id);
|
|
|
|
|
static int g_http_host_buffer_id = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -110,6 +113,12 @@ void DetectHttpHHRegister(void)
|
|
|
|
|
PrefilterGenericMpmRegister, GetData, ALPROTO_HTTP,
|
|
|
|
|
HTP_REQUEST_HEADERS);
|
|
|
|
|
|
|
|
|
|
DetectAppLayerInspectEngineRegister2("http_host", ALPROTO_HTTP2, SIG_FLAG_TOSERVER,
|
|
|
|
|
HTTP2StateDataClient, DetectEngineInspectBufferGeneric, GetData2);
|
|
|
|
|
|
|
|
|
|
DetectAppLayerMpmRegister2("http_host", SIG_FLAG_TOSERVER, 2, PrefilterGenericMpmRegister,
|
|
|
|
|
GetData2, ALPROTO_HTTP2, HTTP2StateDataClient);
|
|
|
|
|
|
|
|
|
|
DetectBufferTypeRegisterValidateCallback("http_host",
|
|
|
|
|
DetectHttpHostValidateCallback);
|
|
|
|
|
|
|
|
|
|
@ -142,10 +151,10 @@ void DetectHttpHHRegister(void)
|
|
|
|
|
HTP_REQUEST_HEADERS);
|
|
|
|
|
|
|
|
|
|
DetectAppLayerInspectEngineRegister2("http_raw_host", ALPROTO_HTTP2, SIG_FLAG_TOSERVER,
|
|
|
|
|
HTTP2StateDataClient, DetectEngineInspectBufferGeneric, GetData2);
|
|
|
|
|
HTTP2StateDataClient, DetectEngineInspectBufferGeneric, GetRawData2);
|
|
|
|
|
|
|
|
|
|
DetectAppLayerMpmRegister2("http_raw_host", SIG_FLAG_TOSERVER, 2, PrefilterGenericMpmRegister,
|
|
|
|
|
GetData2, ALPROTO_HTTP2, HTTP2StateDataClient);
|
|
|
|
|
GetRawData2, ALPROTO_HTTP2, HTTP2StateDataClient);
|
|
|
|
|
|
|
|
|
|
DetectBufferTypeSetDescriptionByName("http_raw_host",
|
|
|
|
|
"http raw host header");
|
|
|
|
|
@ -224,7 +233,7 @@ static int DetectHttpHostSetup(DetectEngineCtx *de_ctx, Signature *s, const char
|
|
|
|
|
if (DetectBufferSetActiveList(s, g_http_host_buffer_id) < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
if (DetectSignatureSetAppProto(s, ALPROTO_HTTP) < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
return -1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -258,6 +267,27 @@ static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
|
|
|
|
|
uint32_t b_len = 0;
|
|
|
|
|
const uint8_t *b = NULL;
|
|
|
|
|
|
|
|
|
|
if (rs_http2_tx_get_host_norm(txv, &b, &b_len) != 1)
|
|
|
|
|
return NULL;
|
|
|
|
|
if (b == NULL || b_len == 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
InspectionBufferSetup(det_ctx, list_id, buffer, b, b_len);
|
|
|
|
|
InspectionBufferApplyTransforms(buffer, transforms);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static InspectionBuffer *GetRawData2(DetectEngineThreadCtx *det_ctx,
|
|
|
|
|
const DetectEngineTransforms *transforms, Flow *_f, const uint8_t _flow_flags, void *txv,
|
|
|
|
|
const int list_id)
|
|
|
|
|
{
|
|
|
|
|
InspectionBuffer *buffer = InspectionBufferGet(det_ctx, list_id);
|
|
|
|
|
if (buffer->inspect == NULL) {
|
|
|
|
|
uint32_t b_len = 0;
|
|
|
|
|
const uint8_t *b = NULL;
|
|
|
|
|
|
|
|
|
|
if (rs_http2_tx_get_host(txv, &b, &b_len) != 1)
|
|
|
|
|
return NULL;
|
|
|
|
|
if (b == NULL || b_len == 0)
|
|
|
|
|
|