access bypass for files attached to restricted nodes

pwolanin - October 10, 2008 - 00:54
Project:Drupal
Version:7.x-dev
Component:upload.module
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

In the Drupal 6 version, the check against Node Access was dropped in the implementation of hook_file_download.
That's a problem. Provided a user can 'view uploaded files' (has that permission), he can download any file attached to any node, including the files attached to nodes that are unpublished or to which he has no 'view' access, provided of course that he has the links to these files.

D6 and D7 patches were from Damien Tournoud. The D6 version went into 6.4 as part of the security patch.

however, slightly different fixes proposed at: http://drupal.org/node/247095

#1

pwolanin - October 10, 2008 - 01:23
Status:active» needs review

here's the 6.4 diff for upload module:
http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/upload/upload.modu...

attached patch syncs 7.x with 6.x for function upload_file_download($filepath)

AttachmentSize
upload_file_download-319341-1.patch 1.34 KB

#2

pwolanin - October 10, 2008 - 01:26

however:

The way that the node_access('view', $node)-check was added to upload_file_download broke a feature that previously was possible using the {upload}-table: to have the same file attached to multiple nodes. The bug only appears if these nodes are under different access control, and probabily only if the {upload}-table has been modified by another mdule than Upload module itself.

see: http://drupal.org/node/295586

maybe that should continue to be a feature request after the basic security hole is patched.

#3

webchick - October 11, 2008 - 03:04
Status:needs review» fixed

Committed. Thanks!

#4

Anonymous (not verified) - October 25, 2008 - 03:24
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.