infobyte / faraday

Open Source Vulnerability Management Platform
https://www.faradaysec.com
GNU General Public License v3.0
4.87k stars 893 forks source link

Upload report error #497

Open prateekshetty-eox opened 2 months ago

prateekshetty-eox commented 2 months ago

Please search the Wiki for a solution before posting a ticket. Use the “New Support Request” button to the right of the screen to submit a ticket for technical support.

Issue Type

Faraday version

Paste the output of the ./faraday.py --version command

Component Name

If you know where the problem lays indicate it: WebGui/GTKGui/Plugin/Console/Continuous Scanning/Etc.

Steps to reproduce

Provide detailed steps on how the issue happened so we can try to reproduce it. If the issue is random, please provide as much information as possible.

I used $ wget https://raw.githubusercontent.com/infobyte/faraday/master/docker-compose.yaml $ docker-compose up to set it up

Used the docker compose up to install faraday and run it, so when i run it and i get logs, i get this when i call http://X.X.X.X:5985/_api/v3/token from postman: faraday_app | 2024-07-08T10:51:03+0000 - passlib.handlers.bcrypt - WARNING {Dummy-11} [pid:20] [bcrypt.py:622 - _load_backend_mixin()] (trapped) error reading bcrypt version faraday_app | Traceback (most recent call last): faraday_app | File "/usr/local/lib/python3.8/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin faraday_app | version = _bcrypt.about.version faraday_app | AttributeError: module 'bcrypt' has no attribute 'about' faraday_app | 2024-07-08T10:51:04+0000 - geventwebsocket.handler - INFO {Dummy-11} [pid:20] [handler.py:242 - log_request()] 106.51.64.181 - - [2024-07-08 10:51:04] "GET /_api/v3/token HTTP/1.1" 200 474 1.189582

and for http://X.X.X.X:5985/_api/v3/ws/Test/upload_report i get this: faraday_app | 2024-07-08T10:51:26+0000 - faraday.server.api.modules.upload_reports - INFO {Dummy-11} [pid:20] [upload_reports.py:70 - file_upload()] Importing new plugin report in server... faraday_app | 2024-07-08T10:51:27+0000 - geventwebsocket.handler - INFO {Dummy-11} [pid:20] [handler.py:242 - log_request()] 106.51.64.181 - - [2024-07-08 10:51:27] "POST /_api/v3/ws/Test/upload_report HTTP/1.1" 400 318 0.772049 no matter what authentication i try it doesnt work

in postman or terminal : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

400 Bad Request

Bad Request

The browser (or proxy) sent a request that this server could not understand.

When i try connecting using faraday-cli i keep getting connection refused error

OS

Provide information on your operating system. Example:

$ cat /etc/lsb-release cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=24.04 DISTRIB_CODENAME=noble DISTRIB_DESCRIPTION="Ubuntu 24.04 LTS"

ezk06eer commented 1 week ago

Hello, @prateekshetty-eox

Are you still having an issue here? it seems you are having a hard time trying to setup an environment, have you checked in our docs? Docs

if you fire up faraday using docker compose up, you should try to connect to 127.0.0.1:5985 and use latest vs latest both faraday and faraday-cli.

about the token and upload report there is an api specification in our docs, we use the openapi model for that and you could just simply upload a report to the endpoint, i think you can still use authentication basic in the headers, and also you can also find this example using curl:

cURL example:

curl 'https://xxx/_api/v3/ws/workspacename/upload_report' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: en-US,en;q=0.9,es;q=0.8' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundaryciJQBAtz2MWk25PX' \
  -H 'cookie: _gcl_au=xxx; _hjSessionUser_1808475=xxx==;' \
  -H 'origin: https://xxx.com' \
  -H 'priority: u=1, i' \
  -H 'referer: https://xxx/manage/workspacename' \
  -H 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-origin' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
  --data-raw $'------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name="file"; filename="filename.json"\r\nContent-Type: application/json\r\n\r\n\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name="ignore_info"\r\n\r\nfalse\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name="resolve_hostname"\r\n\r\nfalse\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name="csrf_token"\r\n\r\nIjFjNGFkZGYzZmY4MThiN2ZmZGI5YTJhMWIxZmVlY2M2ODZlMjRiODQi.ZtWraw._MSm23jGSkqc7_lOqoTZKOQmfYI\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX--\r\n'

fetch example

fetch("https://XXX/_api/v3/ws/workspacename/upload_report", {
  "headers": {
    "accept": "application/json, text/plain, */*",
    "accept-language": "en-US,en;q=0.9,es;q=0.8",
    "content-type": "multipart/form-data; boundary=----WebKitFormBoundaryciJQBAtz2MWk25PX",
    "priority": "u=1, i",
    "sec-ch-ua": "\"Chromium\";v=\"128\", \"Not;A=Brand\";v=\"24\", \"Google Chrome\";v=\"128\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"macOS\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin"
  },
  "referrer": "https://XXX/manage/workspacename",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name=\"file\"; filename=\"filename.json\"\r\nContent-Type: application/json\r\n\r\n\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name=\"ignore_info\"\r\n\r\nfalse\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name=\"resolve_hostname\"\r\n\r\nfalse\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name=\"csrf_token\"\r\n\r\nIjFjNGFkZGYzZmY4MThiN2ZmZGI5YTJhMWIxZmVlY2M2ODZlMjRiODQi.ZtWraw._MSm23jGSkqc7_lOqoTZKOQmfYI\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX--\r\n",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});