I can see several instances where scald.module is outputting content from the user or database without any sanitization. I can even do this on the demo site as well.
For example, a few I could find easily in scald.admin.inc:
function scald_admin_dashboard() {
...
foreach ($types as $type) {
$table['rows'][] = array(
$type->title, // This is unsanitized and should be output using check_plain()
...
function scald_admin_transcoders() {
...
$transcoders_results = db_query("
SELECT
*
FROM
{scald_transcoders}
");
while ($transcoder_raw = db_fetch_array($transcoders_results)) {
$content .= '
<li>
<strong>' . $transcoder_raw['title'] . '</strong> // Needs check_plain()
<ul>
<li><em>' . $transcoder_raw['description'] . '</em></li> // Needs check_plain()
<li>Provided by ' . $transcoder_raw['provider'] . '.module</li> // Needs check_plain()
</ul>
</li>
';
}
$content .= '</ol>';
return $content;
}
function scald_admin_actions() {
...
$actions_results = db_query("
SELECT
provider,
title,
description
FROM
{scald_actions}
");
while ($action_raw = db_fetch_array($actions_results)) {
$content .= '
<li>
<strong>' . $action_raw['title'] . '</strong> // Needs check_plain()
<ul>
<li><em>' . $action_raw['description'] . '</em></li> // Needs check_plain()
<li>Provided by ' . $action_raw['provider'] . '.module</li> // Needs check_plain()
</ul>
</li>
';
}
$content .= '</ol>';
...
}
I would highly suggest that any developers working on this module take the time to read and understand http://drupal.org/writing-secure-code, specifically http://drupal.org/node/28984. I would then highly recommend a thorough review of all module code by adding things like <script>alert('XSS!')</script> into anywhere a user can provide text input in the module or its sub-modules, and then testing anywhere those values could be output.
Because this module does not yet have a 1.0 official release, this issue is ok to be handled publicly. That said, this module should not have an official 1.0 release until this issue is fixed, otherwise this will have to be handled by the Drupal security team and have an official security release. So it's in your (and the security team's) best interest to fix this before a 1.0 release.
Comments
Comment #1
DeFr commentedIn the D7 release, both scald_admin_transcoders and scald_admin_actions are dead-code (the db_fetch_array would make them die before any XSS could occur ;-)) ; that doesn't really matter though, because both Action and Transcoder titles aren't user editable, even though they were in the database in D6 (that's no longer the case in D7).
The dashboard does have an XSS issue in the D7 version, fixed in e2804d1 ; there was a matching vulnerability in the D6 version due to fieldset title not being sanitized, fixed in a5a1bca .
Leaving the bug open for now, will check for other vulnerabilities later. In the meantime, I've also pushed 3234880 to explicit the fact that the 'administer scald' permission has security implications.
Comment #2
dave reidYeah keep in mind, that even though you've marked the permission as restrictive, you should still ensure that there is no XSS possible, which you have said you'll be reviewing.
Comment #3
DeFr commentedAlso pushed fff2eb7 to the 6.x-1.x branch, and merged it in the 7.x-1.x branch in d842d7e , to fix for places where the atom type title could be used in the rendering.
(Updated to clarifiy that it was the atom type title and not the atom title that wasn't escaped)
Comment #4
DeFr commentedBy the way, @Dave in #2, the change in hook_permission was more to clarify that the setup of the demo site really should not be replicated when installing the module on a custom site, and that giving it to random users really isn't such a great idea... in addition to enabling users to do kinda dangerous things, like users with the 'administer scald' permission being able to allow any role that has the 'use scald' permission (and that thus shows up in the Actions settings page) to see deleted atoms.
Comment #5
dave reidYeah, agreed! Some maintainers use that restricted permission flag to justify not fixing security issues, so I just wanted to be double sure. Thanks for being quick to respond on this!
Comment #6
DeFr commentedOk, so, I've just commited a few more fixes in the fallbacks used when Views isn't enabled which should plug all the remaining vulnerabilities. To recap'
Thanks for looking at Scald code ! :-)