18. Enumeration - IPMI (623 UDP)

https://www.thomas-krenn.com/en/wiki/IPMI_Basics

Set of standardized specs for hardware-based host mgmt systems used for sysmgmt and monitoring. Autonomous subsystem working independently of the hosts BIOS, CPU, firmware and underlying OS. IPMI provides sysadmins with the ability to monitor even if sys is powered off / unresponsive. Direct network connection to system hardware. Does not require access to OS via shell. Possible to remotely upgrade systems without physical access

Typical usage:

  1. Before OS has booted to modify BIOS
  2. When host is fully powered down
  3. Access to host after system failure.

Outside of these:

  1. Monitor range of different system settings:
    1. Sys temperature
    2. Voltage
    3. Fan status
    4. Power supply
    5. Querying inventory information
    6. Reviewing hardware logs
    7. Alerting, using SNMP

First published by intel in '98 now supported by over 200 system vendors. IPMI 2.0 can be administered via serial over LAN giving sysadmins the ability to view serial console output in band. Requires:

  1. Baseboard mgmt controller (BMC) - Microcontroller, essential
  2. Intelligent chassis management bus (ICMB) - Device permitting comms from one chassis to another
  3. Intelligent platform mgmt bus (IPMB) Extends BMC
  4. IPMI memory - Stores sys event log, repo store data
  5. Communications interfaces - Local system interfaces, serial and lan, icmb and pci management bus

IPMI communicates over port 623 UDP. BMCs typically implemented as embedded ARM systems running Linux connected directly to host mobo. BMCs built into many mobos but also added to system as a pci card. Most servers come with a bmc or support adding. Common:

  1. HP iLO,
  2. Dell DRAC,
  3. Supermicro IPMI

If we can access BMC during assessment, we gain full access to the host motherboard and can monitor, reboot, power off, or even reinstall host OS.

**Nearly equivalent to full physical access to a system.

Many BMCs (including common ones above) expose a web-based mgmt console, some sort of cmd-line remote access protocol (Telnet, ssh) and port 623 UDP.

 sudo nmap -sU --script ipmi-version -p 623 ilo.inlanfreight.local

Here, we can see that the IPMI protocol is indeed listening on port 623, and Nmap has fingerprinted version 2.0 of the protocol. We can also use the Metasploit scanner module IPMI Information Discovery (auxiliary/scanner/ipmi/ipmi_version).

During internal penetration tests, we often find BMCs where the administrators have not changed the default password. Some unique default passwords to keep in our cheatsheets include:

Product Username Password
Dell iDRAC root calvin
HP iLO Administrator randomized 8-character string consisting of numbers and uppercase letters
Supermicro IPMI ADMIN ADMIN

Dangerous Settings

If default credentials do not work to access a BMC, we can turn to a flaw in the RAKP protocol in IPMI 2.0. During the authentication process, the server sends a salted SHA1 or MD5 hash of the user's password to the client before authentication takes place. This can be leveraged to obtain the password hash for ANY valid user account on the BMC. These password hashes can then be cracked offline using a dictionary attack using Hashcat mode 7300.

In the event of an HP iLO using a factory default password, we can use this Hashcat mask attack command hashcat -m 7300 ipmi.txt -a 3 ?1?1?1?1?1?1?1?1 -1 ?d?u which tries all combinations of upper case letters and numbers for an eight-character password.

There is no direct 'fix' to this issue because the flaw is a critical component of the IPMI specification.

To retrieve IPMI hashes, we can use the Metasploit IPMI 2.0 RAKP Remote SHA1 Password Hash Retrieval module.

msf6 > use auxiliary/scanner/ipmi/ipmi_dumphashes 
msf6 auxiliary(scanner/ipmi/ipmi_dumphashes) > set rhosts 10.129.42.195
msf6 auxiliary(scanner/ipmi/ipmi_dumphashes) > show options