PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Proftpd Debian



linuxjohnny
18.04.09, 15:28
Hi,

Ich habe da ein grosses bzw. sehr grosses Problem :rolleyes: und zwar haben wir einen root Server, auf dem unter anderem Proftpd in der Version 1.3.0 läuft, das System ist Debian etch. Leider wurde unser Server gehackt und wir haben herausgefunden das die Lücke in Proftpd genutzt wurde sprich eine SQL Iniection.
Jetzt wollen wir natürlich so schnell wie möglich auf die neu Version updaten, nur das Problem ist Debian stellt diese neuen Pakete nicht zur Verfügung, da habe ich mir gedacht das ich mir die Pakete von Sid manuell herunterlade, dann die alten deinstalliere und die neuen wieder drauf. Leider funktioniert dies nicht, weil anscheinend nicht die richtige Version von libc6 installiert ist.
Und ich weiss nicht wenn ich dann auch noch die neue libc6 installiere ob das nicht noch mehr Abhängigkeiten mit sich bringt und ein Ratenschwanz wird.
Ich habe mir auch schon überlegt die stable Quellen in der source.list durch die von sid auszutauschen, ich weiss dann aber nicht ob das System danach auch noch zuverlässig funktioniert.

Könnt ihr mir vielleicht helfen wie ich den Zustand lössen könnte?

MFG
Kevin Haag

HirschHeisseIch
18.04.09, 15:42
Apt-pinning?
Oder 1.3.1-17 aus den Backports installieren?

marce
18.04.09, 16:11
Das beste wäre wohl eher, bei Debian ein Bugreport zu erstellen damit die Lücke dort gefixed wird.

Wobei die Fehlerbeschreibung "SQL-Injection in Verbindung mit proftpd" etwas komisch klingt - könntest Du das etwas genauer ausführen?

linuxjohnny
18.04.09, 16:17
Besten Dank für deine schnelle Antwort!!

Hmm mit Apt-Pinning, kann ich mich irgendwie nicht so anfreunden weil ich mir nicht sicher bin was alles instelliert wird wenn ich dann mit apt-get -t sid installiere aber wenn dies der einzige Weg ist.

Und aus den Backports ist das Problem das neueste Release ist dort ja 1.3.1 aber das neueste von der offiziellen Seite 1.3.2.

Aber wieso um alle Welt, kann Debian die Pakete nicht schneller auf stable setzen, ich meine es gibt doch tausende root Server die mit Debian laufen und diese sollten doch immer auf dem aktuellsten stand sein, wie machen die denn das?

MFG
Kevin Haag

linuxjohnny
18.04.09, 16:18
@marce
Sorry ich habe vergessen euch mit zuteilen das noch die Erweiterung proftpd-mysql installiert ist um die Kunden Login aus der MySQL Datenbank zu lesen.
[EDIT]Der Angreifer konnte durch eine Lücke eine SQL Injection ausführen und damit ein cgi Script auf den Server bringen, das tausende SPAM Mails verschickte, was zur folge hatte das wir auf mehreren Blacklists landeten. Wir mussten nun alle Blacklist Betreiber auffordern, damit diese uns wieder von der Liste löschen, leider hat es noch ein Betreiber bei dem der Vorgang eine ganze Woche dauert, sprich wir können uns nun nicht mehr sicher sein ob alle Mails die die Kunden verschicken dann auch ankommen.

marce
18.04.09, 16:27
.. und ich bin mir recht sicher, daß alle bekannten Bugs von proftp auf die Debian-Version zurückportiert wurden und die von Deb. verwendete Version genau so sicher ist die wie aktuelle...

Neuer heißt auch nicht zwangsweise sicherer.

Ich unterstelle mal frech: wenn der Einbruch dadurch zustandekam - liegt das eher einer fehlerhaften Konfiguration als an einem Bug im Proftp...
Deine Fehlerbeschreibung lässt übrigens wirklich darauf schließen, daß es nicht die Schuld von Proftp / MySQL ist...


Aber wieso um alle Welt, kann Debian die Pakete nicht schneller auf stable setzen, ich meine es gibt doch tausende root Server die mit Debian laufen und diese sollten doch immer auf dem aktuellsten stand sein, wie machen die denn das?
Du hast die Idee von Releasezyklen der meisten Distributionen noch nicht verstanden.

linuxjohnny
18.04.09, 16:38
http://www.heise.de/security/SQL-Injection-Luecke-in-ProFTPD-geschlossen--/news/meldung/132413

http://www.shukko.com/x3/2009/02/25/checkcgi-hnccgi-cgi/

Darum glaube ich nicht das es an einer Fehlkonfiguration gelegen hat ;)

marce
18.04.09, 16:47
Sorry, hab's gerade selbst gefunden - scheint auch so, wie wenn die Lücke in Etch noch nicht gefixed ist...

War ich wohl ein bisschen zu vorlaut.

edit: eigentlich mal wieder echt peinlich für die "Sicherheitsdistribution Nr. 1" aus den guten, alten Tagen...

linuxjohnny
18.04.09, 17:42
Ja denn bis jetzt habe ich eben auch nur positive erfahrungen mit Debian gemacht.
Aber soll ich jetzt das mit dem Apt-Pinning machen?

linuxjohnny
18.04.09, 19:32
Habe mal ein Bugreport erstellt, aber erst nachher gesehen das ja schon einer vorhanden ist. :o

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524646

HirschHeisseIch
18.04.09, 20:28
The oldstable distribution (etch) is not affected by these problems.

For the stable distribution (lenny), these problems have been fixed in version 1.3.1-17lenny2.

For the testing distribution (squeeze), these problems will be fixed soon.

For the unstable distribution (sid), these problems have been fixed in version 1.3.2-1.

Demnach sähe es fast so aus, als stimme was mit eurem etch-proftpd nicht...

Wie dem auch sei, sollte die Lücke ja im 1.3.1-17lenny2-Paket, welches Du als Backport einspielen könntest, geschlossen sein.

linuxjohnny
18.04.09, 20:31
Das mit dem 1.3.1 bist du dir 100% sicher, dass das dort schon gefixxt ist?

HirschHeisseIch
18.04.09, 20:32
Das mit dem 1.3.1 bist du dir 100% sicher, dass das dort schon gefixxt ist?

Sofern man security.debian.org glauben schenken darf: Ja.

linuxjohnny
18.04.09, 21:17
Ok, dann wird das schon so sein.
Ich hoffe aber das bald die Version 1.3.2 im stable erscheint. Was meint ihr wie lange es geht?

Jetzt habe ich ein Problemchen mit der Konfig. die ist ja um einiges anders als die alte, wenn ich die neue mit den alten Einstellungen anpasse also das pw der datenbank die user und so, funktioniert ein Login leider nicht.
Ich poste nun mal die Config's vielleicht wisst ihr ja wie ich die abändern muss, dass das System wieder zum Laufen kommt. Ich probier nun schon ewig :confused::ugly:

old modules.conf:

#
# This file is used to manage DSO modules and features.
#

# This is the directory where DSO modules resides

ModulePath /usr/lib/proftpd

# Allow only user root to load and unload modules, but allow everyone
# to see which modules have been loaded

ModuleControlsACLs insmod,rmmod allow user root
ModuleControlsACLs lsmod allow user *

#LoadModule mod_ctrls_admin.c
LoadModule mod_tls.c
LoadModule mod_sql.c
LoadModule mod_ldap.c
LoadModule mod_sql_mysql.c
#LoadModule mod_sql_postgres.c
LoadModule mod_quotatab.c
LoadModule mod_quotatab_file.c
LoadModule mod_quotatab_ldap.c
LoadModule mod_quotatab_sql.c
LoadModule mod_radius.c
LoadModule mod_wrap.c
LoadModule mod_rewrite.c

# keep this module the last one
LoadModule mod_ifsession.c

<IfModule mod_delay.c>
DelayEngine off
</IfModule>old proftpd.conf:

Include /etc/proftpd/modules.conf

ServerName "ip FTP Server"
ServerType standalone
DeferWelcome off

MultilineRFC2228 on
DefaultServer on
ShowSymlinks on
AllowOverwrite on

TimeoutNoTransfer 600
TimeoutStalled 600
TimeoutIdle 1200

DisplayLogin welcome.msg
DisplayFirstChdir .message
ListOptions "-l"

DenyFilter \*.*/

Port 21
MaxInstances 30

TransferLog /var/log/proftpd/xferlog
SystemLog /var/log/proftpd/proftpd.log

# Set the user and group that the server normally runs at.
User nobody
Group nogroup

<Directory /*>
# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask 022 022
# Normally, we want files to be overwriteable.
AllowOverwrite on
</Directory>

DefaultRoot ~
RequireValidShell off

AuthOrder mod_sql.c

SQLAuthTypes Crypt
SQLAuthenticate users* groups*
SQLConnectInfo syscp@127.0.0.1 syscp MYSQL_PASSWORD
SQLUserInfo ftp_users username password uid gid homedir shell
SQLGroupInfo ftp_groups groupname gid members
SQLUserWhereClause "login_enabled = 'y'"

SQLLog PASS login
SQLNamedQuery login UPDATE "last_login=now(), login_count=login_count+1 WHERE username='%u'" ftp_users

SQLLog RETR download
SQLNamedQuery download UPDATE "down_count=down_count+1, down_bytes=down_bytes+%b WHERE username='%u'" ftp_users

SQLLog STOR upload
SQLNamedQuery upload UPDATE "up_count=up_count+1, up_bytes=up_bytes+%b WHERE username='%u'" ftp_usersneu modules.conf

#
# This file is used to manage DSO modules and features.
#

# This is the directory where DSO modules reside

ModulePath /usr/lib/proftpd

# Allow only user root to load and unload modules, but allow everyone
# to see which modules have been loaded

ModuleControlsACLs insmod,rmmod allow user root
ModuleControlsACLs lsmod allow user *

LoadModule mod_ctrls_admin.c
LoadModule mod_tls.c

# Install proftpd-mod-mysql or proftpd-mod-pgsql to use this
LoadModule mod_sql.c

# Install proftpd-mod-ldap to use this
#LoadModule mod_ldap.c

#
# 'SQLBackend mysql' or 'SQLBackend postgres' directives are required
# to have SQL authorization working. You can also comment out the
# unused module here, in alternative.
#

# Install proftpd-mod-mysql to use this
LoadModule mod_sql_mysql.c

# Install proftpd-mod-pgsql to use this
#LoadModule mod_sql_postgres.c

LoadModule mod_radius.c
LoadModule mod_quotatab.c
LoadModule mod_quotatab_file.c

# Install proftpd-mod-ldap to use this
#LoadModule mod_quotatab_ldap.c

# Install proftpd-mod-pgsql or proftpd-mod-mysql to use this
#LoadModule mod_quotatab_sql.c
LoadModule mod_quotatab_radius.c
LoadModule mod_wrap.c
LoadModule mod_rewrite.c
LoadModule mod_load.c
LoadModule mod_ban.c
LoadModule mod_wrap2.c
LoadModule mod_wrap2_file.c
# Install proftpd-mod-pgsql or proftpd-mod-mysql to use this
#LoadModule mod_wrap2_sql.c
LoadModule mod_dynmasq.c


# keep this module the last one
LoadModule mod_ifsession.c

neu proftpd.conf:

#
# /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
# To really apply changes reload proftpd after modifications.
#

# Includes DSO modules
Include /etc/proftpd/modules.conf

# Set off to disable IPv6 support which is annoying on IPv4 only boxes.
UseIPv6 on
# If set on you can experience a longer connection delay in many cases.
IdentLookups off

ServerName "Debian"
ServerType standalone
DeferWelcome off

MultilineRFC2228 on
DefaultServer on
ShowSymlinks on

TimeoutNoTransfer 600
TimeoutStalled 600
TimeoutIdle 1200

DisplayLogin welcome.msg
DisplayChdir .message true
ListOptions "-l"

DenyFilter \*.*/

# Use this to jail all users in their homes
# DefaultRoot ~

# Users require a valid shell listed in /etc/shells to login.
# Use this directive to release that constrain.
# RequireValidShell off

# Port 21 is the standard FTP port.
Port 21

# In some cases you have to specify passive ports range to by-pass
# firewall limitations. Ephemeral ports can be used for that, but
# feel free to use a more narrow range.
# PassivePorts 49152 65534

# If your host was NATted, this option is useful in order to
# allow passive tranfers to work. You have to use your public
# address and opening the passive ports used on your firewall as well.
# MasqueradeAddress 1.2.3.4

# This is useful for masquerading address with dynamic IPs:
# refresh any configured MasqueradeAddress directives every 8 hours
<IfModule mod_dynmasq.c>
# DynMasqRefresh 28800
</IfModule>

# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances 30

# Set the user and group that the server normally runs at.
User nobody
Group nogroup

# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask 022 022
# Normally, we want files to be overwriteable.
AllowOverwrite on

# Uncomment this if you are using NIS or LDAP via NSS to retrieve passwords:
# PersistentPasswd off

# This is required to use both PAM-based authentication and local passwords
# AuthOrder mod_auth_pam.c* mod_auth_unix.c

# Be warned: use of this directive impacts CPU average load!
# Uncomment this if you like to see progress and transfer rate with ftpwho
# in downloads. That is not needed for uploads rates.
#
#UseSendFile off

TransferLog /var/log/proftpd/xferlog
SystemLog /var/log/proftpd/proftpd.log

<IfModule mod_quotatab.c>
QuotaEngine off
</IfModule>

<IfModule mod_ratio.c>
Ratios off
</IfModule>


# Delay engine reduces impact of the so-called Timing Attack described in
# http://security.lss.hr/index.php?page=details&ID=LSS-2004-10-02
# It is on by default.
<IfModule mod_delay.c>
DelayEngine on
</IfModule>

<IfModule mod_ctrls.c>
ControlsEngine off
ControlsMaxClients 2
ControlsLog /var/log/proftpd/controls.log
ControlsInterval 5
ControlsSocket /var/run/proftpd/proftpd.sock
</IfModule>

<IfModule mod_ctrls_admin.c>
AdminControlsEngine off
</IfModule>

#
# Alternative authentication frameworks
#
#Include /etc/proftpd/ldap.conf
Include /etc/proftpd/sql.conf

#
# This is used for FTPS connections
#
#Include /etc/proftpd/tls.conf

# A basic anonymous configuration, no upload directories.

# <Anonymous ~ftp>
# User ftp
# Group nogroup
# # We want clients to be able to login with "anonymous" as well as "ftp"
# UserAlias anonymous ftp
# # Cosmetic changes, all files belongs to ftp user
# DirFakeUser on ftp
# DirFakeGroup on ftp
#
# RequireValidShell off
#
# # Limit the maximum number of anonymous logins
# MaxClients 10
#
# # We want 'welcome.msg' displayed at login, and '.message' displayed
# # in each newly chdired directory.
# DisplayLogin welcome.msg
# DisplayChdir .message
#
# # Limit WRITE everywhere in the anonymous chroot
# <Directory *>
# <Limit WRITE>
# DenyAll
# </Limit>
# </Directory>
#
# # Uncomment this if you're brave.
# # <Directory incoming>
# # # Umask 022 is a good standard umask to prevent new files and dirs
# # # (second parm) from being group and world writable.
# # Umask 022 022
# # <Limit READ WRITE>
# # DenyAll
# # </Limit>
# # <Limit STOR>
# # AllowAll
# # </Limit>
# # </Directory>
#
# </Anonymous>
neu sql.conf:

#
# Proftpd sample configuration for SQL-based authentication.
#
# (This is not to be used if you prefer a PAM-based SQL authentication)
#

<IfModule mod_sql.c>
#
# Choose a SQL backend among MySQL or PostgreSQL.
# Both modules are loaded in default configuration, so you have to specify the backend
# or comment out the unused module in /etc/proftpd/modules.conf.
# Use 'mysql' or 'postgres' as possible values.
#
SQLBackend mysql
#
SQLEngine on
SQLAuthenticate users* groups*
#
# Use both a crypted or plaintext password
SQLAuthTypes Crypt Plaintext
#
# Use a backend-crypted or a crypted password
#SQLAuthTypes Backend Crypt
#
# Connection
SQLConnectInfo syscp@127.0.0.1 syscp MYSQL_PASSWORD
#
# Describes both users/groups tables
#
SQLUserInfo ftp_users username password uid gid homedir shell
SQLGroupInfo ftp_groups groupname gid members
#
</IfModule>
In der alten Konfig hat es noch einige SQL Abfragen drinen, ich denke aber nicht das diese notwendig sind, da sie z.B. "nur" testen ob ein User Login berechtigungen hat.
Darum dachte ich mir das ich die Abfragen erst mal draussen lasse bis es läuft, kann sie ja dann später wieder einfügen.

linuxjohnny
18.04.09, 21:22
Jetzt hat sich die ganze Mühe des vorherigen Threads nicht einmal gelohnt :D Habe den Fehler gefunden, es war die Option:

RequireValidShell offDie muss Off sein, weil die Shell in der DB auf /bin/false gsetzt ist

Jigsore
18.04.09, 21:27
Nutze die Zeit sinnvoll und arbeite Dich in Pure- oder vsFTPd ein.

Alles andere als ein konstruktiver Betrag, aber die Reihe von Sicherheitslücken in ProFTPd sprechen für sich.

linuxjohnny
18.04.09, 21:32
Ja Privat verwende ich vsftpd ebenfalls mit MySQL Backend funktioniert einwandfrei, und ich habe auch das Gehfühl das der Login Prozess schneller ist.
Wir werden in der nächsten Zeit umstellen, das Problem war nur, das wir die Kunden nicht einfach auf Ihren FTP Server verzichten lassen konnten, und darum auch die ganze Geschichte mit dem Update;)

Rain_maker
21.04.09, 10:11
Ok, dann wird das schon so sein.
Ich hoffe aber das bald die Version 1.3.2 im stable erscheint. Was meint ihr wie lange es geht?

So lange, bis das derzeitige "testing" zu "stable wird, im derzeitigen "stable" (und das wäre Lenny und nicht Etch, das aber nur nebenbei) wird das nicht passieren.

HirschHeisseIch
21.04.09, 10:52
Gaaaanz eventuell auch mit Lenny-n-Half... Würd mich aber überraschen, wenn da das Proftpd-Paket aktualisiert wird...

pferdefreund
21.04.09, 11:18
Wie wärs denn mit Erstellen aus den Sourcen, wenns unbedingt das neueste
sein soll - Da hat man dann keine libc6-Probleme (im Regelfall).

Ich bin Weidechef - ich darf das