mpast / mobileAudit

Django application that performs SAST and Malware Analysis for Android APKs
https://owasp.org/www-project-mobile-audit/
GNU General Public License v3.0
206 stars 43 forks source link

Internal Server Error when Uploading APK #105

Open f0xp1t opened 12 months ago

f0xp1t commented 12 months ago

Hi ,

Having an error loading the APK File , on the frontend shows Server error:

image

Below the log of the issue. thanks.

web_1 | [ERROR] 14/Dec/2023 14:35:19 - Internal Server Error: /scan/create/1 web_1 | Traceback (most recent call last): web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/utils/functional.py", line 32, in call web_1 | return self.value web_1 | AttributeError: 'ChannelPromise' object has no attribute 'value' web_1 | web_1 | During handling of the above exception, another exception occurred: web_1 | web_1 | Traceback (most recent call last): web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 472, in _reraise_as_library_errors web_1 | yield web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 459, in _ensure_connection web_1 | return retry_over_time( web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/utils/functional.py", line 318, in retry_over_time web_1 | return fun(*args, kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 934, in _connection_factory web_1 | self._connection = self._establish_connection() web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 860, in _establish_connection web_1 | conn = self.transport.establish_connection() web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/transport/pyamqp.py", line 203, in establish_connection web_1 | conn.connect() web_1 | File "/usr/local/lib/python3.9/site-packages/amqp/connection.py", line 324, in connect web_1 | self.transport.connect() web_1 | File "/usr/local/lib/python3.9/site-packages/amqp/transport.py", line 129, in connect web_1 | self._connect(self.host, self.port, self.connect_timeout) web_1 | File "/usr/local/lib/python3.9/site-packages/amqp/transport.py", line 172, in _connect web_1 | entries = socket.getaddrinfo( web_1 | File "/usr/local/lib/python3.9/socket.py", line 954, in getaddrinfo web_1 | for res in _socket.getaddrinfo(host, port, family, type, proto, flags): web_1 | socket.gaierror: [Errno -2] Name or service not known web_1 | web_1 | The above exception was the direct cause of the following exception: web_1 | web_1 | Traceback (most recent call last): web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner web_1 | response = get_response(request) web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response web_1 | response = wrapped_callback(request, *callback_args, *callback_kwargs) web_1 | File "/usr/local/lib/python3.9/contextlib.py", line 79, in inner web_1 | return func(args, kwds) web_1 | File "/usr/local/lib/python3.9/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view web_1 | return view_func(request, args, kwargs) web_1 | File "/app/./app/views.py", line 182, in create_scan web_1 | task_id = task_create_scan.delay(scan.id) web_1 | File "/usr/local/lib/python3.9/site-packages/celery/app/task.py", line 425, in delay web_1 | return self.apply_async(args, kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/celery/app/task.py", line 575, in apply_async web_1 | return app.send_task( web_1 | File "/usr/local/lib/python3.9/site-packages/celery/app/base.py", line 788, in send_task web_1 | amqp.send_task_message(P, name, message, options) web_1 | File "/usr/local/lib/python3.9/site-packages/celery/app/amqp.py", line 510, in send_task_message web_1 | ret = producer.publish( web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/messaging.py", line 186, in publish web_1 | return _publish( web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 556, in _ensured web_1 | return fun(args, kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/messaging.py", line 195, in _publish web_1 | channel = self.channel web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/messaging.py", line 218, in _get_channel web_1 | channel = self._channel = channel() web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/utils/functional.py", line 34, in call web_1 | value = self.value = self.contract() web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/messaging.py", line 234, in web_1 | channel = ChannelPromise(lambda: connection.default_channel) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 953, in default_channel web_1 | self._ensure_connection(conn_opts) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 459, in _ensure_connection web_1 | return retry_over_time( web_1 | File "/usr/local/lib/python3.9/contextlib.py", line 137, in exit web_1 | self.gen.throw(typ, value, traceback) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 476, in _reraise_as_library_errors web_1 | raise ConnectionError(str(exc)) from exc web_1 | kombu.exceptions.OperationalError: [Errno -2] Name or service not known web_1 | [pid: 11|app: 0|req: 15/18] 172.21.0.3 () {54 vars in 1057 bytes} [Thu Dec 14 14:35:12 2023] POST /scan/create/1 => generated 145 bytes in 7119 msecs (HTTP/1.0 500) 7 headers in 217 bytes (1 switches on core 0)

mpast commented 12 months ago

Hi @f0xp1t Thanks for your report, unfortuntely, I am not able to reproduce, I've fixed a bug when deploying one of the permissions for kali linux #106 , maybe try docker compose down and docker compose build & docker compose up to see if it could be related If that does not help, can you provide info about kali version and host machine? Thanks

mpast commented 11 months ago

Hi @f0xp1t , To add to my previous comment, it seems that probably the server can't reach the rabbitmq queue, maybe because of these permissions that I mentioned that I fixed in the latest commit, Can you verify and if does not work, send full logs to verify if the rabbitmq worker is working or not? Thanks

f0xp1t commented 11 months ago

Hi @mpast ,

Distributor ID: Kali Description: Kali GNU/Linux Rolling Release: 2023.3 Codename: kali-rolling

Tried rebuilding it , removing the folder and as well pulling the github folder again and rebuilding it just in case . still getting the 500 error while uploading the apk , with regards the mrabbit , you are correct , below the excerpt of the log:

rabbitmq_1 | {"Kernel pid terminated",application_controller,"{application_start_failure,rabbit,{{cannot_log_to_file,\"/var/log/rabbitmq/rabbit@6fdd07c9f863_upgrade.log\",eacces},{rabbit,start,[normal,[]]}}}"} rabbitmq_1 | Kernel pid terminated (application_controller) ({application_start_failure,rabbit,{{cannot_log_to_file,"/var/log/rabbitmq/rabbit@6fdd07c9f863_upgrade.log",eacces},{rabbit,start,[normal,[]]}}}) rabbitmq_1 | rabbitmq_1 | Crash dump is being written to: /var/log/rabbitmq/erl_crash.dump...mobileaudit_rabbitmq_1 exited with code 0 worker_1 | [2023-12-19 14:50:11,846: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:@rabbitmq:5672//: [Errno -2] Name or service not known. worker_1 | Trying again in 6.00 seconds... (3/100) worker_1 | worker_1 | [2023-12-19 14:50:20,088: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:@rabbitmq:5672//: [Errno -2] Name or service not known. worker_1 | Trying again in 8.00 seconds... (4/100) worker_1 | web_1 | [pid: 13|app: 0|req: 1/1] 172.19.0.4 () {46 vars in 834 bytes} [Tue Dec 19 14:50:27 2023] GET /scan/create/1 => generated 6833 bytes in 416 msecs (HTTP/1.0 200) 8 headers in 382 bytes (1 switches on core 0) worker_1 | [2023-12-19 14:50:30,438: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:@rabbitmq:5672//: [Errno -2] Name or service not known. worker_1 | Trying again in 10.00 seconds... (5/100) worker_1 | web_1 | [pid: 13|app: 0|req: 2/2] 172.19.0.4 () {48 vars in 900 bytes} [Tue Dec 19 14:50:36 2023] GET /accounts/profile/ => generated 6357 bytes in 20 msecs (HTTP/1.0 200) 8 headers in 382 bytes (1 switches on core 0) worker_1 | [2023-12-19 14:50:42,609: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:@rabbitmq:5672//: [Errno -2] Name or service not known. worker_1 | Trying again in 12.00 seconds... (6/100) worker_1 | worker_1 | [2023-12-19 14:50:56,776: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@rabbitmq:5672//: [Errno -2] Name or service not known. worker_1 | Trying again in 14.00 seconds... (7/100)

Below the full log: mobil_audit_log.txt

f0xp1t commented 11 months ago

Hi @mpast , hope you are doing well , any update on the previous information shared? Thanks.

mpast commented 10 months ago

Sorry, I have not been able to reproduce, could you make sure docker containers have been stopped, removed and there are not dangling, could you try these commands?

docker compose down
docker compose rm
docker compose build
docker compose up

thanks a lot

f0xp1t commented 10 months ago

ok , tried to rmi the built image and deleted all the containers related to this project and started from scratch... when uploading getting the following:

web_1 | [ERROR] 05/Feb/2024 22:51:39 - Internal Server Error: /scan/create/1 web_1 | Traceback (most recent call last): web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/utils/functional.py", line 32, in call web_1 | return self.value web_1 | AttributeError: 'ChannelPromise' object has no attribute 'value' web_1 | web_1 | During handling of the above exception, another exception occurred: web_1 | web_1 | Traceback (most recent call last): web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 472, in _reraise_as_library_errors web_1 | yield web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 459, in _ensure_connection web_1 | return retry_over_time( web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/utils/functional.py", line 318, in retry_over_time web_1 | return fun(*args, kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 934, in _connection_factory web_1 | self._connection = self._establish_connection() web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 860, in _establish_connection web_1 | conn = self.transport.establish_connection() web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/transport/pyamqp.py", line 203, in establish_connection web_1 | conn.connect() web_1 | File "/usr/local/lib/python3.9/site-packages/amqp/connection.py", line 324, in connect web_1 | self.transport.connect() web_1 | File "/usr/local/lib/python3.9/site-packages/amqp/transport.py", line 129, in connect web_1 | self._connect(self.host, self.port, self.connect_timeout) web_1 | File "/usr/local/lib/python3.9/site-packages/amqp/transport.py", line 172, in _connect web_1 | entries = socket.getaddrinfo( web_1 | File "/usr/local/lib/python3.9/socket.py", line 954, in getaddrinfo web_1 | for res in _socket.getaddrinfo(host, port, family, type, proto, flags): web_1 | socket.gaierror: [Errno -3] Temporary failure in name resolution web_1 | web_1 | The above exception was the direct cause of the following exception: web_1 | web_1 | Traceback (most recent call last): web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner web_1 | response = get_response(request) web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response web_1 | response = wrapped_callback(request, *callback_args, *callback_kwargs) web_1 | File "/usr/local/lib/python3.9/contextlib.py", line 79, in inner web_1 | return func(args, kwds) web_1 | File "/usr/local/lib/python3.9/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view web_1 | return view_func(request, args, kwargs) web_1 | File "/app/./app/views.py", line 182, in create_scan web_1 | task_id = task_create_scan.delay(scan.id) web_1 | File "/usr/local/lib/python3.9/site-packages/celery/app/task.py", line 425, in delay web_1 | return self.apply_async(args, kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/celery/app/task.py", line 575, in apply_async web_1 | return app.send_task( web_1 | File "/usr/local/lib/python3.9/site-packages/celery/app/base.py", line 788, in send_task web_1 | amqp.send_task_message(P, name, message, options) web_1 | File "/usr/local/lib/python3.9/site-packages/celery/app/amqp.py", line 510, in send_task_message web_1 | ret = producer.publish( web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/messaging.py", line 186, in publish web_1 | return _publish( web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 556, in _ensured web_1 | return fun(args, kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/messaging.py", line 195, in _publish web_1 | channel = self.channel web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/messaging.py", line 218, in _get_channel web_1 | channel = self._channel = channel() web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/utils/functional.py", line 34, in call web_1 | value = self.value = self.contract() web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/messaging.py", line 234, in web_1 | channel = ChannelPromise(lambda: connection.default_channel) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 953, in default_channel web_1 | self._ensure_connection(conn_opts) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 459, in _ensure_connection web_1 | return retry_over_time( web_1 | File "/usr/local/lib/python3.9/contextlib.py", line 137, in exit web_1 | self.gen.throw(typ, value, traceback) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 476, in _reraise_as_library_errors web_1 | raise ConnectionError(str(exc)) from exc web_1 | kombu.exceptions.OperationalError: [Errno -3] Temporary failure in name resolution web_1 | [pid: 13|app: 0|req: 20/33] 172.19.0.4 () {54 vars in 1058 bytes} [Mon Feb 5 22:51:35 2024] POST /scan/create/1 => generated 145 bytes in 4874 msecs (HTTP/1.0 500) 7 headers in 217 bytes (30 switches on core 0) web_1 | [ERROR] 05/Feb/2024 22:52:01 - Internal Server Error: /scan/create/1 web_1 | Traceback (most recent call last): web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/utils/functional.py", line 32, in call web_1 | return self.value web_1 | AttributeError: 'ChannelPromise' object has no attribute 'value' web_1 | web_1 | During handling of the above exception, another exception occurred: web_1 | web_1 | Traceback (most recent call last): web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 472, in _reraise_as_library_errors web_1 | yield web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 459, in _ensure_connection web_1 | return retry_over_time( web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/utils/functional.py", line 318, in retry_over_time web_1 | return fun(*args, kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 934, in _connection_factory web_1 | self._connection = self._establish_connection() web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 860, in _establish_connection web_1 | conn = self.transport.establish_connection() web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/transport/pyamqp.py", line 203, in establish_connection web_1 | conn.connect() web_1 | File "/usr/local/lib/python3.9/site-packages/amqp/connection.py", line 324, in connect web_1 | self.transport.connect() web_1 | File "/usr/local/lib/python3.9/site-packages/amqp/transport.py", line 129, in connect web_1 | self._connect(self.host, self.port, self.connect_timeout) web_1 | File "/usr/local/lib/python3.9/site-packages/amqp/transport.py", line 172, in _connect web_1 | entries = socket.getaddrinfo( web_1 | File "/usr/local/lib/python3.9/socket.py", line 954, in getaddrinfo web_1 | for res in _socket.getaddrinfo(host, port, family, type, proto, flags): web_1 | socket.gaierror: [Errno -3] Temporary failure in name resolution web_1 | web_1 | The above exception was the direct cause of the following exception: web_1 | web_1 | Traceback (most recent call last): web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner web_1 | response = get_response(request) web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response web_1 | response = wrapped_callback(request, *callback_args, *callback_kwargs) web_1 | File "/usr/local/lib/python3.9/contextlib.py", line 79, in inner web_1 | return func(args, kwds) web_1 | File "/usr/local/lib/python3.9/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view web_1 | return view_func(request, args, kwargs) web_1 | File "/app/./app/views.py", line 182, in create_scan web_1 | task_id = task_create_scan.delay(scan.id) web_1 | File "/usr/local/lib/python3.9/site-packages/celery/app/task.py", line 425, in delay web_1 | return self.apply_async(args, kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/celery/app/task.py", line 575, in apply_async web_1 | return app.send_task( web_1 | File "/usr/local/lib/python3.9/site-packages/celery/app/base.py", line 788, in send_task web_1 | amqp.send_task_message(P, name, message, options) web_1 | File "/usr/local/lib/python3.9/site-packages/celery/app/amqp.py", line 510, in send_task_message web_1 | ret = producer.publish( web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/messaging.py", line 186, in publish web_1 | return _publish( web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 556, in _ensured web_1 | return fun(args, kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/messaging.py", line 195, in _publish web_1 | channel = self.channel web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/messaging.py", line 218, in _get_channel web_1 | channel = self._channel = channel() web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/utils/functional.py", line 34, in call web_1 | value = self.value = self.contract() web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/messaging.py", line 234, in web_1 | channel = ChannelPromise(lambda: connection.default_channel) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 953, in default_channel web_1 | self._ensure_connection(conn_opts) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 459, in _ensure_connection web_1 | return retry_over_time( web_1 | File "/usr/local/lib/python3.9/contextlib.py", line 137, in exit web_1 | self.gen.throw(typ, value, traceback) web_1 | File "/usr/local/lib/python3.9/site-packages/kombu/connection.py", line 476, in _reraise_as_library_errors web_1 | raise ConnectionError(str(exc)) from exc web_1 | kombu.exceptions.OperationalError: [Errno -3] Temporary failure in name resolution web_1 | [pid: 13|app: 0|req: 21/34] 172.19.0.4 () {54 vars in 1058 bytes} [Mon Feb 5 22:51:56 2024] POST /scan/create/1 => generated 145 bytes in 4827 msecs (HTTP/1.0 500) 7 headers in 217 bytes (74 switches on core 0) worker_1 | [2024-02-05 22:52:05,615: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@rabbitmq:5672//: [Errno -3] Temporary failure in name resolution.

f0xp1t commented 10 months ago

keep getting this(Failure in name resolution) :

| File "/usr/local/lib/python3.9/socket.py", line 954, in getaddrinfo web_1 | for res in _socket.getaddrinfo(host, port, family, type, proto, flags): web_1 | socket.gaierror: [Errno -3] Temporary failure in name resolution . .

web_1 | raise ConnectionError(str(exc)) from exc web_1 | kombu.exceptions.OperationalError: [Errno -3] Temporary failure in name resolution