Bug 400921 - OOPS: reading non-root config file
Summary: OOPS: reading non-root config file
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: vsftpd
Version: 5.0
Hardware: All
OS: Linux
low
high
Target Milestone: ---
: ---
Assignee: Martin Nagy
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-11-27 13:09 UTC by Luigi Iotti
Modified: 2016-07-26 23:46 UTC (History)
1 user (show)

Fixed In Version: RHSA-2008-0295
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-05-21 14:16:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
CVS patch (4.23 KB, patch)
2007-11-28 10:19 UTC, Martin Nagy
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2008:0295 0 normal SHIPPED_LIVE Low: vsftpd security and bug fix update 2008-05-21 14:16:37 UTC

Description Luigi Iotti 2007-11-27 13:09:48 UTC
Description of problem:
Thi is basically the re-edition on RHEL5 of bug# 241725.
when specifying the 'user_config_dir' directive in vsftpd.conf, vsftpd will fail
when there is no user config file in the specified directory.

Version-Release number of selected component (if applicable):
vsftpd-2.0.5-10.el5

How reproducible:
almost always (see description below)


Steps to Reproduce:
1. install vsftpd
2. add line to vsftpd.conf: user_config_dir=/etc/vsftpd/user_conf
3. login as a local or anonymous user without creating a config file for the user
  
Actual results:
500 OOPS: reading non-root config file

Expected results:
should be able to login even when user config file for a specific user doesn't 
exist (i.e. user config files should not be mandatory for all users when enabled)

Additional info:
touch a file in user_config_dir with the name of the ftp user to workaround this
issue
In twoprocess.c, we have the lines of code:
  retval = str_stat(&filename_str, &p_statbuf);
  /* Security - die unless owned by root */
  if (!vsf_sysutil_retval_is_error(retval) &&
      vsf_sysutil_statbuf_get_uid(p_statbuf) == VSFTP_ROOT_UID)
  {
    vsf_parseconf_load_file(str_getbuf(&filename_str), 1);
  }
  else if (vsf_sysutil_statbuf_get_uid(p_statbuf) != VSFTP_ROOT_UID)
  {
    die("reading non-root config file");
  }

If the file does not exist, the "else if" branch is taken and the test if
(vsf_sysutil_statbuf_get_uid(p_statbuf) != VSFTP_ROOT_UID) is performed. But
when the file does not exist, the whole structure pointed by p_statbuf has
uncertain content. I think that the value of retval should be again chacked, to
be sure that we're referring to a struct with valid data in it: comparing the
UID of a non-existent file is a nonsense.
When I make tests, most of the time ftp access fails, but sometimes it does not.
I think this is due to the fact that when the user config file does not exist,
p_statbuf points to random data, so sometimes the test yelds true.
I think that the above code should be something like (please review the code):

  retval = str_stat(&filename_str, &p_statbuf);
  /* Security - die unless owned by root */
  if (!vsf_sysutil_retval_is_error(retval))
  {
    if (vsf_sysutil_statbuf_get_uid(p_statbuf) == VSFTP_ROOT_UID)
    {
      vsf_parseconf_load_file(str_getbuf(&filename_str), 1);
    }
    else
    {
      die("reading non-root config file");
    }
  }

Comment 1 Martin Nagy 2007-11-28 10:19:18 UTC
Created attachment 271151 [details]
CVS patch

Thanks Luigi, I reviewed your code and you are right.

Comment 2 RHEL Program Management 2007-12-03 20:48:04 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release.  This request will
be reviewed for a future Red Hat Enterprise Linux release.

Comment 3 Martin Nagy 2007-12-04 12:31:59 UTC
Fixed in fedora/rawhide (vsftpd-2.0.5-21.fc9).

Comment 4 Martin Nagy 2007-12-06 20:40:17 UTC
Re-proposing for 5.2 since vsftpd was approved for 5.2.

Comment 5 RHEL Program Management 2007-12-06 20:45:39 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release.  This request will
be reviewed for a future Red Hat Enterprise Linux release.

Comment 6 Nalin Dahyabhai 2007-12-06 20:56:48 UTC
Re-proposing again, because vsftpd _is_ on the list of things we plan to update.

Comment 7 RHEL Program Management 2007-12-06 21:04:32 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release.  This request will
be reviewed for a future Red Hat Enterprise Linux release.

Comment 8 RHEL Program Management 2007-12-07 15:34:21 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 10 Martin Nagy 2007-12-12 07:54:34 UTC
This issue will be fixed in: vsftpd-2.0.5-10.el5

Comment 11 Martin Nagy 2007-12-12 10:08:55 UTC
Correction:
This will be fixed in vsftpd-2.0.5-11.el5

Comment 15 errata-xmlrpc 2008-05-21 14:16:56 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2008-0295.html



Note You need to log in before you can comment on or make changes to this bug.