-
Notifications
You must be signed in to change notification settings - Fork 19
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
Changes to check for response other than 200 OK #15
base: master
Are you sure you want to change the base?
Conversation
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.
Thanks for your pull request! I started reviewing the code. Please improve the pull request according to the comments.
DetectDynamicJS.py
Outdated
scan_issues.append(issue) | ||
return scan_issues | ||
else: | ||
if(self.hasScriptContent(newRequestResponse)): |
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.
small change - please check if it does not have script content - return None -> less indentation for the rest. :)
DetectDynamicJS.py
Outdated
|
||
def hasScriptContent(self,requestResponse): | ||
""" | ||
Checks if the response of the request contains the scipt content |
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.
typo "script"
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.
Typo is fixed.
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.
somehow this did not make it all the way to your commit
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.
Typo is fixed in recent commit.
DetectDynamicJS.py
Outdated
secondRequestResponse) | ||
scan_issues.append(issue) | ||
return scan_issues | ||
else: |
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.
It looks to me like this else is not necessary. safe an indent. safe a little cats life. Makes the code more readable.
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.
This is fixed as per comments.
DetectDynamicJS.py
Outdated
secondRequestResponse) | ||
scan_issues.append(issue) | ||
return scan_issues | ||
if(self.isScannableRequest(newRequestResponse)): |
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.
Looks like this could be flattened out by an early return as well.
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.
This is modified by changing the if conditions, the code is more flattened out in recent pull commit.
If I understand your first pull request correctly, all it needs in |
I think |
You get a login oracle if the second request is not a scannable request. You want to lose that information? Maybe it would be good to introduce a new finding. Take it out for now, and I'll open an issue about that. |
So please take it out, and we'll fix that in a separate commit. It's true, we can stop earlier testing, but this is mixing up things, and is still a finding
|
@luh2, you are making a good point about the login oracle. I know Sebastian mentions "login state" in the paper, but how would you protect data otherwise. Having an access control where "if the user is logged in, the user can access X", and "if the user is not logged it, respond with Unauthorized" is a standard practice. I find that when these issues are flagged by DetectDynamicJS, they are marked as false positives in real assessments and are treated as noise. My understanding is that this whole pull request is targeting exactly that scenario, when the unauthenticated response doesn't return cookies, 200 Ok, or any script in the body. And as you suggest, taking out the condition of checking if the unauthenticated response contains any script basically makes the whole pull request unnecessary. |
You could make js files not require authentication. Fairly simple. I guess most apps prefer to just leak their login state, which doesn't make me less want to know about them. |
Just merged another pull request - that might solve lots of what you were trying to achieve already. #16 |
Improvement to the plugin checks the status code of the response and does not report the issue for responses other than 200 OK (e.g. 401 Unauthorized) if the response is not a dynamic script (contribution by Synopsys).