Repository navigation
fix ippeveprinter Host check accepting names that start with a digit - #225
Open
tanjiroK-coder wants to merge 1 commit into
Open
tanjiroK-coder wants to merge 1 commit into
tanjiroK-coder wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.examplegets 400 Bad Request whileHost: 1.attacker.exampleandHost: 9evil.comget 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 runningippeveprinter -p 8631and 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.