/ Bug 3519 – Inappropriate directory traversal allowed by mod_site_misc
Bug 3519 - Inappropriate directory traversal allowed by mod_site_misc
: Inappropriate directory traversal allowed by mod_site_misc
Status: CLOSED FIXED
Product: ProFTPD
mod_site_misc
: 1.3.3
: All All
: P2 major
Assigned To: proftpd development group
:
:
:
:
  Show dependency treegraph
 
Reported: 2010-10-21 18:30 UTC by TJ Saunders
Modified: 2010-12-18 12:50 UTC (History)
4 users (show)

See Also:


Attachments
Fixes bug (3.72 KB, patch)
2010-10-21 18:34 UTC, TJ Saunders
Details
Updates previous patch, fixing directory walking code to deal with canonicalized paths (4.64 KB, patch)
2010-10-21 19:55 UTC, TJ Saunders
Details

Note You need to log in before you can comment on or make changes to this bug.
Description TJ Saunders 2010-10-21 18:30:46 UTC
This bug report was provided by an anonymous researcher working with SecuriTeam
Secure Disclosure program.

Synthesis
---------

ProFTPd is a major Open Source FTP server:
  http://www.proftpd.org/
ProFTPd is for example used by ftp.apple.com, ftp.openssl.org
and ftp.rsa.com.

When ProFTPd is compiled with mod_site_misc and when a directory is
writable, an attacker can use mod_site_misc to:
 - create a directory located outside the writable directory
 - delete a directory located outside the writable directory
 - create a symlink located outside the writable directory
 - change the time of a file located outside the writable directory

Vulnerable configuration
------------------------

The following configuration is vulnerable:
 - ProFTPd version range 1.3.0a (2006) to 1.3.3b (latest version)
 - AND with the mod_site_misc module (not enabled by default in ProFTPd)
 - AND with a writable directory (ProFTPd has no default writable
   directory)

The mod_site_misc module provides the following FTP commands:
(http://www.proftpd.org/docs/contrib/mod_site_misc.html)
 - SITE MKDIR : create a directory
 - SITE RMDIR : delete a directory
 - SITE SYMLINK : create a symbolic link
 - SITE UTIME : change the time of a file
This module is provided with ProFTPd source code, but it is not
enabled by default.

The ProFTPd configuration file (etc/proftpd.conf) can contain
"Limit WRITE" sections to allow/deny users to write inside a
directory. For example:
  <Anonymous ~ftp>
    ...
    # Limit WRITE everywhere in the anonymous chroot.
    <Limit WRITE>
      DenyAll
    </Limit>
    # Allow WRITE in this directory only.
    <Directory writableDir>
      <Limit WRITE>
        AllowAll
      </Limit>
    </Directory>
  </Anonymous>
The default ProFTPd configuration does not contain a writable
directory.

Effects
---------
So, this vulnerability can be used to:
 - create a directory located outside the writable directory
 - delete a directory located outside the writable directory
 - create a symlink located outside the writable directory
 - change the time of a file located outside the writable directory
Comment 1 TJ Saunders 2010-10-21 18:34:14 UTC
Created attachment 3431 [details]
Fixes bug
Comment 2 TJ Saunders 2010-10-21 19:55:59 UTC
Created attachment 3432 [details]
Updates previous patch, fixing directory walking code to deal with
canonicalized paths

With the fixing of the issue by canonicalizing paths, the code which walked a
MKDIR directory needed to be updated to assume the now-canonicalized path,
rather than assuming a relative path.
Comment 3 TJ Saunders 2010-10-21 20:07:52 UTC
Patch committed to CVS, with accompanying regression tests.  Backported to
1.3.3 branch.
Comment 4 TJ Saunders 2010-10-21 20:55:23 UTC
I should add that there is a workaround configuration that can be used, to
mitigate the buggy behavior until a patched mod_site_misc can be deployed:

  <Limit SITE_MKDIR SITE_RMDIR SITE_SYMLINK SITE_UTIME>
    DenyAll
  </Limit>

will deny the use of any of the problematic commands.
Comment 5 TJ Saunders 2010-10-29 18:54:50 UTC
The vulnerability in question was present when mod_site_misc first appeared in
the proftpd distribution, which was version 1.2.10rc1.
Comment 6 TJ Saunders 2010-11-17 13:55:15 UTC
For future reference, the CVE for this vulnerability is:

  http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-3867
Comment 7 TJ Saunders 2010-12-18 12:50:31 UTC
Resolved in 1.3.4rc1.