Closed (outdated)
Project:
Security Review
Version:
6.x-1.x-dev
Component:
Miscellaneous
Priority:
Major
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
29 Mar 2013 at 03:42 UTC
Updated:
5 Nov 2022 at 23:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
coltraneYou should review the file ownership and permissions of those files as compared to the users and webserver user of your host. For example, if your webuser is "www-user" and those files and directories are owned and writeable by that user then that could allow an attacker to write arbitrary files or code to those locations. To fix you might chmod or chown those file or directories. You may also need to review your host's documentation on webroot file and directories for details on how to change the permissions.
Setting this issue to "postponed" for more questions.
Comment #2
gandro_spam commentedComment #3
techman-1 commentedColtrain, I appreciate your response.
I went through some of those files, did a ls -l command
and found that the root user is shown as the owner and the root user is also show as the group that owns this file.
I'm not sure what other commands I need to execute to determine if my web server (web user) has permission
to write to these files.
Comment #4
mgiffordFind out the apache user or
<?php echo shell_exec('whoami'); ?>.This should be fine as in CentOS apache is run by nobody and needs write access to the files/ directory for caching and file uploads. Drupal.org recommends something like:
In debian/ubuntu www-user would the the user that should own the directory.
Now this isn't what youd' get from:
chmod 2775 sites/default/files
But that's not going to give you the permissions described in the drupal.org page listed above.
What specifically is Security Review looking for? Some write permissions are usually required for Drupal sites, for caching if nothing else.
Would be good if the error message was clearer indicating exactly what should be done to improve the security of the files directory.
Comment #5
coltraneHere is what this check is doing http://drupalcode.org/project/security_review.git/blob/refs/heads/7.x-1.... and specifically http://drupalcode.org/project/security_review.git/blob/refs/heads/7.x-1..... In brief, it's looking for all files and directories that are writable with the exception of Drupal's files and private files directory and many VCS directories.
I do believe the messaging could be more clear, but it's difficult to write out what exactly should be done because those steps vary depending on the specifics of the web server. I welcome review of the current documentation and ideas to make it more helpful to more people.
Comment #6
mgiffordHere's a patch to at least take a hack at being much more explicit in the failure messages.
Definitely a challenge with Windows/Linux. But really, the default is Linux, so I don't see why we can't give a chmod and include a link to the docs for more information.
Feel free to rip up the proposal. I did it quickly and it definitely needs to be cleaned up and standardized.
Comment #8
coltraneThanks @mgifford! I think the tests failed only because the success/fail text is tested for, so the .test file would have been updated.
I feel strongly that mitigation recommendations are best explained on the individual help pages rather than within the failure strings. For some checks it's necessary to set some context and expectations before suggesting one course of action or another. I do think the text of the help pages could use work and even the individual success/failure strings could be improved, but I'd like to keep the result separate from the action of fixing. What do you think of that?
Here's a new patch which adds some of your text to the security_review_check_file_perms_help() function and holds onto the text added within the module writtten files.
Comment #9
mgiffordLooks good to me. Thanks!
Comment #10
coltraneCommitted. Thanks! http://drupalcode.org/project/security_review.git/commit/d00f853
Comment #12
smustgrave commentedAs Drupal6 has been EOL https://www.drupal.org/about/drupal6-eol closing as outdated