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

[mwdb] OpenCTI connector flooding MWDB API with requests when /api/file retuns different HTTP response code than 200 #1555

Closed
psrok1 opened this issue Nov 21, 2023 · 1 comment · Fixed by #2285
Labels
feature use for describing a new feature to develop solved use to identify issue that has been solved (must be linked to the solving PR)
Milestone

Comments

@psrok1
Copy link
Contributor

psrok1 commented Nov 21, 2023

Description

I'm from CERT.pl and we're responsible for https://github.com/CERT-Polska/mwdb-core project and https://mwdb.cert.pl service that is used commonly by users of this connector.

Recently we noticed that we're flooded from time to time with infinite /api/file?query=... requests that possibly originate from connector distributed via this repository.

The issue is in this loop:

while files_to_import:
When resp.status is not 200, but 401, 429 or any other common error returned by our API: this loop goes into infinite loop without any delay.

Delay and proper error handling is expected when this condition is not fulfilled:

if resp.status_code == 200:

I also don't think that it's needed to reinvent the wheel and call MWDB API using requests while we have https://github.com/CERT-Polska/mwdblib Python binding. It also correctly handles any error conditions like rate limiting or missing authorization.

Additional information

Not provided, I'm owner of the API targeted by the connector, not an OpenCTI instance.

@msm-code
Copy link

msm-code commented Nov 21, 2023

When resp.status is not 200, but 401, 429 or any other common error returned by our API

I'll just add that 429 is used by mwdb server for rate limitting (to notify the client that they should slow down a bit).

Connector as implemented here not only ignores this status code, but it even makes the problem worse because it starts sending even more requests in an infinite loop. I think that's the most common reason for "DoS attacks" done by users of this connector on the mwdb service.

@SamuelHassine SamuelHassine added the feature use for describing a new feature to develop label Jan 8, 2024
@SamuelHassine SamuelHassine added filigran team use to identify PR from the Filigran team and removed filigran team use to identify PR from the Filigran team labels Apr 20, 2024
@SamuelHassine SamuelHassine added this to the Release 6.2.2 milestone Jul 6, 2024
@SamuelHassine SamuelHassine added the solved use to identify issue that has been solved (must be linked to the solving PR) label Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature use for describing a new feature to develop solved use to identify issue that has been solved (must be linked to the solving PR)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants