-
Notifications
You must be signed in to change notification settings - Fork 52
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
[3.1] - burpsuite - take a stab at csrf fix in imagelib/search.php #1403
base: Development
Are you sure you want to change the base?
Conversation
Just got out of the shower, where I had the thought that... it's also entirely possible that the real problem is just that |
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.
Setting the csrf token within header_template.php file will be an issue because it will cause the forms to fail for all previously installed portals, until their header.php file is updated. I suggest setting this token within the symbbase.php file, which would be appropriate we end up integrating into form elements throughout the code. Since the getUuidV4 is a static function, you don't need to create a class instance. Instead, you only need to add the following two lines.
include_once($SERVER_ROOT.'/classes/UuidFactory.php');
if(!isset($_SESSION['csrf'])) $_SESSION['csrf'] = UuidFactory::getUuidV4();
Another issue is that this is going to break pagination, unless you add the token to the pagination links. Furthermore, this would also interfere within link copy and link sharing features that legitimately replicates a form action. There are legitimate situations where we want folks to be able to do the following: https://lichenportal.org/portal/imagelib/search.php?taxa=acarospora&submitaction=search However, we do want to protect folks from spoofing an action that would change data within the database, right? Thus, instead of restricting input variables being set, maybe we should just limit write actions? In this case, restrict the batchAssignImageTag function from being triggered if the tokens fail to match. This might not totally satisfy the default BurpSuite scans, but it would add the appropriate security without limiting functionality. |
I think this is a sensible. Some of these are a pain because the real exploit is the social engineering side of things which can never really be contained. |
Thanks for all of the feedback. I'll try to implement these recommended changes on Monday. There's at least one thing I have a question about, but it'll be easier to ask about on video. |
Might be worth chatting about this as a group within our next dev meeting. Thanks for taking the initiative to address this issue. |
Fixed in 96c91fe. |
Fixed across a number of commits in this PR. The csrf should only be checked for the batchAssignImageTag action now. |
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.
Description
This PR attempts to address a Cross-site request forgery highlighted by burpsuite in /imagelib/search.php. I have to confess that I was quite unfamiliar with this vulnerability and its solution, but I've given it a shot. I suppose we'll know one way or the other whether it was successful after a fresh burpsuite run?
To offer more context, burpsuite recommended the following resolution, which I've tried to implement:
Specifically, this PR:
''
).If this PR successfully resolves the vulnerability, other pages with the same vulnerability could be more easily resolved (by passing a csfr token in a hidden input field for the vulnerable pages/forms/$_REQUEST objects and then ensuring it matches the token in the user session before extracting values from the $_REQUEST object) with the already-established infrastructure herein.
Pull Request Checklist:
Pre-Approval
master
branch and squash and merged back into themaster
branch.Development
branch, NOTmaster
Post-Approval
Development
branch, remember to use the squash & merge optionDevelopment
branch into the master branch, remember to use the merge optionmaster
branch, a subsequent PR frommaster
intoDevelopment
should be made merge option (i.e., no squash).Development
branch before a tagged release (i.e., before an imminent merge into the master branch), make sure to notify the team and lock theDevelopment
branch to prevent accidental merges while QA takes place. Follow the release protocol here.Thanks for contributing and keeping it clean!