The vulnerability is a stored XSS in Craft CMS's Table field, caused by the application's failure to properly sanitize input when a column is set to the 'html' type. An attacker can set this type by intercepting and modifying the request to save a Table field, as 'html' is not an option in the UI.
The analysis of the provided patch f5d488d9bb6eff7670ed2c2fe30e15692e92c52b pinpoints the vulnerable functions within src/fields/Table.php.
-
craft\cms\fields\Table::validateColumns: This is the primary vulnerable function. The patch introduces validation to ensure that a column's type is within a predefined list of safe types. Before this change, the function lacked this validation, allowing an attacker to save a column with the type set to 'html'. This is the entry point for the vulnerability.
-
craft\cms\fields\Table::getSettingsHtml: The vulnerability report confirms that the XSS payload executes when an administrator edits the compromised field. This function generates the HTML for the field's settings page. It would read the field's configuration, including the malicious default value and the 'html' column type, and render it in a way that caused the browser to execute the script.
-
craft\cms\fields\Table::__construct: The patch removes code from the constructor that was intended to handle 'html' type columns by encoding their default values. This shows that the constructor was part of the code path that processed the malicious configuration. This attempted mitigation was removed in favor of disallowing the 'html' type altogether, indicating it was insufficient.
In an exploit scenario, these three functions would be invoked to process, store, and render the malicious data, making them key indicators in a runtime profile.