CVE-2009-3633
Description
Cross-site scripting (XSS) vulnerability in the t3lib_div::quoteJSvalue API function in TYPO3 4.0.13 and earlier, 4.1.x before 4.1.13, 4.2.x before 4.2.10, and 4.3.x before 4.3beta2 allows remote attackers to inject arbitrary web script or HTML via unspecified vectors related to the sanitizing algorithm.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
typo3/cms-corePackagist | <= 4.0.13 | — |
typo3/cms-corePackagist | >= 4.1.0, < 4.1.13 | 4.1.13 |
typo3/cms-corePackagist | >= 4.2.0, < 4.2.10 | 4.2.10 |
typo3/cms-corePackagist | >= 4.3alpha1, < 4.3beta2 | 4.3beta2 |
Affected products
59cpe:2.3:a:typo3:typo3:*:*:*:*:*:*:*:*+ 58 more
- cpe:2.3:a:typo3:typo3:*:*:*:*:*:*:*:*range: <=4.0.12
- cpe:2.3:a:typo3:typo3:0.1.2:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:1.0.14:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:1.1:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:1.1.09:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:1.1.1:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:1.1.10:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:1.2.0:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:1.3.0:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:1.3.2:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:3.0:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:3.3.x:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:3.5:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:3.5.x:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:3.6.x:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:3.7.0:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:3.7.1:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:3.7.x:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:3.8:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:3.8.x:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.0:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.0.1:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.0.10:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.0.11:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.0.2:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.0.3:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.0.4:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.0.5:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.0.6:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.0.7:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.0.8:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.0.9:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.0:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.0:beta1:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.0:rc1:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.1:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.10:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.11:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.12:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.2:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.3:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.4:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.5:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.6:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.7:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.8:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.1.9:*:*:*:*:*:*:*
- 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.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:*:*:*:*:*:*:*
- cpe:2.3:a:typo3:typo3:4.3:alpha1:*:*:*:*:*:*
Patches
35d4218fad3ae* Fixed bug #12303: XSS vulnerability due to not proper sanitizing in function t3lib_div::quoteJSvalue (thanks to Oliver Klee)
2 files changed · +21 −14
ChangeLog+1 −0 modified@@ -1,6 +1,7 @@ 2009-10-22 Ernesto Baschny <ernst@cron-it.de> * Fixed bug #11586: Potential SQL injection in frontend editing (thanks to Oliver Klee) + * Fixed bug #12303: XSS vulnerability due to not proper sanitizing in function t3lib_div::quoteJSvalue (thanks to Oliver Klee) 2009-10-21 Rupert Germann <rupi@gmx.li>
t3lib/class.t3lib_div.php+20 −14 modified@@ -4693,23 +4693,29 @@ function unQuoteFilenames($parameters,$unQuote=FALSE) { return $paramsArr; } - /** - * Quotes a string for usage as JS parameter. Depends wheter the value is used in script tags (it doesn't need/must not get htmlspecialchar'ed in this case) + * Quotes a string for usage as JS parameter. Depends whether the value is + * used in script tags (it doesn't need/must not get htmlspecialchar'ed in + * this case). + * + * @param string $value the string to encode, may be empty + * @param boolean $withinCData + * whether the escaped data is expected to be used as CDATA and thus + * does not need to be htmlspecialchared + * + * @return string the encoded value already quoted (with single quotes), + * will not be empty * - * @param string The string to encode. - * @param boolean If the values get's used in <script> tags. - * @return string The encoded value already quoted + * @access public */ - function quoteJSvalue($value, $inScriptTags = false) { - $value = addcslashes($value, '\''.'"'.chr(10).chr(13)); - if (!$inScriptTags) { - $value = htmlspecialchars($value); + function quoteJSvalue($value, $withinCData = false) { + $escapedValue = addcslashes( + $value, '\'' . '"' . '\\' . chr(9) . chr(10) . chr(13) + ); + if (!$withinCData) { + $escapedValue = htmlspecialchars($escapedValue); } - return '\''.$value.'\''; + return '\'' . $escapedValue . '\''; } - - } - -?> +?> \ No newline at end of file
ef9ab2da76c2* Fixed bug #12303: XSS vulnerability due to not proper sanitizing in function t3lib_div::quoteJSvalue (thanks to Oliver Klee)
2 files changed · +21 −14
ChangeLog+1 −0 modified@@ -2,6 +2,7 @@ * Security Issue #11664: Updated RemoveXSS code to the latest knowledge in this area (thanks to Jigal van Hemert) * Fixed bug #11586: Potential SQL injection in frontend editing (thanks to Oliver Klee) + * Fixed bug #12303: XSS vulnerability due to not proper sanitizing in function t3lib_div::quoteJSvalue (thanks to Oliver Klee) 2009-10-21 Rupert Germann <rupi@gmx.li>
t3lib/class.t3lib_div.php+20 −14 modified@@ -1534,8 +1534,8 @@ public static function generateRandomBytes($count) { return $output; } - - + + @@ -5207,21 +5207,27 @@ public static function unQuoteFilenames($parameters,$unQuote=FALSE) { return $paramsArr; } - /** - * Quotes a string for usage as JS parameter. Depends wheter the value is used in script tags (it doesn't need/must not get htmlspecialchar'ed in this case) + * Quotes a string for usage as JS parameter. Depends whether the value is + * used in script tags (it doesn't need/must not get htmlspecialchar'ed in + * this case). * - * @param string The string to encode. - * @param boolean If the values get's used in <script> tags. - * @return string The encoded value already quoted + * @param string $value the string to encode, may be empty + * @param boolean $withinCData + * whether the escaped data is expected to be used as CDATA and thus + * does not need to be htmlspecialchared + * + * @return string the encoded value already quoted (with single quotes), + * will not be empty */ - public static function quoteJSvalue($value, $inScriptTags = false) { - $value = addcslashes($value, '\''.'"'.chr(10).chr(13)); - if (!$inScriptTags) { - $value = htmlspecialchars($value); + public static function quoteJSvalue($value, $withinCData = false) { + $escapedValue = addcslashes( + $value, '\'' . '"' . '\\' . chr(9) . chr(10) . chr(13) + ); + if (!$withinCData) { + $escapedValue = htmlspecialchars($escapedValue); } - return '\''.$value.'\''; + return '\'' . $escapedValue . '\''; } } - -?> +?> \ No newline at end of file
51f3dd9804ca* Fixed bug #12303: XSS vulnerability due to not proper sanitizing in function t3lib_div::quoteJSvalue (thanks to Oliver Klee)
3 files changed · +149 −14
ChangeLog+1 −0 modified@@ -1,6 +1,7 @@ 2009-10-22 Ernesto Baschny <ernst@cron-it.de> * Fixed bug #11586: Potential SQL injection in frontend editing (thanks to Oliver Klee) + * Fixed bug #12303: XSS vulnerability due to not proper sanitizing in function t3lib_div::quoteJSvalue (thanks to Oliver Klee) 2009-10-21 Sebastian Kurfuerst <sebastian@typo3.org>
t3lib/class.t3lib_div.php+20 −12 modified@@ -5679,18 +5679,26 @@ public static function unQuoteFilenames($parameters,$unQuote=FALSE) { /** - * Quotes a string for usage as JS parameter. Depends wheter the value is used in script tags (it doesn't need/must not get htmlspecialchar'ed in this case) - * - * @param string The string to encode. - * @param boolean If the values get's used in <script> tags. - * @return string The encoded value already quoted - */ - public static function quoteJSvalue($value, $inScriptTags = false) { - $value = addcslashes($value, '\''.'"'.chr(10).chr(13)); - if (!$inScriptTags) { - $value = htmlspecialchars($value); - } - return '\''.$value.'\''; + * Quotes a string for usage as JS parameter. Depends whether the value is + * used in script tags (it doesn't need/must not get htmlspecialchar'ed in + * this case). + * + * @param string $value the string to encode, may be empty + * @param boolean $withinCData + * whether the escaped data is expected to be used as CDATA and thus + * does not need to be htmlspecialchared + * + * @return string the encoded value already quoted (with single quotes), + * will not be empty + */ + static public function quoteJSvalue($value, $withinCData = false) { + $escapedValue = addcslashes( + $value, '\'' . '"' . '\\' . chr(9) . chr(10) . chr(13) + ); + if (!$withinCData) { + $escapedValue = htmlspecialchars($escapedValue); + } + return '\'' . $escapedValue . '\''; }
tests/t3lib/t3lib_div_testcase.php+128 −2 modified@@ -26,12 +26,13 @@ /** * Testcase for class t3lib_div * - * @author Ingo Renner <ingo@typo3.org> + * @author Ingo Renner <ingo@typo3.org> + * @author Oliver Klee <typo3-coding@oliverklee.de> + * * @package TYPO3 * @subpackage t3lib */ class t3lib_div_testcase extends tx_phpunit_testcase { - /** * @test */ @@ -454,6 +455,131 @@ public function checkGetDirsReturnsStringErrorOnPathFailure() { $this->assertEquals($expectedResult, $result); } + + + ////////////////////////////////// + // Tests concerning quoteJSvalue + ////////////////////////////////// + + /** + * @test + */ + public function quoteJSvalueHtmlspecialcharsDataByDefault() { + $this->assertContains( + '>', + t3lib_div::quoteJSvalue('>') + ); + } + + /** + * @test + */ + public function quoteJSvaluetHtmlspecialcharsDataWithinCDataSetToFalse() { + $this->assertContains( + '>', + t3lib_div::quoteJSvalue('>', false) + ); + } + + /** + * @test + */ + public function quoteJSvaluetNotHtmlspecialcharsDataWithinCDataSetToTrue() { + $this->assertContains( + '>', + t3lib_div::quoteJSvalue('>', true) + ); + } + + /** + * @test + */ + public function quoteJSvalueReturnsEmptyStringQuotedInSingleQuotes() { + $this->assertEquals( + "''", + t3lib_div::quoteJSvalue("", true) + ); + } + + /** + * @test + */ + public function quoteJSvalueNotModifiesStringWithoutSpecialCharacters() { + $this->assertEquals( + "'Hello world!'", + t3lib_div::quoteJSvalue("Hello world!", true) + ); + } + + /** + * @test + */ + public function quoteJSvalueEscapesSingleQuote() { + $this->assertEquals( + "'\\''", + t3lib_div::quoteJSvalue("'", true) + ); + } + + /** + * @test + */ + public function quoteJSvalueEscapesDoubleQuoteWithinCDataSetToTrue() { + $this->assertEquals( + "'\\\"'", + t3lib_div::quoteJSvalue('"', true) + ); + } + + /** + * @test + */ + public function quoteJSvalueEscapesAndHtmlspecialcharsDoubleQuoteWithinCDataSetToFalse() { + $this->assertEquals( + "'\\"'", + t3lib_div::quoteJSvalue('"', false) + ); + } + + /** + * @test + */ + public function quoteJSvalueEscapesTab() { + $this->assertEquals( + "'" . '\t' . "'", + t3lib_div::quoteJSvalue(chr(9)) + ); + } + + /** + * @test + */ + public function quoteJSvalueEscapesLinefeed() { + $this->assertEquals( + "'" . '\n' . "'", + t3lib_div::quoteJSvalue(chr(10)) + ); + } + + /** + * @test + */ + public function quoteJSvalueEscapesCarriageReturn() { + $this->assertEquals( + "'" . '\r' . "'", + t3lib_div::quoteJSvalue(chr(13)) + ); + } + + /** + * @test + */ + public function quoteJSvalueEscapesBackslah() { + $this->assertEquals( + "'\\\\'", + t3lib_div::quoteJSvalue('\\') + ); + } } ?> \ No newline at end of file
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
14- typo3.org/teams/security/security-bulletins/typo3-sa-2009-016/nvdPatchVendor Advisory
- www.securityfocus.com/bid/36801nvdPatch
- www.vupen.com/english/advisories/2009/3009nvdPatchVendor Advisory
- secunia.com/advisories/37122nvdVendor Advisory
- github.com/advisories/GHSA-m7rg-85g8-28m9ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2009-3633ghsaADVISORY
- marc.infonvdWEB
- marc.infonvdWEB
- typo3.org/teams/security/security-bulletins/typo3-sa-2009-016ghsaWEB
- exchange.xforce.ibmcloud.com/vulnerabilities/53925nvdWEB
- github.com/TYPO3/typo3/commit/51f3dd9804cae04575323b92a9136e5a511fe810ghsaWEB
- github.com/TYPO3/typo3/commit/5d4218fad3aeda46236754004232d7e635205e7aghsaWEB
- github.com/TYPO3/typo3/commit/ef9ab2da76c2506306d835209d2a38195bdf7bcfghsaWEB
- web.archive.org/web/20101223093042/http://www.securityfocus.com/bid/36801ghsaWEB
News mentions
0No linked articles in our index yet.