Skip to content

fix ippeveprinter Host check accepting names that start with a digit - #225

Open
tanjiroK-coder wants to merge 1 commit into
OpenPrinting:masterfrom
tanjiroK-coder:ippeveprinter-host-digit
Open

tanjiroK-coder wants to merge 1 commit into
OpenPrinting:masterfrom
tanjiroK-coder:ippeveprinter-host-digit

Conversation

@tanjiroK-coder

Copy link
Copy Markdown
Contributor

process_http in tools/ippeveprinter.c rejects requests whose Host header is not the printer's hostname, localhost, a .local name or an IP address, which is what keeps a DNS-rebinding web page from talking to the printer through a victim's browser. The IP address case is detected by looking only at the first character, so any DNS name that starts with a digit is accepted: on current master Host: attacker.example gets 400 Bad Request while Host: 1.attacker.example and Host: 9evil.com get 200, for the web interface and for IPP requests alike. A page served from a name like 1.attacker.example that rebinds to the printer (or to 127.0.0.1) can therefore send IPP operations and read the responses, and Get-Printer-Attributes echoes the name back in printer-uri-supported and printer-more-info (ipp://1.attacker.example:8631/ipp/print). I reproduced it by running ippeveprinter -p 8631 and sending curl requests and a raw Get-Printer-Attributes request with each Host value. The fix keeps the numeric shortcut only when the whole value is digits and dots, which is how browsers send an IPv4 host, so IPv4 and bracketed IPv6 literals, localhost, the printer hostname and .local names behave as before while 1.attacker.example and 9evil.com now get 400. The vcnet build and run-tests.ps1 pass with the change.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant