Skip to content
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

Use timed reads in the apache_activemq_rce_cve_2023_46604 check method #19139

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,17 @@ def initialize(info = {})
def check
connect

res = sock.get_once
len = sock.timed_read(4)&.unpack1('N')

return CheckCode::Unknown if len.nil? || len > 0x1000 # upper limit in case the service isn't ActiveMQ

res = sock.timed_read(len)

disconnect

return CheckCode::Unknown unless res

len, _, magic = res.unpack('NCZ*')

return CheckCode::Unknown unless res.length == len + 4
_, magic = res.unpack('CZ*')

return CheckCode::Unknown unless magic == 'ActiveMQ'

Expand All @@ -110,6 +112,8 @@ def check
end

Exploit::CheckCode::Safe("Apache ActiveMQ #{version}")
rescue ::Timeout::Error
CheckCode::Unknown
end

def exploit
Expand Down