Project

General

Profile

Actions

Bug #62527

closed

Parameter type accepts non-integer values in shortcut redirect

Added by Christoph Gerold about 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2014-10-29
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Test / Replication
  1. Add a TYPO3 page of type shortcut
  2. Call the page in the frontend with the additional parameter type
    • best effect can be seen if the value of the parameter is a domain
      http://www.domain.tld/index.php?type=www.typo3.org
      
  3. See the browser redirect

Cause
The responsible function is checkPageForShortcutRedirect() located in typo3_src/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php:3152.

So whats happening behind the scenes:
  1. The function reads the unique id of the current page (i.e. $parameter = 1)
    $parameter = $this->page['uid'];
    
  2. It reads the value of the GET-Parameter type (i.e. $type=www.typo3.org)
    $type = GeneralUtility::_GET('type');
    
  3. The value of thd parameter is concatenated with the value of the type (results in $parameter = 1,www.typo3.org)
    if ($type) {
        $parameter .= ',' . $type;
    }
    
  4. TYPO3 builds a link with the given parameter (results in $redirectUrl = http://1,www.typo3.org)
    $redirectUrl = $cObj->typoLink_URL(array('parameter' => $parameter));
    
  5. Finally TYPO3 redirects to the url http://1,www.typo3.org)
    HttpUtility::redirect($redirectUrl, HttpUtility::HTTP_STATUS_307);
    

What's next

In my opinion there are two possible fixes for that:
  1. add an intval() (as TSref says typeNum should be of type integer)
    • if, then maybe already at an earlier point typo3/sysext/cms/tslib/index_ts.php:76
      intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('type'))
      
  2. don't concatenate parameter and type if it is not an integer
Actions #1

Updated by Helmut Hummel about 10 years ago

  • Status changed from New to Needs Feedback

You're correctly describing current behavior.
But what is the actually the problem you are running into with this behavior (besides argument values being passed to TYPO3 are used as is)?

Actions #2

Updated by Sascha Egerer about 10 years ago

Isn't this some kind of CSRF?

If you open a domain like www.my-typo3.com?type=www.an-eval-page.com you will be redirected to http://1,www.an-eval-page.com. Not sure if there is any attack vektor.

Actions #3

Updated by Helmut Hummel about 10 years ago

  • Project changed from TYPO3 Core to 1716
Actions #4

Updated by Helmut Hummel about 10 years ago

  • Project changed from 1716 to TYPO3 Core
  • Status changed from Needs Feedback to Accepted
  • Is Regression set to No

Ok. Now I understand the issue.

Simply calling a TYPO3 shortcut page (>= TYPO3 4.6) with a type parameter value that contains a dot "." redirects to a URL

http://<uidOfShortcutPage>,<valueGivenForType>

e.g.:

http://example.tld?id=1&type=.

Redirects to

http://1,.

This is not nice and should probably be fixed with an intval, but I can't imagine a way to exploit it, thus moving this back to the normal core tracker

Actions #5

Updated by Markus Klein about 10 years ago

Yet another instance where we have insufficient type checking.

Actions #6

Updated by Gerrit Code Review about 10 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34193

Actions #7

Updated by Gerrit Code Review almost 10 years ago

Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34193

Actions #8

Updated by Gerrit Code Review almost 10 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35037

Actions #9

Updated by Gerrit Code Review almost 10 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35037

Actions #10

Updated by Gerrit Code Review almost 10 years ago

Patch set 3 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34193

Actions #11

Updated by Gerrit Code Review almost 10 years ago

Patch set 4 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34193

Actions #12

Updated by Björn Fromme almost 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #13

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF