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

detect unifi in ssh sessions #11558

Merged
merged 1 commit into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/metasploit/framework/login_scanner/ssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,18 @@ def gather_proof
proof = ssh_socket.exec!("id\n").to_s
if (proof =~ /id=/)
proof << ssh_socket.exec!("uname -a\n").to_s
if (proof =~/JUNOS /)
if (proof =~ /JUNOS /)
# We're in the SSH shell for a Juniper JunOS, we can pull the version from the cli
# line 2 is hostname, 3 is model, 4 is the Base OS version
proof = ssh_socket.exec!("cli show version\n").split("\n")[2..4].join(", ").to_s
end
proof << ssh_socket.exec!("grep unifi.version /tmp/system.cfg\n").to_s
if (proof =~ /unifi.version/)
# The /tmp/*.cfg files don't give us device info, however the info command does
# we dont call it originally since it doesnt say unifi/ubiquiti in it and info
# is a linux command as well
proof << ssh_socket.exec!("grep board.name /etc/board.info\n").to_s
end
else
# Cisco IOS
if proof =~ /Unknown command or computer name/
Expand Down Expand Up @@ -151,6 +158,8 @@ def set_sane_defaults

def get_platform(proof)
case proof
when /unifi\.version/ #Ubiquiti Unifi. uname -a is left in, so we got to pull before Linux
'unifi'
when /Linux/
'linux'
when /Darwin/
Expand Down
8 changes: 8 additions & 0 deletions lib/msf/core/module/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,14 @@ class Juniper < Msf::Module::Platform
Alias = "juniper"
end

#
# Ubiquiti Unifi
#
class Unifi < Msf::Module::Platform
Rank = 100
Alias = "unifi"
end

#
# Solaris
#
Expand Down
1 change: 1 addition & 0 deletions lib/msf/core/payload/uuid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Msf::Payload::UUID
24 => 'r',
25 => 'apple_ios',
26 => 'juniper',
27 => 'unifi',
}

# The raw length of the UUID structure
Expand Down