If you change your site name to: " onClick="alert(1); and then click on the logo on the hompage you will get an alert. This issue can be discussed publicly because sitename is something that can only be set by users with the "administer site configuration" which is on the list of permissions that can take over your site http://drupal.org/security-advisory-policy

Here's the line:

$vars['logo_img'] = $vars['logo'] ? '<img src="' . $vars['logo'] . '" alt="' . $vars['site_name'] . '" id="logo" />' : '';

I think switching to theme_image for that should fix the xss and maybe have other benefits: http://api.drupal.org/api/drupal/includes!theme.inc/function/theme_image/7

Comments

IcanDivideBy0’s picture

Status: Active » Needs review
StatusFileSize
new884 bytes

Here's the patch

IcanDivideBy0’s picture

Forgot the id="logo" attribute...

Status: Needs review » Needs work

The last submitted patch, xss_logo_switch_to_theme_image-1540172-2.patch, failed testing.

greggles’s picture

Version: 7.x-3.0 » 7.x-3.x-dev

The patch doesn't apply for me either, but I'm not sure why.

Visually the change looks right.

IcanDivideBy0’s picture

Status: Needs work » Needs review
greggles’s picture

Title: xss via site name - switch to theme_image? » use theme_image to output the site logo

The xss was fixed with the addition of check_plain in #1395848: Escape site_name in Logo image alt / title text (though the issue doesn't mention the motivation for it). So, anyone who tried to replicate the original issue I posted would be unable to do that on a recent -dev version.

This is no longer about the xss but just about whether or not it's appropriate to use theme_image there. As far as I can tell this patch is a good idea and it keeps out the xss.

I won't RTBC this b/c there may be some reason it doesn't use theme_image but from my perspective it is RTBC.

cellar door’s picture

Assigned: Unassigned » himerus

Himerus - Good for a 3.2 inclusion?