Summary
When the %REQUESTED_SERVER_NAME(X:Y)% is used in log format and host related options is specified, like HOST_FIRST, SNI_FIRST, it's possible to crash Envoy when the specified host header is missing in the request headers.
Details
At #42659, we introduced enhanced %REQUESTED_SERVER_NAME(X:Y)% which support additional options to fallback to :authority header or x-envoy-original-host header. However, the x-envoy-original-host or :authority (especially the x-envoy-original-host) may be null but the handler of %REQUESTED_SERVER_NAME(X:Y)% doesn't check it.
PoC
Set %REQUESTED_SERVER_NAME(SNI_FIRST:ORIG)% in the log format and send a request without host rewriting, then it will crash.
Impact
Crash Envoy if specific configuration is configured.
Summary
When the
%REQUESTED_SERVER_NAME(X:Y)%is used in log format and host related options is specified, likeHOST_FIRST,SNI_FIRST, it's possible to crash Envoy when the specified host header is missing in the request headers.Details
At #42659, we introduced enhanced
%REQUESTED_SERVER_NAME(X:Y)%which support additional options to fallback to:authorityheader orx-envoy-original-hostheader. However, thex-envoy-original-hostor:authority(especially thex-envoy-original-host) may be null but the handler of%REQUESTED_SERVER_NAME(X:Y)%doesn't check it.PoC
Set
%REQUESTED_SERVER_NAME(SNI_FIRST:ORIG)%in the log format and send a request without host rewriting, then it will crash.Impact
Crash Envoy if specific configuration is configured.