CVE-2010-5104
Description
The escapeStrForLike method in TYPO3 4.2.x before 4.2.16, 4.3.x before 4.3.9, and 4.4.x before 4.4.5 does not properly escape input when the MySQL database is set to sql_mode NO_BACKSLASH_ESCAPES, which allows remote attackers to obtain sensitive information via wildcard characters in a LIKE query.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
typo3/cms-corePackagist | >= 4.2.0, < 4.2.16 | 4.2.16 |
typo3/cms-corePackagist | >= 4.3.0, < 4.3.9 | 4.3.9 |
typo3/cms-corePackagist | >= 4.4.0, < 4.4.5 | 4.4.5 |
Affected products
29cpe:2.3:a:typo3:typo3:4.2.0:*:*:*:*:*:*:*+ 28 more
- cpe:2.3:a:typo3:typo3:4.2.0:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.1:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.10:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.11:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.12:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.13:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.14:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.15:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.2:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.3:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.4:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.5:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.6:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.7:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.8:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.2.9:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.3.0:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.3.1:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.3.2:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.3.3:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.3.4:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.3.5:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.3.6:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.3.7:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.3.8:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.4.1:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.4.2:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.4.3:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.4.4:*:*:*:*:*:*:*
Patches
39eb4be4ccf10Fixed bug #15737: quoteStrForLike does not properly escape strings in sql_mode NO_BACKSLASH_ESCAPES
2 files changed · +28 −0
ChangeLog+1 −0 modified@@ -2,6 +2,7 @@ * Fixed bug #14402: XSS in Install tool (thanks to Benjamin Mack) * Fixed bug #16590: t3lib_TSparser::checkIncludeLines() does not check files to be included (thanks to Fabrizio Branca) + * Fixed bug #15737: quoteStrForLike does not properly escape strings in sql_mode NO_BACKSLASH_ESCAPES 2010-12-07 Christian Kuhn <lolli@schwarzbu.ch>
t3lib/class.t3lib_db.php+27 −0 modified@@ -1124,11 +1124,38 @@ function sql_pconnect($TYPO3_db_host, $TYPO3_db_username, $TYPO3_db_password) { ); } } + $this->setSqlMode(); } return $this->link; } + /** + * Fixes the SQL mode by unsetting NO_BACKSLASH_ESCAPES if found. + * + * @return void + */ + protected function setSqlMode() { + $resource = $this->sql_query('SELECT @@SESSION.sql_mode;'); + if (is_resource($resource)) { + $result = $this->sql_fetch_row($resource); + if (isset($result[0]) && $result[0] && strpos($result[0], 'NO_BACKSLASH_ESCAPES') !== FALSE) { + $modes = array_diff( + t3lib_div::trimExplode(',', $result[0]), + array('NO_BACKSLASH_ESCAPES') + ); + $query = 'SET sql_mode=\'' . mysql_real_escape_string(implode(',', $modes)) . '\';'; + $success = $this->sql_query($query); + + t3lib_div::sysLog( + 'NO_BACKSLASH_ESCAPES could not be removed from SQL mode: ' . $this->sql_error(), + 'Core', + 3 + ); + } + } + } + /** * Select a MySQL database * mysql_select_db() wrapper function
e8c32474a557Fixed bug #15737: quoteStrForLike does not properly escape strings in sql_mode NO_BACKSLASH_ESCAPES
2 files changed · +28 −0
ChangeLog+1 −0 modified@@ -2,6 +2,7 @@ * Fixed bug #14402: XSS in Install tool (thanks to Benjamin Mack) * Fixed bug #16590: t3lib_TSparser::checkIncludeLines() does not check files to be included (thanks to Fabrizio Branca) + * Fixed bug #15737: quoteStrForLike does not properly escape strings in sql_mode NO_BACKSLASH_ESCAPES 2010-12-01 Oliver Hader <oliver@typo3.org>
t3lib/class.t3lib_db.php+27 −0 modified@@ -1039,11 +1039,38 @@ function sql_pconnect($TYPO3_db_host, $TYPO3_db_username, $TYPO3_db_password) { ); } } + $this->setSqlMode(); } return $this->link; } + /** + * Fixes the SQL mode by unsetting NO_BACKSLASH_ESCAPES if found. + * + * @return void + */ + protected function setSqlMode() { + $resource = $this->sql_query('SELECT @@SESSION.sql_mode;'); + if (is_resource($resource)) { + $result = $this->sql_fetch_row($resource); + if (isset($result[0]) && $result[0] && strpos($result[0], 'NO_BACKSLASH_ESCAPES') !== FALSE) { + $modes = array_diff( + t3lib_div::trimExplode(',', $result[0]), + array('NO_BACKSLASH_ESCAPES') + ); + $query = 'SET sql_mode=\'' . mysql_real_escape_string(implode(',', $modes)) . '\';'; + $success = $this->sql_query($query); + + t3lib_div::sysLog( + 'NO_BACKSLASH_ESCAPES could not be removed from SQL mode: ' . $this->sql_error(), + 'Core', + 3 + ); + } + } + } + /** * Select a MySQL database * mysql_select_db() wrapper function
fcabd2fc2aa5Fixed bug #15737: quoteStrForLike does not properly escape strings in sql_mode NO_BACKSLASH_ESCAPES
2 files changed · +28 −0
ChangeLog+1 −0 modified@@ -2,6 +2,7 @@ * Fixed bug #14402: XSS in Install tool (thanks to Benjamin Mack) * Fixed bug #16590: t3lib_TSparser::checkIncludeLines() does not check files to be included (thanks to Fabrizio Branca) + * Fixed bug #15737: quoteStrForLike does not properly escape strings in sql_mode NO_BACKSLASH_ESCAPES 2010-11-12 Ernesto Baschny <ernst@cron-it.de>
t3lib/class.t3lib_db.php+27 −0 modified@@ -937,11 +937,38 @@ function sql_pconnect($TYPO3_db_host, $TYPO3_db_username, $TYPO3_db_password) { t3lib_div::sysLog('Could not initialize DB connection with query "'.$v.'": '.mysql_error($this->link),'Core',3); } } + $this->setSqlMode(); } return $this->link; } + /** + * Fixes the SQL mode by unsetting NO_BACKSLASH_ESCAPES if found. + * + * @return void + */ + protected function setSqlMode() { + $resource = $this->sql_query('SELECT @@SESSION.sql_mode;'); + if (is_resource($resource)) { + $result = $this->sql_fetch_row($resource); + if (isset($result[0]) && $result[0] && strpos($result[0], 'NO_BACKSLASH_ESCAPES') !== FALSE) { + $modes = array_diff( + t3lib_div::trimExplode(',', $result[0]), + array('NO_BACKSLASH_ESCAPES') + ); + $query = 'SET sql_mode=\'' . mysql_real_escape_string(implode(',', $modes)) . '\';'; + $success = $this->sql_query($query); + + t3lib_div::sysLog( + 'NO_BACKSLASH_ESCAPES could not be removed from SQL mode: ' . $this->sql_error(), + 'Core', + 3 + ); + } + } + } + /** * Select a MySQL database * mysql_select_db() wrapper function
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
18- secunia.com/advisories/35770nvdVendor Advisory
- typo3.org/teams/security/security-bulletins/typo3-core/typo3-sa-2010-022/nvdVendor Advisory
- github.com/advisories/GHSA-xgc2-q928-27wvghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2010-5104ghsaADVISORY
- typo3.org/teams/security/security-bulletins/typo3-core/typo3-sa-2010-022ghsaWEB
- www.openwall.com/lists/oss-security/2011/01/13/2nvdWEB
- www.openwall.com/lists/oss-security/2012/05/10/7nvdWEB
- www.openwall.com/lists/oss-security/2012/05/11/3nvdWEB
- www.openwall.com/lists/oss-security/2012/05/12/5nvdWEB
- exchange.xforce.ibmcloud.com/vulnerabilities/64185nvdWEB
- github.com/TYPO3/typo3/commit/9eb4be4ccf10e6959699b9cce375d48697f06cbaghsaWEB
- github.com/TYPO3/typo3/commit/e8c32474a5571336681243465f42090cf056054fghsaWEB
- github.com/TYPO3/typo3/commit/fcabd2fc2aa557c94805f7505277185c4abb68abghsaWEB
- web.archive.org/web/20101219052359/http://secunia.com/advisories/35770ghsaWEB
- web.archive.org/web/20111025222220/http://typo3.org/teams/security/security-bulletins/typo3-sa-2010-022ghsaWEB
- web.archive.org/web/20111223211753/http://www.securityfocus.com/bid/45470ghsaWEB
- www.osvdb.org/70116nvd
- www.securityfocus.com/bid/45470nvd
News mentions
0No linked articles in our index yet.