You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTTP/2 protocol error: Received header value surrounded by whitespace #4836
Youtube iOS app unable to connect through mitmproxy. The event log is as below
Web server listening at http://127.0.0.1:8081/
Proxy server listening at http://*:8080
192.168.1.106:50388: client connect
192.168.1.106:51246: client connect
192.168.1.106:51247: client connect
192.168.1.106:50388: server connect r1---sn-u2bpouxgoxu-hxay.googlevideo.com:443 (202.7.223.140:443)
192.168.1.106:51248: client connect
192.168.1.106:51246: server connect notifications-pa.googleapis.com:443 (142.250.70.138:443)
192.168.1.106:51247: server connect youtubei.googleapis.com:443 (142.250.70.170:443)
192.168.1.106:51248: server connect inappcheck.itunes.apple.com:443 (23.199.68.241:443)
192.168.1.106:50389: client connect
192.168.1.106:51249: client connect
192.168.1.106:50388: client disconnect
192.168.1.106:51247: 192.168.1.106:51247: HTTP/2 protocol error: Received header value surrounded by whitespace b'com.google.ios.youtube/16.38.2 (iPhone9,4; U; CPU iOS 14_7_1 like Mac OS X; en_AU) '
192.168.1.106:51248: Client TLS handshake failed. The client disconnected during the handshake. If this happens consistently for inappcheck.itunes.apple.com, this may indicate that the client does not trust the proxy's certificate.
192.168.1.106:51248: client disconnect
192.168.1.106:51247: client disconnect
Thanks Maxim, 7.0.2 works perfectly.
Actually 7.0.3 has been working well until midnight yesterday. Could it be
some change in the certificate that causes the bug?
Thanks a lot for your help.
On Sun, Oct 3, 2021 at 12:44 AM Maximilian Hils ***@***.***>
wrote:
The problem is YouTube's user agent, which incorrectly has a space at the
end. We turned on some additional HTTP header validation in 7.0.3 to
prevent request smuggling. Looks like we should only turn on what we need
for that.
It looks we need to split validate_inbound_headers to something like validate_inbound_headers (validates potentially danger things) and validate_inbound_headers_strictly (strictly validates, for pass h2spec), right?
For now the recommended workarounds are to either use 7.0.2 or to pass --no-http2. Of course, if you are looking at your own client you should just send correct HTTP/2.
Fixing this shouldn't be too hard, we "just" need to disable inbound header validation again (9fed8ae#diff-6b44693c3a91cce56d2b6fafa62f8d2eadae6bf67ff04547d9f1e91eabeb6aacL40) and then add a manual check that there are no transfer-encoding headers. We do need to be a bit careful here and also detect TransFeR-EnCoDing and Transfer-Encoding (with a whitespace), but taking some inspiration from hyper-h2's validate_headers we should be able to cover everything.
Activity
mhils commentedon Oct 2, 2021
trungtly commentedon Oct 2, 2021
mhils commentedon Oct 2, 2021
[-]Youtube iOS app unable to connect[/-][+]HTTP/2 protocol error: Received header value surrounded by whitespace[/+]rinsuki commentedon Nov 29, 2021
9fed8ae#diff-6b44693c3a91cce56d2b6fafa62f8d2eadae6bf67ff04547d9f1e91eabeb6aacL40
It looks we need to split
validate_inbound_headersto something likevalidate_inbound_headers(validates potentially danger things) andvalidate_inbound_headers_strictly(strictly validates, for pass h2spec), right?rinsuki commentedon Nov 29, 2021
UPDATE: actually validate_inbound_headers is directly passed to external h2 library, so we need to:
AlbertoFDR commentedon Jan 10, 2022
Any update? 🙃
If you try to visit dropbox.com throws the same exception.
mhils commentedon Jan 11, 2022
For now the recommended workarounds are to either use 7.0.2 or to pass
--no-http2. Of course, if you are looking at your own client you should just send correct HTTP/2.Fixing this shouldn't be too hard, we "just" need to disable inbound header validation again (9fed8ae#diff-6b44693c3a91cce56d2b6fafa62f8d2eadae6bf67ff04547d9f1e91eabeb6aacL40) and then add a manual check that there are no
transfer-encodingheaders. We do need to be a bit careful here and also detectTransFeR-EnCoDingandTransfer-Encoding(with a whitespace), but taking some inspiration from hyper-h2'svalidate_headerswe should be able to cover everything.Somewhat refs #4746.
mhils commentedon Mar 19, 2022
This check can be disabled in mitmproxy 8 using the
validate_inbound_headersoption. :)