CVE-2023-44270 (published 2023-09-29T22:15Z)

An issue was discovered in PostCSS before 8.4.31. The vulnerability affects linters using PostCSS to parse external untrusted CSS. An attacker can prepare CSS in such a way that it will contains parts parsed by PostCSS as a CSS comment. After processing by PostCSS, it will be included in the PostCSS output in CSS nodes (rules, properties) despite being included in a comment.

CVSS v3 base score: 5.3, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N)

Weakness information:
cwe_id: CWE-74
cwe_name: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
description: The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
extended_description: Software or other automated logic has certain assumptions about what constitutes data and control respectively. It is the lack of verification of these assumptions for user-controlled input that leads to injection problems. Injection problems encompass a wide variety of issues -- all mitigated in very different ways and usually attempted in order to alter the control flow of the process. For this reason, the most effective way to discuss these weaknesses is to note the distinct features that classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed.
         

Fix information:
repo_url: https://github.com/postcss/postcss
commit_details: repo_url: https://github.com/postcss/postcss
author: Andrey Sitnik
author_date: 2023-09-29 00:07:58+02:00
msg: Fix carrier return parsing
repository: repo_url: https://github.com/postcss/postcss
repo_name: postcss/postcss
description: Transforming styles with JS plugins
repo_language: TypeScript
owner: postcss
file_changes: filename: tokenize.js
change_type: ModificationType.MODIFY
diff: @@ -22,7 +22,7 @@ const AT = '@'.charCodeAt(0)
 
 const RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g
 const RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g
-const RE_BAD_BRACKET = /.[\n"'(/\\]/
+const RE_BAD_BRACKET = /.[\r\n"'(/\\]/
 const RE_HEX_ESCAPE = /[\da-f]/i
 
 module.exports = function tokenizer(input, options = {}) {

programming_language: JavaScript
filename: parse.test.ts
change_type: ModificationType.MODIFY
diff: @@ -34,6 +34,12 @@ test('should has false at hasBOM property', () => {
   is(css.first?.source?.input.hasBOM, false)
 })
 
+test('parses carrier return', () => {
+  throws(() => {
+    parse('@font-face{ font:(\r/*);} body { a: "a*/)} a{}"}')
+  }, /:1:46: Unclosed string/)
+})
+
 test('saves source file', () => {
   let css = parse('a {}', { from: 'a.css' })
   is(css.first?.source?.input.css, 'a {}')

programming_language: TypeScript