Guests can send absolute-form HTTP requests to different hosts
Description
Wasmtime's implementation of wasi:http in the wasmtime-wasi-http crate did not check that the value a guest passes to set-path-with-query on an outgoing request is actually a path. Absolute-form values such as http://other.example/x were accepted and written verbatim as the request target of the HTTP/1.1 request line, while the connection and the Host header used the authority the guest set with set-authority:
GET http://other.example/x HTTP/1.1
host: allowed.exampleWasmtime only connects to the authority the guest set, and any sort of request filtering based on host is done by the authority the guest set as well. However, RFC 9112 requires a server receiving an absolute-form target to ignore Host, so if the allowed authority is a forward proxy or a gateway that honors absolute-form targets, it forwards the request to other.example. A guest may then reach hosts the embedder did not have visibility into or allow. Both wasi:http@0.2 and wasi:http@0.3 are affected, including guests run with wasmtime serve and wasmtime run -S http.
Impact
This issue can cause hosts using the wasmtime-wasi-http crate to erroneously have requests sent to hosts that are otherwise explicitly disallowed in filtering policies.
Patches
Wasmtime 36.0.18, 48.0.6, and 49.0.3 have all been released which fixes this issue.