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

[4.x] - com_finder doesn't stop indexing on CSRF token mismatch #29979

Merged
merged 4 commits into from Oct 17, 2020

Conversation

SniperSister
Copy link
Contributor

@SniperSister SniperSister commented Jul 5, 2020

Summary of Changes

Added the required "return" statements after sending the error message to prevent the process from continuing.

Testing Instructions

  1. run the com_finder indexer from the backend and make sure it works
  2. edit the line
    <input id="finder-indexer-token" type="hidden" name="<?php echo Factory::getSession()->getFormToken(); ?>" value="1"> to
    <input id="finder-indexer-token" type="hidden" name="123" value="1">
    in administrator/components/com_finder/tmpl/indexer/default.php and hit the "reindex" button again - an error message is shown.

Actual result BEFORE applying this Pull Request

The error message is test case two isn't shown because the returned response is invalid

Expected result AFTER applying this Pull Request

Error is shown

@SniperSister
Copy link
Contributor Author

FYI @joomla/security

Copy link
Member

@zero-24 zero-24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@HLeithner
Copy link
Member

Any idea why this is not at the beginning of the functions?

@PhilETaylor

This comment was marked as abuse.

@PhilETaylor

This comment was marked as abuse.

@zero-24
Copy link
Member

zero-24 commented Jul 5, 2020

Also @joomla/security doesnt appear to be a valid team on GitHub any longer.

IIRC github limts mention of teams to member of the org. I can confirm that this is still a valid team.

@Fedik
Copy link
Member

Fedik commented Jul 5, 2020

Any idea why this is not at the beginning of the functions?

maybe for errors logging, that is at the beginning of the function :)
if so, then this error also has to be logged

@ceford
Copy link
Contributor

ceford commented Jul 6, 2020

I removed said line and clicked the Index button in the Smart Search: Indexed Content page. The Modal dialog appeared and hung - am I supposed to look somewhere else for the error?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29979.

@ceford
Copy link
Contributor

ceford commented Jul 6, 2020

I should have said - both with and without the patch.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29979.

@SniperSister
Copy link
Contributor Author

thus revealing the correct token and allowing the hacker to make the same call again from their remote location, including that correct token, without additional work - you are literally handing the CSRF attacker what he needs to be able to be successful.

Literally any response with a form returns that token to the active user, that's how CSRF tokens are designed. I agree that it can be removed (and did so by updating this PR) however I can't see any risk associated with this behavior.

The token check should be the very first thing in the methods too

Done

The Modal dialog appeared and hung - am I supposed to look somewhere else for the error?

Is it just a blank page? Or do you have any error message or output in there?

@PhilETaylor

This comment was marked as abuse.

@Quy
Copy link
Contributor

Quy commented Jul 6, 2020

The modal hangs. An error message is not displayed. In the console:

Uncaught TypeError: document.getElementById(...) is null

var token = "&".concat(document.getElementById('finder-indexer-token').getAttribute('name'), "=1");

@Quy Quy added the Updates Requested Indicates that this pull request needs an update from the author and should not be tested. label Jul 28, 2020
@ceford
Copy link
Contributor

ceford commented Aug 7, 2020

With new update to Beta4-Dev, after removing the line and applying the patch the modal hangs - so I think this is a fail!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29979.

@SniperSister
Copy link
Contributor Author

@ceford @Quy I updated the test instructions, please retry

@wilsonge
Copy link
Contributor

I suspect (don't have a way to test right now) that if there's an error thrown in a plugin that this will now longer be indexable second time around by dropping the token. Fedik's sample code shows the token in the response is being used. I don't see why we should remove it here. It's no different to submitting a frontend login form that has an invalid token

@particthistle
Copy link
Member

I have tested this item 🔴 unsuccessfully on da7a77d

Tested during BFH tonight as Patch Tester was showing it as a release blocker.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29979.

@particthistle
Copy link
Member

Failed with the error message not being displayed. The Indexer just hangs when you click on it when the token has been manually changed.

29979-test

Additionally, developer tools shows the following:
image

@joomla-cms-bot joomla-cms-bot added the NPM Resource Changed This Pull Request can't be tested by Patchtester label Oct 16, 2020
@wilsonge
Copy link
Contributor

wilsonge commented Oct 16, 2020

@particthistle you able to test this one again? Think I've fixed that bug (now requires NPM to be run I'm afraid)

@wilsonge
Copy link
Contributor

Screenshot 2020-10-17 at 01 12 53

My screen

@particthistle
Copy link
Member

particthistle commented Oct 17, 2020

I have tested this item ✅ successfully on 797aa4d

image

Changing token after applying PR results in error message.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29979.

@ceford
Copy link
Contributor

ceford commented Oct 17, 2020

I have tested this item ✅ successfully on 797aa4d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29979.

@wilsonge wilsonge merged commit 5f03d45 into joomla:4.0-dev Oct 17, 2020
@wilsonge
Copy link
Contributor

Thanks!

@wilsonge wilsonge added this to the Joomla 4.0 milestone Oct 17, 2020
@SniperSister SniperSister deleted the 4x-finderstop1 branch March 3, 2022 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NPM Resource Changed This Pull Request can't be tested by Patchtester Updates Requested Indicates that this pull request needs an update from the author and should not be tested.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants