Skip to content

[Bug] Local render server answers any Host header (DNS rebinding) #479

Open

Description

@wjsoj

Hi! The local render server accepts any Host header, which leaves it open to DNS rebinding while a render runs. A small fix is ready in #472.

What happened

serveHtmlProgram in packages/provider-html-local/src/server.ts listens on 127.0.0.1 only but answers requests for any Host. A web page whose own hostname is rebound to 127.0.0.1 could read the staged program HTML, media and frames during a render.

What you expected

The server answers only its own 127.0.0.1:<port> origin, which is the only URL Chrome is given.

How to reproduce

While a render (or serveHtmlProgram(root)) is serving, request http://127.0.0.1:<port>/ with Host: attacker.example:<port> or Host: localhost:<port>: both return 200 with the program content.

Hypit version

main at 2d31e88 (0.3.2 prepared)

Fix

#472 answers 421 unless Host is exactly 127.0.0.1:<port>. Capture is unaffected (Chrome always uses server.url); the browser-gated capture tests pass. Note: #421 also adds test/server.test.ts, so whichever lands second just keeps both tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions