|
|
|
@ -62,6 +62,9 @@ static int g_http_raw_header_buffer_id = 0;
|
|
|
|
|
static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx,
|
|
|
|
|
const DetectEngineTransforms *transforms, Flow *_f,
|
|
|
|
|
const uint8_t flow_flags, void *txv, const int list_id);
|
|
|
|
|
static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
|
|
|
|
|
const DetectEngineTransforms *transforms, Flow *_f, const uint8_t flow_flags, void *txv,
|
|
|
|
|
const int list_id);
|
|
|
|
|
|
|
|
|
|
static int PrefilterMpmHttpHeaderRawRequestRegister(DetectEngineCtx *de_ctx,
|
|
|
|
|
SigGroupHead *sgh, MpmCtx *mpm_ctx,
|
|
|
|
@ -105,6 +108,16 @@ void DetectHttpRawHeaderRegister(void)
|
|
|
|
|
PrefilterMpmHttpHeaderRawResponseRegister, NULL, ALPROTO_HTTP1,
|
|
|
|
|
0); /* progress handled in register */
|
|
|
|
|
|
|
|
|
|
DetectAppLayerInspectEngineRegister2("http_raw_header", ALPROTO_HTTP2, SIG_FLAG_TOSERVER,
|
|
|
|
|
HTTP2StateDataClient, DetectEngineInspectBufferGeneric, GetData2);
|
|
|
|
|
DetectAppLayerInspectEngineRegister2("http_raw_header", ALPROTO_HTTP2, SIG_FLAG_TOCLIENT,
|
|
|
|
|
HTTP2StateDataServer, DetectEngineInspectBufferGeneric, GetData2);
|
|
|
|
|
|
|
|
|
|
DetectAppLayerMpmRegister2("http_raw_header", SIG_FLAG_TOSERVER, 2, PrefilterGenericMpmRegister,
|
|
|
|
|
GetData2, ALPROTO_HTTP2, HTTP2StateDataClient);
|
|
|
|
|
DetectAppLayerMpmRegister2("http_raw_header", SIG_FLAG_TOCLIENT, 2, PrefilterGenericMpmRegister,
|
|
|
|
|
GetData2, ALPROTO_HTTP2, HTTP2StateDataServer);
|
|
|
|
|
|
|
|
|
|
DetectBufferTypeSetDescriptionByName("http_raw_header",
|
|
|
|
|
"raw http headers");
|
|
|
|
|
|
|
|
|
@ -146,7 +159,7 @@ static int DetectHttpRawHeaderSetupSticky(DetectEngineCtx *de_ctx, Signature *s,
|
|
|
|
|
{
|
|
|
|
|
if (DetectBufferSetActiveList(s, g_http_raw_header_buffer_id) < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
if (DetectSignatureSetAppProto(s, ALPROTO_HTTP1) < 0)
|
|
|
|
|
if (DetectSignatureSetAppProto(s, ALPROTO_HTTP) < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -192,6 +205,27 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx,
|
|
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static InspectionBuffer *GetData2(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_headers_raw(txv, flow_flags, &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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
typedef struct PrefilterMpmHttpHeaderRawCtx {
|
|
|
|
|
int list_id;
|
|
|
|
|
const MpmCtx *mpm_ctx;
|
|
|
|
|