dirkjanm / ROADtools

A collection of Azure AD/Entra tools for offensive and defensive security purposes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RoadRecon - TypeError: 'NoneType' object is not subscriptable

barneyOSCP10101 opened this issue · comments

Hello

I installed roadtools in UBUNTU 22.04 and KALI and I am getting this error when I execute roadrecon auth -u -p

Hoping for your guidance in getting this resolved.

Thanks


Traceback (most recent call last):
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/roadtools/roadlib/auth.py", line 1188, in get_tokens
return self.authenticate_username_password()
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/roadtools/roadlib/auth.py", line 193, in authenticate_username_password
self.tokendata = context.acquire_token_with_username_password(self.resource_uri, self.username, self.password, self.client_id)
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/adal/authentication_context.py", line 164, in acquire_token_with_username_password
return self._acquire_token(token_func)
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/adal/authentication_context.py", line 128, in _acquire_token
return token_func(self)
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/adal/authentication_context.py", line 162, in token_func
return token_request.get_token_with_username_password(username, password)
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/adal/token_request.py", line 285, in get_token_with_username_password
token = self._get_token_username_password_federated(username, password)
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/adal/token_request.py", line 256, in _get_token_username_password_federated
return self._perform_username_password_for_access_token_exchange(wstrust_endpoint, wstrust_version,
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/adal/token_request.py", line 209, in _perform_username_password_for_access_token_exchange
wstrust_response = self._perform_wstrust_exchange(wstrust_endpoint, wstrust_endpoint_version, cloud_audience_urn,
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/adal/token_request.py", line 197, in _perform_wstrust_exchange
result = wstrust.acquire_token(username, password)
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/adal/wstrust_request.py", line 169, in acquire_token
return self._handle_rstr(resp.text)
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/adal/wstrust_request.py", line 126, in _handle_rstr
wstrust_resp.parse()
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/adal/wstrust_response.py", line 238, in parse
raise AdalError(error_template.format(str_error_code, str_fault_message))
adal.adal_error.AdalError: Server returned error in RSTR - ErrorCode: FailedAuthentication : FaultMessage: Authentication failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/########/roadtools/roadtools_venv/bin/roadrecon", line 8, in
sys.exit(main())
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/roadtools/roadrecon/main.py", line 108, in main
res = auth.get_tokens(args)
File "/home/########/roadtools/roadtools_venv/lib/python3.10/site-packages/roadtools/roadlib/auth.py", line 1231, in get_tokens
print(ex.error_response['error_description'])
TypeError: 'NoneType' object is not subscriptable

Hey, this is a valid bug, however the issue that triggers this is that the federation server is throwing an error message when you authenticate, so even if I fix the bug (which is in printing the error message), it would still fail.

As a workaround, I suggest you try authenticating with roadtx interactiveauth from the roadtx tool. Make sure to update the selenium package as well when you run this on Kali, and make sure you are not running as root, that gives issues with selenium.

Thank you. It looks like its throwing the same error. Does this mean that the federation server is not processing the authentication?


Requesting token for resource msteams
Traceback (most recent call last):
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/roadtools/roadlib/auth.py", line 1188, in get_tokens
return self.authenticate_username_password()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/roadtools/roadlib/auth.py", line 193, in authenticate_username_password
self.tokendata = context.acquire_token_with_username_password(self.resource_uri, self.username, self.password, self.client_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/adal/authentication_context.py", line 164, in acquire_token_with_username_password
return self._acquire_token(token_func)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/adal/authentication_context.py", line 128, in _acquire_token
return token_func(self)
^^^^^^^^^^^^^^^^
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/adal/authentication_context.py", line 162, in token_func
return token_request.get_token_with_username_password(username, password)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/adal/token_request.py", line 285, in get_token_with_username_password
token = self._get_token_username_password_federated(username, password)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/adal/token_request.py", line 256, in _get_token_username_password_federated
return self._perform_username_password_for_access_token_exchange(wstrust_endpoint, wstrust_version,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/adal/token_request.py", line 209, in _perform_username_password_for_access_token_exchange
wstrust_response = self._perform_wstrust_exchange(wstrust_endpoint, wstrust_endpoint_version, cloud_audience_urn,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/adal/token_request.py", line 197, in _perform_wstrust_exchange
result = wstrust.acquire_token(username, password)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/adal/wstrust_request.py", line 169, in acquire_token
return self._handle_rstr(resp.text)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/adal/wstrust_request.py", line 126, in _handle_rstr
wstrust_resp.parse()
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/adal/wstrust_response.py", line 238, in parse
raise AdalError(error_template.format(str_error_code, str_fault_message))
adal.adal_error.AdalError: Server returned error in RSTR - ErrorCode: FailedAuthentication : FaultMessage: Authentication failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/bin/roadtx", line 8, in
sys.exit(main())
^^^^^^
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/roadtools/roadtx/main.py", line 526, in main
res = auth.get_tokens(args)
^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/.local/share/virtualenvs/kali-_cbpxKIc/lib/python3.11/site-packages/roadtools/roadlib/auth.py", line 1231, in get_tokens
print(ex.error_response['error_description'])
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

This doesn't look like the output from roadtx interactiveauth though.