-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Don't force fuzzing auth headers for API endpoints #17358
base: develop
Are you sure you want to change the base?
Don't force fuzzing auth headers for API endpoints #17358
Conversation
Good point, I agree that this shouldn't be fuzzed for each endpoint, but shouldn't w3af at least fuzz it for one endpoint? That way, if the REST API has a "SQL injection in the API key verification method" w3af would be able to find it. |
Makes sense to me. Let me update the patch. Thanks! |
I have updated the patch:
|
if parameter.location == 'header': | ||
|
||
# Fuzz auth headers only once. | ||
if self._is_already_fuzzed_auth_header(parameter.name, operation.swagger_spec): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parser shouldn't have any responsibility associated with fuzzing. The parser should just return what is found in the OpenAPI, then other parts of the code should be responsible of fuzzing (or not) the authentication header.
Not sure where to put this... maybe the solution is to modify the fuzzer.py code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. I wanted to have only API scans in scope. Then, I think the logic should look like the following:
- We need to maintain a list of parameters which is used for auth. The list may be stored in the KB.
- The OpenAPI plugin should add auth parameters to this list (it should consider parameters in headers and query string)
- Probably we should also consider auth settings defined by
http-settings
andauth
plugins but I would implement it separately. create_mutants()
method should take the list into account, or we can updateHeadersMutant
andQSMutant
classes to take care about fuzzing auth parameters only once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it sound okay? If yes, I'll try to implement it.
I have updated the patch with what I described in my comment above. A couple of notes:
Looking forward to hearing your feedback! |
I noticed that the OpenAPI plugin forces fuzzing for auth headers. For example, it can happen if the API spec defines authentication with API keys passed in a header. Usually, a user provides such an auth header which then should be included to all HTTP request without any modification. So, it doesn't make much sense to force fuzzing for this header.
This patch fixes this issue. It updates
RequestFactory
to filter out auth headers.