cuckoosandbox / cuckoo

Cuckoo Sandbox is an automated dynamic malware analysis system
http://www.cuckoosandbox.org
Other
5.55k stars 1.71k forks source link

Can i disable the API Authorization: Bearer <token> to pass in header??? #3063

Open adam44-44 opened 4 years ago

adam44-44 commented 4 years ago

Thanks for creating an issue! But first: did you read our community guidelines? https://cuckoo.sh/docs/introduction/community.html

My issue is: I am Running cuckoo API server on https://x.x.x.x over Nginx. I am getting this { "message": "Authentication in the form of an 'Authorization: Bearer ' header is required" } . Through Postman it is working fine. But i have to integrate it with other tool which does not support Api_token. so please help how can i disable the API Authorization in cuckoo.
My Cuckoo version and operating system are: Cuckoo Sandbox 2.0.7 on Ubuntu 16.04.
This can be reproduced by:
The log, error, files etc can be found at:

Getting this message while browsing to API server at https://x.x.x.x { "message": "Authentication in the form of an 'Authorization: Bearer ' header is required" }

please help!!!!

nadir3392 commented 4 years ago

there are two medothe: Secure et no Secure, the first one is to make the same value of api_token in (.cuckoo/conf/cuckoo.cofig ) and the call file (or in the command line), the second methode it's very essay : dellete the value api_token in .cuckoo/conf/cuckoo.cofig and in the command call. thank's

rleal124 commented 3 years ago

Hi, Same issue, I also try disable the api_token. And I still got same behavior. Any ideia how can solve?

salijona commented 3 years ago

Hi,

I am having the same problem as @rleal124. The message persists in both cases, when I set a api_token and when I delete that line from cuckoo.conf file. Has anyone found a solution to this ?

rleal124 commented 3 years ago

Check if have more than 2 cuckoo API instances running at same time?

salijona commented 3 years ago

@rleal124 I did a fresh installation of cuckoo to make sure everything is clear. After that I did the following steps:

The request failed even though there was only one instance of the API. I tried as well to send the request via python and requests module for python but the same message persist. I am running out of ideas how to trubelshoot at this point.

If you can share some steps that helped you solve this problem, it would be helpful to me.

rleal124 commented 3 years ago

curl -H "Authorization: Bearer SIMPLE" -F file=path_to_my_file http://localhost:8090/tasks/create/file change to curl -H "Authorization: Bearer MY TOKEN" -F file=path_to_my_file http://localhost:8090/tasks/create/file

salijona commented 3 years ago

@rleal124 Sorry that was just a typo. I had already changed it when I sent the request, but it did not work. I will edit my previous comment

rleal124 commented 3 years ago

please give me output ps -aux | grep cuckoo

salijona commented 3 years ago
 Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
      87       6      920        600       0.03   7040   1 cuckoo
      87       6      932        612       0.02   7340   1 cuckoo

I see there are 2 processes running

rleal124 commented 3 years ago

cuckoo -d api -H CUCKOO IP -p 8090

please read the folwing documentaion: https://cuckoo.readthedocs.io/en/latest/usage/api/#

Also you can have one cockoo instance runing

salijona commented 3 years ago

I checked and both processes are attached to the same cuckoo instance. I tried starting the api with your command, but it did not change the result of curl request. I guess I have to dig a bit longer on this issue.

rleal124 commented 3 years ago

please give me output ps -aux | grep cuckoo

salijona commented 3 years ago

I am using Windows so I am attaching the output of the alternative command to ps -aux | grep cuckoo. Below as well are details for each process separately

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
91       6      916       4048       0.03  22696   2 cuckoo
 87       6      916       4044       0.03  24120   2 cuckoo

The output of Get-Process -ID 22696 | Select-Object *

.... Name : cuckoo Id : 22696 PriorityClass : Normal TotalProcessorTime : 00:00:00.0312500 SI : 2 Handles : 91 Path : C:\Users...\Anaconda3\envs\cuckoo-env\Scripts\cuckoo.exe CPU : 0.03125 __NounName : Process HasExited : False Handle : 3204 Modules : {System.Diagnostics.ProcessModule (cuckoo.exe), ProcessName : cuckoo ProcessorAffinity : 255 Responding : True SessionId : 2 StartTime : 1/8/2021 6:00:50 PM Threads : {23800}

The output of Get-Process -ID 24120 | Select-Object *:

Name : cuckoo Id : 24120 PriorityClass : Normal TotalProcessorTime : 00:00:00.0312500 SI : 2 Handles : 87 Path : C:\Users...\Anaconda3\envs\cuckoo-env\Scripts\cuckoo.exe CPU : 0.03125 __NounName : Process BasePriority : 8 HasExited : False Handle : 2884 SafeHandle : Microsoft.Win32.SafeHandles.SafeProcessHandle MainModule : System.Diagnostics.ProcessModule (cuckoo.exe) MaxWorkingSet : 1413120 MinWorkingSet : 204800 Modules : {System.Diagnostics.ProcessModule (cuckoo.exe), PrivilegedProcessorTime : 00:00:00.0312500 ProcessName : cuckoo Responding : True SessionId : 2 StartInfo : System.Diagnostics.ProcessStartInfo StartTime : 1/8/2021 6:00:45 PM Threads : {12112}

rleal124 commented 3 years ago

from i can see the cuckoo api not running

salijona commented 3 years ago

2021-01-08 18:34:06,697 [werkzeug] WARNING: Debugger is active! 2021-01-08 18:34:06,706 [werkzeug] INFO: Debugger PIN: 593-688-948 2021-01-08 18:34:06,714 [werkzeug] INFO: * Running on http://127.0.0.1:8090/ (Press CTRL+C to quit) 2021-01-08 18:38:09,342 [werkzeug] INFO: 127.0.0.1 - - [08/Jan/2021 18:38:09] "GET / HTTP/1.1" 401

From the terminal where I run the api I get this output, so I guess it is running. Every time the curl request fails as well in the terminal I get the 401 error

rleal124 commented 3 years ago

on my Ubuntu terminal simple way. On terminal I run cuckoo -d (this will start the cuckoo webgui)

On second terminal cuckoo -d api -H CUCKOO IP -p 8090 (this will start the restapi)