NPM Resource Changed ? ? ? Pending

User tests: Successful: Unsuccessful:

avatar SniperSister
SniperSister
5 Jul 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

avatar SniperSister SniperSister - open - 5 Jul 2020
avatar SniperSister SniperSister - change - 5 Jul 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 5 Jul 2020
Category Administration com_finder
avatar SniperSister
SniperSister - comment - 5 Jul 2020
avatar HLeithner
HLeithner - comment - 5 Jul 2020

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

avatar PhilETaylor
PhilETaylor - comment - 5 Jul 2020

The response after this PR is

{"token":"3c17b81ea84946fcec0eed888d382ecb","error":true,"header":"An Error Has Occurred","message":"The security token did not match. The request was aborted to prevent any security breach. Please try again.","buffer":""}

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.

These Ajax calls are a destructive call - the start function resets the index state.

Therefore at a minimum it should only respond to a POST and not a GET. It currently responds to a GET.

As its also a destructive call (or a call that doesnt only get data, but manipulates it) it should be protected by a CSRF token. Else a CSRF compromise (like you hosting an image from my domain name) can allow me to trigger the destructive action of resetting your index state !

Even with your changes, The token check should be the very first thing in the methods too. Else, with logging enabled, the hacked request can still write a line to your logger, an action I should not be able to do via a CSRF vulnerability. Using static:sendResponse also writes to the log files.

I also disagree that this should have gone public, its an active CRSF vulnerability, but too late now.

avatar PhilETaylor
PhilETaylor - comment - 5 Jul 2020

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

avatar zero-24
zero-24 - comment - 5 Jul 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.

avatar Fedik
Fedik - comment - 5 Jul 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

avatar ceford
ceford - comment - 6 Jul 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.

avatar ceford
ceford - comment - 6 Jul 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.

avatar SniperSister SniperSister - change - 6 Jul 2020
Labels Added: ? ?
avatar SniperSister
SniperSister - comment - 6 Jul 2020

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?

avatar PhilETaylor PhilETaylor - test_item - 6 Jul 2020 - Tested successfully
avatar PhilETaylor
PhilETaylor - comment - 6 Jul 2020

I have tested this item successfully on da7a77d


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

avatar Quy
Quy - comment - 6 Jul 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");

avatar ceford
ceford - comment - 7 Aug 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.

avatar SniperSister SniperSister - change - 17 Aug 2020
The description was changed
avatar SniperSister SniperSister - edited - 17 Aug 2020
avatar SniperSister
SniperSister - comment - 17 Aug 2020

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

avatar wilsonge
wilsonge - comment - 17 Aug 2020

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

avatar particthistle particthistle - test_item - 19 Sep 2020 - Tested unsuccessfully
avatar particthistle
particthistle - comment - 19 Sep 2020

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.

avatar particthistle
particthistle - comment - 19 Sep 2020

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

avatar wilsonge wilsonge - change - 16 Oct 2020
Labels Added: ? ?
Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 16 Oct 2020
Category Administration com_finder Administration com_finder JavaScript Repository NPM Change
avatar wilsonge
wilsonge - comment - 16 Oct 2020

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

avatar wilsonge
wilsonge - comment - 17 Oct 2020

Screenshot 2020-10-17 at 01 12 53

My screen

avatar particthistle particthistle - test_item - 17 Oct 2020 - Tested successfully
avatar particthistle
particthistle - comment - 17 Oct 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.
avatar ceford ceford - test_item - 17 Oct 2020 - Tested successfully
avatar ceford
ceford - comment - 17 Oct 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.

avatar wilsonge wilsonge - change - 17 Oct 2020
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-10-17 02:01:48
Closed_By wilsonge
Labels Added: NPM Resource Changed ?
Removed: ?
avatar wilsonge wilsonge - close - 17 Oct 2020
avatar wilsonge wilsonge - merge - 17 Oct 2020
avatar wilsonge
wilsonge - comment - 17 Oct 2020

Thanks!

Add a Comment

Login with GitHub to post a comment