ROOT ON FIRE Linux, Windows, Tools, Open Source, WWW, Hardware, Security, Monitoring, Networking

21Mrz/100

Buck-Security – Security Checks für Debian & Ubuntu Linux

Uncle Buck Security ist eine Sammlung verschiedener Security Checks für Linux. Es ist auf Debian und Ubuntu Server ausgelegt kann aber auch bei anderen Linux Systemen sehr hilfreich sein.
Das Ziel von Buck Security ist, dass Systemadministratoren und User einen schnellen Überblick über den Security Status ihrer Systeme bekommen.

Folgende Tests sind bereits integriert:
- Suche nach worldwriteable Dateien
- Suche nach worldwriteable Verzeichnissen
- Suche nach Programmen wo das SUID-Bits gesetzt ist
- Suche nach Programmen wo das SGID-Bits gesetzt ist
- Kontrolle der Rechtemaske
- Kontrolle ob das Sticky-Bit für /tmp gesetzt ist
- Suche nach Superuser Konten
- Suche nach installierten ATK's (Attack Tool Kit)

Beispiel:

r-o-f:~/buck-security_0.4# ./buck
###########################
# Uncle Buck Security 0.4 #
###########################

We will run 8 security checks now.
This may take a while...



[*] CHECK 1: Find superusers                         [ OK ]


[*] CHECK 2: Check umask                             [ OK ]


[*] CHECK 3: World Writeable Files                   [ WARNING ]
/var/www/phplogcon/config.php
/var/log/syslog


[*] CHECK 4: World Writeable Directories             [ WARNING ]
/dev/shm
/var/lib/php5


[*] CHECK 5: Files where Setuid is used              [ WARNING ]
/usr/bin/fping6
/usr/bin/fping
/usr/bin/procmail
/usr/bin/at
/usr/sbin/exim4
/usr/lib/eject/dmcrypt-get-device
/usr/lib/nagios/plugins/check_icmp
/sbin/mount.nfs


[*] CHECK 6: Files where Setgid is used              [ WARNING ]
/usr/bin/mlocate
/usr/bin/lockfile
/usr/bin/procmail
/usr/bin/dotlockfile
/usr/bin/at
/usr/bin/mutt_dotlock


[*] CHECK 7: Sticky-Bit set for /tmp                 [ OK ]


[*] CHECK 8: Search attacking tools                  [ WARNING ]
hping3


###########################
###  CHECKS FINISHED  ###
Time taken was 46 seconds

###########################
ATTENTION:
buck-security is still under heavy development, consider this a beta version.
Your feedback it very welcome, please send it to maba4891@users.sourceforge.net
To get help run './buck --help' or visit http://buck-security.sourceforge.net/
###########################

Homepage: http://sourceforge.net/projects/buck-security/

3Dez/090

AFICK (Another File Integrity Checker) – Host IDS

Afick ist ein Open Source Programm, das zur Familie der Host-IDS zu zählen ist, dass Veränderungen und Manipulation in der Filesystem Struktur erkennen kann. Je nach Konfiguration läuft Afick in regelmäßigen Zeitabständen und macht einen Snapshot der definierten Ordner bzw. Dateien, dieser wird dann mit einem vorher erstellten Snapshot verglichen. Bei sensiblen Systemen, macht es Sinn diesen Referenz Snapshot z.B. auf einer extern read-only Flobby Disk zu speichern. Natürlich muss man nach jedem Update, Installation oder Veränderung der Konfiguration einen neuen Referenz Snapshot machen. Je nach Sensibilität und Security Anforderung kann man das Zeitintervall verkürzen. Systeme die mit dem Internet verbunden sind. bzw. sensible Systeme sollten stündlich oder noch öfter überprüft werden. Das in Perl geschriebene AFICK benötigt auch bei größeren File Systemen sehr wenig Ressourcen. Das Entwicklerteam um Eric Gerbier arbeitet an einem Dämon / Service, um die Überprüfung in Echtzeit zu machen.
Afick eignet sich auch hervorragend, wenn man überprüfen will, welche Dateien bestimmte Pakete bei der Installation verändern bzw. erstellen. Dazu macht man einen Snapshot vor der Installation und einen danach, anschließend kann man beide vergleichen und überprüfen.
Afick gibt es für alle gängigen Linux Distributionen und Windows.

Installation unter Debian Lenny

1. Paket downloaden
2. Entpacken
3. Makefile.pl aufrufen und Abhängigkeiten überprüfen
4. Installieren

r-o-f:~# wget http://sourceforge.net/projects/afick/files/afick/2.14-1/afick-2.14-1.tgzc
r-o-f:~# tar xvzf afick-2.14-1.tgz
r-o-f:~# cd ./afick-2.14-1
r-o-f:~/afick-2.14-1# perl Makefile.pl
search required perl modules for afick core (afick.pl) :
  OK : found perl module strict
  OK : found perl module warnings
  OK : found perl module English
  OK : found perl module Pod::Usage
  OK : found perl module Digest::MD5
  OK : found perl module MIME::Base64
  OK : found perl module Fcntl
  OK : found perl module FileHandle
  OK : found perl module Getopt::Long
  OK : found perl module Cwd
  OK : found perl module File::Glob
  OK : found perl module File::Basename
  OK : found perl module constant
  OK : found perl module vars
OK : you can install afick core
----------------------------------------
search required perl modules for afick gui (afick-tk.pl) :
  OK : found perl module Carp
  OK : found perl module Tk
  OK : found perl module Tk::Balloon
  OK : found perl module Tk::Checkbutton
  OK : found perl module Tk::Entry
  OK : found perl module Tk::HList
  OK : found perl module Tk::ItemStyle
  OK : found perl module Tk::LabFrame
  OK : found perl module Tk::Label
  OK : found perl module Tk::ProgressBar
  OK : found perl module Tk::ROText
  OK : found perl module Tk::Text
  OK : found perl module Tk::Tree
  OK : found perl module POSIX
OK : you can install afick gui
----------------------------------------
you can run 'make all' to install afick core and gui

r-o-f:~/afick-2.14-1# make all

Beim ersten Start muss man das File System initialisieren und einen Referenz Snapshot erstellen.
Dazu ruft man Afick einfach mit der Option -i auf.
Die Option -C überprüft die Konfigurationsdatei (default: /etc/afick.conf).

r-o-f:~# afick -C
# config file /etc/afick.conf ok
r-o-f:~# afick -i
# Afick (2.14-1) init at 2009/12/03 21:43:58 with options (/etc/afick.conf):
# database:=/var/lib/afick/afick
# history:=/var/lib/afick/history
# archive:=/var/lib/afick/archive
# report_url:=stdout
# allow_overload:=1
# running_files:=1
# timing:=1
# exclude_suffix:= log LOG html htm HTM txt TXT xml hlp pod chm tmp old bak fon ttf TTF bmp BMP jpg JPG gif png ico wav WAV mp3 avi
# max_checksum_size:=10000000
# dbm:=GDBM_File
# Dangling file : /usr/lib/python2.4/site-packages/python-support.pth


# Hash database created successfully. 10325 files entered.
# #################################################################
# MD5 hash of /var/lib/afick/afick => WJNGxPrGQ2JyHahsDao2zA
# user time : 1.71; system time : 14.06; real time : 42

Eine händische Überprüfung kann man mit -k machen.

r-o-f:~# afick -k
# Afick (2.14-1) compare at 2009/12/03 21:47:03 with options (/etc/afick.conf):
# database:=/var/lib/afick/afick
# history:=/var/lib/afick/history
# archive:=/var/lib/afick/archive
# report_url:=stdout
# allow_overload:=1
# running_files:=1
# timing:=1
# exclude_suffix:= log LOG html htm HTM txt TXT xml hlp pod chm tmp old bak fon ttf TTF bmp BMP jpg JPG gif png ico wav WAV mp3 avi
# max_checksum_size:=10000000
# dbm:=GDBM_File
# last run on 2009/12/03 21:43:58 with afick version 2.14-1
changed file : /etc/nagios/nagios.cfg
changed file : /root/.nano_history


# detailed changes
changed file : /etc/nagios/nagios.cfg
        md5                      : adeba80a78175f852c2c38e55b51d51f     8bd76d59ffcb364a7515171461deb806
        filesize                 : 1989 1999
changed file : /root/.nano_history
        mtime                    : Thu Dec  3 21:41:47 2009     Thu Dec  3 21:47:01 2009
# Dangling file : /usr/lib/python2.4/site-packages/python-support.pth


# Hash database : 10325 files scanned, 2 changed (new : 0; delete : 0; changed : 2; dangling : 1; exclude_suffix : 217; exclude_prefix : 0; exclude_re : 0; degraded : 1)
# #################################################################
# MD5 hash of /var/lib/afick/afick => WJNGxPrGQ2JyHahsDao2zA
# user time : 2.02; system time : 6.24; real time : 10

Fazit: Afick ist ein ressourcensparendes Tool, dass die Sicherheit eines Systems ohne großen Konfigurationsaufwand deutlich erhöht und hilft, Einbrüche und Manipulationsversuche schnell zu erkennen.

Quelle: http://afick.sourceforge.net/