Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Cannot create Case Observable on TheHive4 despite manageObservable Permission #179

Closed
milesflo opened this issue Sep 14, 2020 · 1 comment

Comments

@milesflo
Copy link

milesflo commented Sep 14, 2020

Cannot create CaseObservable on TheHive4

Request Type

Bug

Work Environment

Question Answer
OS version (server) Docker thehiveproject/thehive4:latest
TheHive4py version pip version 1.6.0

Problem Description

An account with manageObservables permissions cannot actually create Observables.

Steps to Reproduce

  1. Create an account with manageObservable permissions
  2. Generate API token in Users tab
  3. Fill parameters into PoC script
  4. Observe output

Potential Solution

This same account can log into the site via password and SUCCESSFULLY create Observables, so it may be tied to how the API client authentication is defined and handled.

Complementary information

Screenshot:
image

PoC:

from thehive4py.api import TheHiveApi
from thehive4py.models import CaseObservable

url = "<url>"
token = "<token>"
organisation = "<organization>"

api = TheHiveApi(
    url,
    token,
    organisation=organisation,
    cert=False
)


user = (api.get_current_user()).json()

if user['status'] == 'Ok':

    print("Username:" + user['login'])
    print("Permissions: " +  str(user['roles']))

    observable = CaseObservable(
        data='john.doe',
        dataType='username',
        ioc=False,
        message='CEO of Widget Industries',
        sighted=False,
        tags=['sample'],
        tlp=2
    )

    res = api.create_case_observable(1, observable)

    print(f"{res.status_code} {res.reason}") # 403 Forbidden
    print(res.json())      # {'type': 'AuthorizationError', 'message': 'Operation not permitted'}
@milesflo milesflo changed the title [Bug] Cannot create Case Observable on TheHive4 despite manageObservable [Bug] Cannot create Case Observable on TheHive4 despite manageObservable Permission Sep 14, 2020
@milesflo
Copy link
Author

I discovered the error! I was incorrectly using caseId and id/_id interchangeably.

create_case_observable expects the id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant