XSS on node edit form

bjaspan - June 10, 2008 - 02:07
Project:Drupal
Version:7.x-dev
Component:node system
Category:bug report
Priority:critical
Assigned:bjaspan
Status:closed
Description

This bug was fixed by a previous D6 SA and never exited in D5, but has not yet been fixed in HEAD. To reproduce:

1. Create a node whose title is "alert('xss')" (use actual < and > chars, not the HTML entities).
2. Save the node.
3. Click Edit. Observe the JS popup.

The culprit:

<?php
function node_page_edit($node) {
 
drupal_set_title($node->title);
  return
drupal_get_form($node->type .'_node_form', $node);
}
?>

Contrast with D6's, which calls check_plain($node->title).

Patch attached. We need a test case for this; I haven't written one yet.

AttachmentSize
node-title-xss.patch2.94 KB

#1

lilou - June 10, 2008 - 02:14

Delete modules/node/node.install diff ;-)

AttachmentSize
node-title-xss_1.patch 656 bytes

#2

pwolanin - June 10, 2008 - 02:15

can we mark as duplicate to: http://drupal.org/node/242873 ?

#3

dww - June 10, 2008 - 06:29
Status:needs review» duplicate

Yes. ;) #242873: make drupal_set_title() use check_plain() by default. is the better solution to this problem.

#4

bjaspan - June 10, 2008 - 13:16
Status:duplicate» needs review

#1: Ooops, sorry about those node.install changes. That's a glimpse into the automated XSS detection approach I was toying with that revealed this bug.

#2: We can mark this a duplicate of #242873 if and only if that issue gets changed from "feature request, normal priority" to "bug report, critical priority" because this issue is an XSS security vulnerability. It is simpler just to fix this bug now by adding in the check_plain(), matching the current API, and then removing it in the patch for #242873 if/when that patch gets committed.

#5

bjaspan - June 10, 2008 - 14:00
Priority:normal» critical
Assigned to:Anonymous» bjaspan

#6

flobruit - June 10, 2008 - 14:44

Same patch with a test case added.

AttachmentSize
node-title-xss-268706-6.patch 2.49 KB

#7

bjaspan - June 10, 2008 - 15:46
Status:needs review» reviewed & tested by the community

flobruit: Thank you!

#8

catch - August 14, 2008 - 16:24

Still applies.

#9

lilou - August 24, 2008 - 02:49

Need to be re-rolled.

AttachmentSize
node-title-xss-268706-7.patch 2.77 KB

#10

Dries - August 30, 2008 - 13:09
Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks all, and sorry for the delay.

#11

Anonymous (not verified) - September 13, 2008 - 13:12
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.