During the audit of a device , sometimes we look for the complicated way to it but I have seen many time that this kind of systems are vulnerable to simple OS command injection flaws in their administration services or sometimes it is possible to upload a binary using TFTP to an arbitrary directory. Either way it is always recommended to spend some time checking for these kind of vulnerabilities.



A quick port scan, reveals a number of exposed services which is good , since our chances to find flaws are more likely.



Host is up (0.021s latency).

Not shown: 992 closed ports

PORT STATE SERVICE

21/tcp open ftp

79/tcp open finger

80/tcp open http

515/tcp open printer

631/tcp open ipp

9000/tcp open net-config

9100/tcp open jetdirect

10000/tcp open lexdebug



This Lexmark print server has a number of administration services, three to be exact. One of those is located in the 10000/TCP, which has a hand full of commands which can be useful during the recon phase.





Escape character is '^]'.

LXK: ls

?

enable

exit

help

history

info

finger

lookup

ls

netstat

setup



LXK: netstat





Netstat

Type Local IP Port Remote IP Port State Out Q In Q

------------------------------------------------------------------------------

tcp 0.0.0.0 515 0.0.0.0 0 Listen 0 0

tcp 0.0.0.0 9000 0.0.0.0 0 Listen 0 0

tcp 0.0.0.0 9100 0.0.0.0 0 Listen 0 0

tcp 0.0.0.0 79 0.0.0.0 0 Listen 0 0

tcp 0.0.0.0 80 0.0.0.0 0 Listen 0 0

tcp 0.0.0.0 10000 0.0.0.0 0 Listen 0 0

tcp 0.0.0.0 21 0.0.0.0 0 Listen 0 0

tcp 0.0.0.0 631 0.0.0.0 0 Listen 0 0

tcp 192.168.1.25 10000 192.168.1.20 57069 Established 0 0

udp 0.0.0.0 161 0.0.0.0 0 0 0

udp 0.0.0.0 38184 0.0.0.0 0 0 0

udp 0.0.0.0 69 0.0.0.0 0 0 0

udp 0.0.0.0 5353 0.0.0.0 0 0 0





If we autenticate ourselves using the enable command a couple of new options are given, one of them is the familiar ps:





LXK: ps

USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND

root 1 0.0 1.9 356 136 ? S 00:00 0:00 init

root 2 0.0 0.0 0 0 ? SW 00:00 0:00 (khubd)

root 3 0.0 0.0 0 0 ? SW 00:00 0:00 (svcerrd)

root 4 0.0 0.0 0 0 ? SW 00:00 0:00 (kswapd)

root 5 0.0 0.0 0 0 ? SW 00:00 0:00 (kflushd)

root 6 0.0 0.0 0 0 ? SW 00:00 0:00 (kupdate)

root 7 0.0 0.0 0 0 ? SW 00:00 0:00 (khubd)

root 27 0.0 1.5 368 108 ? S 00:00 0:00 /bin/dbprint -in -id

root 30 5.7 2.3 408 164 ? S 00:00 0:11 /bin/Nvram -e -c

root 32 0.0 1.1 356 80 ? S 00:00 0:00 ./flashmon

root 40 0.0 2.2 392 156 ? S 00:00 0:00 ./lexutils -d

root 41 0.0 1.5 432 108 ? S 00:00 0:00 flashsrv

root 47 0.1 3.2 520 228 ? S 00:00 0:00 NVRamServer

root 48 0.0 3.3 440 232 ? S 00:00 0:00 ErrorExit

root 54 0.0 3.2 448 228 ? S 00:00 0:00 StringsServer

root 55 0.1 4.3 564 304 ? S 00:00 0:00 VacuumServer

root 57 0.0 4.3 564 304 ? S 00:00 0:00 VAC_Slave_56

root 58 0.0 4.3 564 304 ? S 00:00 0:00 VAC_Slave_56

root 61 0.0 4.8 624 340 ? S 00:00 0:00 StatusServer

root 62 0.0 4.8 624 340 ? S 00:00 0:00 \_ VAC_Slave_61

root 63 0.0 4.8 624 340 ? S 00:00 0:00 \_ VAC_Slave_61

root 64 0.0 4.8 624 340 ? S 00:00 0:00 \_ VAC_Slave_61

root 65 0.0 4.8 624 340 ? S 00:00 0:00 \_ VAC_Slave_61

root 67 0.0 4.8 624 340 ? S 00:00 0:00 \_ SA_Slave_61

root 68 0.0 4.8 624 340 ? S 00:00 0:00 SA_Slave_66

root 70 0.0 2.7 444 196 ? S 00:00 0:00 enaid

root 74 0.0 2.7 444 196 ? S 00:00 0:00 \_ SA_Slave_70

root 76 0.0 4.4 508 312 ? S 00:00 0:00 NPAP_Server

root 80 0.0 4.4 508 312 ? S 00:00 0:00 \_ NPAP_DSA

root 81 0.0 4.4 508 312 ? S 00:00 0:00 \_ NPAP_Upd_Config

root 82 0.0 4.4 508 312 ? S 00:00 0:00 \_ NPAP_Reverse

root 84 0.0 4.4 508 312 ? S 00:00 0:00 | \_ NPAP_Slave_82

root 85 0.0 4.4 508 312 ? S 00:00 0:00 \_ NPAP_Internal

root 86 0.0 4.4 508 312 ? S 00:00 0:00 \_ SA_Slave_76

root 77 0.0 3.9 544 276 ? S 00:00 0:00 NPA_Port_MUX

root 78 0.0 3.9 544 276 ? S 00:00 0:00 \_ VAC_Slave_77

root 79 0.0 3.9 544 276 ? S 00:00 0:00 \_ SA_Slave_77

root 87 0.0 4.3 588 304 ? S 00:00 0:00 SA_Slave_83

root 107 0.0 4.3 588 304 ? S 00:00 0:00 VAC_Slave_83

root 108 0.0 4.3 588 304 ? S 00:00 0:00 VAC_Slave_83

root 116 0.0 2.3 428 168 ? S 00:00 0:00 LinkMonitor 0

root 117 0.0 3.8 488 272 ? S 00:00 0:00 Hbn

root 118 0.0 3.8 488 272 ? S 00:00 0:00 \_ SA_Slave_117

root 166 0.0 3.8 488 272 ? S 00:00 0:00 \_ VAC_Slave_117

root 121 0.0 3.0 444 212 ? S 00:00 0:00 addrconf

root 122 0.0 3.0 444 212 ? S 00:00 0:00 \_ SA_Slave_121

root 124 0.0 2.7 436 192 ? S 00:00 0:00 SA_Slave_123

root 130 0.0 3.0 452 216 ? S 00:00 0:00 wins

root 134 0.0 3.0 452 216 ? S 00:00 0:00 \_ SA_Slave_130

root 132 0.0 2.6 368 188 ? S 00:00 0:00 inetd

root 172 0.0 3.0 456 212 ? S 00:02 0:00 \_ lexdebug

root 176 0.0 3.9 412 280 ? R 00:03 0:00 \_ ps auxf

root 139 0.0 2.7 432 196 ? S 00:00 0:00 Ntp

root 140 0.0 5.0 756 356 ? S 00:00 0:00 snmpd

root 167 0.0 5.0 756 356 ? S 00:00 0:00 \_ VAC_Slave_140

root 169 0.0 5.0 756 356 ? S 00:00 0:00 \_ NPAP_Slave_140

root 170 0.0 5.0 756 356 ? S 00:00 0:00 \_ SA_Slave_140

root 141 0.0 3.7 696 260 ? S 00:00 0:00 http

root 156 0.0 3.2 436 228 ? S 00:00 0:00 tftp

root 157 0.0 3.5 440 252 ? S 00:00 0:00 host-config

root 158 0.0 4.2 476 300 ? S 00:00 0:00 ZeroConfig

root 159 0.0 4.2 476 300 ? S 00:00 0:00 \_ SA_Slave_158



As you can see, it definitely looks like a Linux system. Another hint is that all the services are running as root because if we find a vulnerability in any of these services we won't have to do any privilege escalation.

After reviewing all the services we still haven't found any flaw that would allow us to execute commands in the system but we found some things that can be useful in your next Penetration Test.



Lexmark's kinky secrets





On the port 79/TCP we have to access the good old finger service, normally used to check which users are logged in a UNIX system but Lexmark decided to use it as a status service of the back end printer, but there was more behind that.

The finger service when requested replies:









































Nothing interesting. I tried a couple of usernames, so I used the common ones and between them there

Escape character is '^]'.

setup





Ethernet 10/100





Network Card

Status: Connected

Speed, Duplex: 100 Mbps, Full Duplex (Auto)

Current Date and Time: 1971-02-01 07:01

End-of-Job Timeout: 90

$ for i in `ls /usr/sbin`; do echo $i | nc 192.168.1.25 79; done





USB port 1

Printer Type: Epson Stylus T25

Print Job Status: No Job Currently Active

Printer Status: 0 Ready





USB port 1

Printer Type: Epson Stylus T25

Print Job Status: No Job Currently Active

Printer Status: 0 Ready

USB port 1

Printer Type: Epson Stylus T25

Print Job Status: No Job Currently Active

Printer Status: 0 Ready





NVRAM Dump:





NVRAM Info:

Sector Count: 192

Sector Size: 128

Bad Sectors: 0

Used Sectors: 35

Free Sectors: 157

Page Count: 3

Page Size: 8192

Page 0 Cycles: 0

Page 1 Cycles: 0

Page 2 Cycles: 0





Block ID: 0x01 Sub ID: 0x01 Size 152

0x00000000: 00 00 00 03 00 5A 00 00 00 00 5A 11 12 6A 5B 63 :.....Z....Z..j[c:

0x00000010: 54 18 00 0E 45 73 74 65 62 61 6E 20 51 75 69 74 :T...Esteban Quit:

0x00000020: 6F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :o...............:

0x00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :................:

0x00000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :................:

0x00000050: 00 00 00 00 0C 4F 66 69 63 69 6E 61 20 36 36 36 :.....Oficina 666:

0x00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :................:

0x00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :................:

0x00000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :................:

0x00000090: 00 00 00 00 00 00 04 00 :........ :





SNMP Community leak

Lexmark n4000e

an

Lexmark Optra MFP

Lexmark decided to make our devices full of undocumented features, specially for debugging and troubleshooting.was the user[...]So this service supports commands? We decided to check a little bit more as you may know: "Suddenly something appears...[...]So what's the nasty part? The dump of the NVRAM includes theused in the device and there is no way to password protect or disable this service.There are a couple of commands supported in this service, after a little bit of googling someone has published some other commands, if you are interested you can check this post . If we had access to this binary we might be able to discover other undocumented commands.The web administration panel has also some "" for us. If we set our browser to thedirectory a engineering menu is shown, there is no way to password protect it either. The amount of commands depends on the printer version.An attacker could take advantage of this information, the SNMP community leak also works using this panel. If we check the same directory inexpensive printer there are a lot of debugging logs that may include usernames and if it is used as a fax machine, the callers are also shown.