// curl_http2_tunnel_mixup.c - Simulated libcurl handling CONNECT over HTTP/2
#include <stdio.h>
void handle_http2_stream(int stream_id) {
// Vulnerability: after CONNECT, the proxy mixes streams with the tunneled data
if (stream_id == 0) {
printf("CONNECT to target\n");
} else {
// Data from another stream may leak into the tunnel
printf("Stream %d data crosses tunnel boundary\n", stream_id);
}
}
int main() {
handle_http2_stream(0);
handle_http2_stream(1); // should be isolated
return 0;
}
libcurl の HTTP/2 プロキシ CONNECT 実装の脆弱性により、トンネル確立後にストリームが適切に分離されません。単一の HTTP/2 ストリームを制御できる攻撃者が、別のトンネルにデータを注入し、レスポンススモグリングや認証情報の傍受を引き起こす可能性があります。
シミュレーションをコンパイルして実行します:
gcc -o curl_http2_tunnel curl_http2_tunnel_mixup.c
./curl_http2_tunnel
出力は、ストリームがトンネル境界を越える様子を示しています。