Silly Network Printer Fun
Posted by jeremy on 19th March 2010
Yesterday I was configuring my firewall to allow my laptop to talk to a network printer installed on my family’s LAN. You may find that odd, but I tend to segregate my network into several slices such as a lab network, my network, and my family’s network. This ensures the stuff I am analyzing or playing within the lab doesn’t infect and/or affect my network or my family’s network. It also allows me to configure specific monitoring policies for snort, dans guardian, and other network monitoring tools targeted specifically for things like my kids Internet activities. Anyways all that is besides the point, back to the silly printer fun stuff. Once I had the firewall rule in place I utilized netcat to verify my connection over port 9100 to the printer like this: “nc 192.168.1.15 9100″. Not sure why I did it other than sheer curiosity, but I typed “test” into the connection prompt and much to my surprise the printer printed a single page with the word “test” on it. Now this is probably not news for many of you, but it was to me as I didn’t realize that network printers listened on port 9100 for just a RAW data feed. I guess I was expecting the network printer to expect some sort of formated protocol and it can, but the cool thing is it doesn’t have to be. With this new information, to me at least, I immediately started to ponder the EVIL things that could be done with this such as printer Spam. It also kind of reminded me of the nasty black fax DoS concept/trick where you tape a few sheets of black paper together to continuously feed into a fax machine and send it to a recipient with the intention of draining all the toner out of the receiving fax machine. The following image came to mind immediately:

With that thought in mind I initially created a simple Perl script to scan for printers listening on port 9001 and then also send data to any printers discovered. My first iteration of the script allowed for files to be read in and then sent to the printer in either binary format or text format, but then I kind of backed off on releasing that for obvious script kiddie reasons. Could you imagine a skiddie that could easily just read something like /dev/sda or /dev/random into a script to send it to a network printer. Obviously anyone with a little Perl knowledge could add that functionality back in and/or extend the script, but I can sleep well at night knowing I didn’t include it. My silly and simple script only allows you to send a command line passed argument message to the printer, which could be utilized in a nasty manner but it is a little more limiting than just allowing binary data to be piped into the printer listening port. If your interested you can get a copy of the script here: printerScanner.pl. It is nothing real special other than you can use it to scan a network range of printers listening on port 9001 and then if you choose to do so send a simple text based message to the printer to see if it supports RAW input for printing.
After writing this script and the first section of this blog post I did a Google search to see if anyone else had talked and/or had written about this silly network printer scenario and without disappointment I found that Adrian “Irongeek” Crenshaw had a much better write up on this and so much more here: Hacking Network Printers. The funny realization I had in regards to all this is that Adrian documented this 4+ years ago, and I just ran into it yesterday. I have no issues in admitting that I was not aware of this simple RAW input method for network printers, as it confirms my thoughts on situations like this where you can feel as if you have a really good fundamental understanding of a topic area, but there is always room to learn something new or in this case something old. Also after reading through Adrian’s write up I decided to see if I could come up with a Google dork for the Brother network printer I was testing this with on my network and low and behold here it is: inurl:”printer/main.html”. It still shocks me how many times devices like network printers are made available to the public either via a system administrators misconfiguration or a network engineer not taking security into account during his or her implementation with things such as Access Control Lists.
Posted in Miscellaneous, Scripts, Tools | 1 Comment »













