Bug #20785
closedPotential SQL injection in class.t3lib_tsfebeuserauth.php
0%
Description
t3lib/class.t3lib_tsfebeuserauth.php contains a potential security problem, leading to a SQL injection possibility:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',',$fields), $table, 'uid='.$uid);
$uid is from
list($table,$uid) = explode(':',$this->TSFE_EDIT['record']);
which itself is from
$this->TSFE_EDIT = t3lib_div::_POST('TSFE_EDIT');
The problem exists in 4_2 branch, but not in typo3 4 trunk.
https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-2/t3lib/class.t3lib_tsfebeuserauth.php
(issue imported from #M11586)
Files
Updated by Oliver Klee about 15 years ago
The 4.2 branch patch looks okay to me (although I'd prefer intval, but that is just a style issue). As this isn't on the trunk, we won't have any unit tests for this.
On the trunk, a similar problem exists in t3lib_frontendedit::editAction. I'm still looking into whether this is used in any DB calls.
Updated by Oliver Klee about 15 years ago
Ernesto, could you have a look at the trunk patch?
Updated by Oliver Klee about 15 years ago
The patch also adds missing (but used) member variable.
Updated by Ernesto Baschny about 15 years ago
Oli, patch is fine, the unit test work.
I was not really able to exploit the issue, but the potential is probably there, and these patches will fix it.
I would apply the same sort of fix to the 4.2 branch (there in t3lib_tsfebeuserauth::extEditAction), meaning using intval instead of (int) casting, as this is the style used throughout this file already.
+1 by reviewing and testing on all branches (including 4.1, as the function is the same as in 4.2).
Updated by Oliver Klee about 15 years ago
I've created new 4.1 and 4.2 patches that now use intval instead of (int).
Updated by Christian Weiske about 15 years ago
Wow. I opened this security bug in july 2009, and four months later a new patch has been developed, changing "(int)" to "intval("? You are my true heroes.
Updated by Oliver Klee about 15 years ago
Christian, there are several patches. The cosmetic change is on the 4.1 and 4.2 branch versions only. The biggest part of the work has been done on the trunk, including unit tests.
Updated by Helmut Hummel about 15 years ago
+1 (did not look at the testcases though)
Updated by Michael Stucki about 15 years ago
+1 on reading the following patches:
11586.diff
11586_41.diff
11586_42.diff
Updated by Ernesto Baschny about 15 years ago
Commited to
trunk (rev.6229 = beta2)
TYPO3 4.2 (rev. 6230 = 4.2.10)
TYPO3 4.1 (rev. 6231 = 4.1.11)
Updated by Ernesto Baschny about 15 years ago
reopened to change it to "public".