SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Analyse eines gehackten
Webservers unter Linux
12.11.2010 – IT-SecX 1Dipl.-Ing. (FH) Georg Höllrigl
Portrait
• Georg Höllrigl
• HTL St. Pölten - Elektronik / Technische
Informatik
• 8 Jahre Erfahrung als Systemadministrator
• FH Mittweida – Informationstechnik
• GmbH
• Technischer Dienstleister, Domainverwaltung,
Rechenzentrum in Wien und Amsterdam
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 2
Gliederung
• Problemerkennung
• Alarmierung: rkhunter und chkrootkit
• Tools: lsof, strings, strace
• Was hat der Hacker alles am Server angestellt
• Was ist in den Logfiles zu finden?
• Wie wurde der Service wieder hergestellt?
• Neuinstallation
12.11.2010 – IT-SecX 3Dipl.-Ing. (FH) Georg Höllrigl
Problemerkennung
• Wie?
• Andauernde CPU Auslastung
• Festplatte voll
• Apache restart: port already in use
• rkhunter oder chkrootkit Alarmierung
• Beschwerde von Dritten
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 4
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 5
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 6
rkhunter / chkrootkit
Found string 'fucknut' in file '/sbin/ttymon'. Possible
rootkit: SHV5 Rootkit
Found string 'lamersucks' in file '/sbin/ttymon'.
Possible rootkit: SHV5 Rootkit
Found string 'skillz' in file '/sbin/ttymon'. Possible
rootkit: SHV5 Rootkit
Found string 'propert of SH' in file '/sbin/ttyload'.
Possible rootkit: SHV5 Rootkit
Found string 'ttyload' in file '/etc/inittab'. Possible
rootkit: Possible SHV5
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 7
Problemerkennung
• Was genau?
rs3418:/var/log # ls
ls: unrecognized prefix: do
ls: unparsable value for LS_COLORS environment
variable
# rcapache2 start
Starting httpd2 (prefork) (98)Address already in
use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not
bind to address 0.0.0.0:80
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 8
lsof
• Erstellt eine Liste offener Dateien und Ports
# lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE
NODE NAME
httpd2-pr 892 wwwrun 3u IPv6 10414 TCP
*:http (LISTEN)
httpd2-pr 893 wwwrun 3u IPv6 10414 TCP
*:http (LISTEN)
httpd2-pr 894 wwwrun 3u IPv6 10414 TCP
*:http (LISTEN)
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 9
255 17105 root 3u IPv6 11133028135
TCP *:80 (LISTEN)
255 17105 root 5u IPv6 11133028140
TCP *:443 (LISTEN)
255 17105 root 255u IPv4
11149127797 TCP *:1989 (LISTEN)
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 10
# lsof -p 17105
COMMAND PID USER FD TYPE DEVICE SIZE
NODE NAME
255 17105 root cwd DIR 8,3 696 2 /
255 17105 root rtd DIR 8,3 696 2 /
255 17105 root txt REG 8,3 652620
14638336 /tmp/sh-CU2F1LKAQWG (deleted)
255 17105 root mem REG 0,0 0
[heap] (stat: No such file or
directory)
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 11
lsof - Praxistipps
• lsof braucht zu lange?
• lsof –P –n verwenden
• lsof –i :Port
• lsof –p PID
• lsof | grep Datei
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 12
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 13
strings
# cat hello.c
#include <stdio.h>
int main(void)
{ printf("Hallo Welt"); return(0); }
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 14
# strings a.out
/lib/ld-linux.so.2
SuSESuSE
_Jv_RegisterClasses
__gmon_start__
libc.so.6
printf
_IO_stdin_used
__libc_start_main
GLIBC_2.0
PTRh
[^_]
Hallo Welt
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 15
strace
rs3418:/ # strace -p 17107
Process 17107 attached - interrupt to quit
[ Process PID=17107 runs in 32 bit mode. ]
restart_syscall(<... resuming interrupted call ...>) = 0
read(0, 0xffc8aea0, 1072) = -1 EAGAIN
(Resource temporarily unavailable)
time(NULL) = 1285327335
nanosleep({858993459200000,
577765979979777072}, NULL) = 0
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 16
Was geben die logfiles her?
• dmesg
• /var/log/messages
• Apache access und error log
• /var/log/mail
• ~/.bash_history
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 17
[Wed Sep XX 22:56:28 2010] [notice] mod_fcgid: call
/srv/www/vhosts/example.com/httpdocs/jasminesblog/i
ndex.php with wrapper /usr/bin/php-cgi5
[Wed Sep XX 22:56:28 2010] [notice] mod_fcgid: server
/srv/www/vhosts/example.com/httpdocs/jasminesblog/i
ndex.php(20143) started
[Wed Sep XX 23:20:10 2010] [error] [client
208.80.XXX.XX] request failed: error reading the
headers
[Wed Sep XX 23:21:18 2010] [error] [client
208.80.XXX.XX] request failed: error reading the
headers
Empty input file
Empty input file
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 18
Ergebnisse aus den Logfiles
• nicht immer eindeutig
• nicht immer ergiebig
• „schuldige“ Domain über Error-Logs
• Veraltete Joomla-Installation
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 19
Was wurde am Server verändert?
• Manipulation der Log-Dateien
• Versteckte Unterordner mit Programmteilen
• IRC-Server
• Spam-Mail-Versand
• Backdoor über /etc/inittab
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 20
Wenn DEIN Server gehackt wurde,
dann ist es nicht mehr DEIN Server!
• Sauberes System aufsetzten
• Backup einspielen
• Neues System besser absichern
• Sicherheitsupdates einspielen!
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 21
Danke
12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 22

Weitere ähnliche Inhalte

Ähnlich wie IT sec x_2010_höllrigl

Rsyslog deutsche Qualitätsarbeit für Linux Roman Gächter
Rsyslog deutsche Qualitätsarbeit für Linux Roman GächterRsyslog deutsche Qualitätsarbeit für Linux Roman Gächter
Rsyslog deutsche Qualitätsarbeit für Linux Roman GächterDésirée Pfister
 
Rsyslog - Deutsche Qualitätsarbeit für Linux
Rsyslog - Deutsche Qualitätsarbeit für LinuxRsyslog - Deutsche Qualitätsarbeit für Linux
Rsyslog - Deutsche Qualitätsarbeit für LinuxTrivadis
 
OSMC 2010 | Netzwerkmonitoring mit Argus by Wolfgang Barth
OSMC 2010 | Netzwerkmonitoring mit Argus by Wolfgang BarthOSMC 2010 | Netzwerkmonitoring mit Argus by Wolfgang Barth
OSMC 2010 | Netzwerkmonitoring mit Argus by Wolfgang BarthNETWAYS
 
OSMC 2016 | Take Care of your Logs by Jan Doberstein
OSMC 2016 | Take Care of your Logs by Jan DobersteinOSMC 2016 | Take Care of your Logs by Jan Doberstein
OSMC 2016 | Take Care of your Logs by Jan DobersteinNETWAYS
 
RESTful APIs mit Dart
RESTful APIs mit DartRESTful APIs mit Dart
RESTful APIs mit DartNane Kratzke
 
Inside HTTP: Webdebugging mit FIddler
Inside HTTP: Webdebugging mit FIddlerInside HTTP: Webdebugging mit FIddler
Inside HTTP: Webdebugging mit FIddlerMax Nowack
 
OSDC 2011 | Automatische Netzwerkdokumentation mit NetDot und RANCID by Jens ...
OSDC 2011 | Automatische Netzwerkdokumentation mit NetDot und RANCID by Jens ...OSDC 2011 | Automatische Netzwerkdokumentation mit NetDot und RANCID by Jens ...
OSDC 2011 | Automatische Netzwerkdokumentation mit NetDot und RANCID by Jens ...NETWAYS
 
Dart (Teil II der Tour de Dart)
Dart (Teil II der Tour de Dart)Dart (Teil II der Tour de Dart)
Dart (Teil II der Tour de Dart)Nane Kratzke
 
DOAG 2018 / Praktische Erfahrungen mit SPARC S7-2 Server
DOAG 2018 / Praktische Erfahrungen mit SPARC S7-2 ServerDOAG 2018 / Praktische Erfahrungen mit SPARC S7-2 Server
DOAG 2018 / Praktische Erfahrungen mit SPARC S7-2 ServerJomaSoft
 
OSDC 2010 | What's new in Apache 2.4? by Rainer Jung
OSDC 2010 | What's new in Apache 2.4? by Rainer JungOSDC 2010 | What's new in Apache 2.4? by Rainer Jung
OSDC 2010 | What's new in Apache 2.4? by Rainer JungNETWAYS
 
Status of syslog as of 2005
Status of syslog as of 2005Status of syslog as of 2005
Status of syslog as of 2005Rainer Gerhards
 
Evaluation des iSIPS IP Stack für drahtlose Sensornetze
Evaluation des iSIPS IP Stack für drahtlose SensornetzeEvaluation des iSIPS IP Stack für drahtlose Sensornetze
Evaluation des iSIPS IP Stack für drahtlose SensornetzePeter Rothenpieler
 
Go - Googles Sprache für skalierbare Systeme
Go - Googles Sprache für skalierbare SystemeGo - Googles Sprache für skalierbare Systeme
Go - Googles Sprache für skalierbare SystemeFrank Müller
 
Making the internet faster HTTP/3 und QUIC
Making the internet faster HTTP/3 und QUICMaking the internet faster HTTP/3 und QUIC
Making the internet faster HTTP/3 und QUICQAware GmbH
 
Introduction to the command line
Introduction to the command lineIntroduction to the command line
Introduction to the command linesteffenbauer
 
Dual-Stack IPv6 Monitoring bei AWK - Member Anlass Swiss IPv6 Council Nov 2013
Dual-Stack IPv6 Monitoring bei AWK - Member Anlass Swiss IPv6 Council Nov 2013Dual-Stack IPv6 Monitoring bei AWK - Member Anlass Swiss IPv6 Council Nov 2013
Dual-Stack IPv6 Monitoring bei AWK - Member Anlass Swiss IPv6 Council Nov 2013Swiss IPv6 Council
 
Monitoring der DualStack Umgebung der AWK Group
Monitoring der DualStack Umgebung der AWK GroupMonitoring der DualStack Umgebung der AWK Group
Monitoring der DualStack Umgebung der AWK GroupDigicomp Academy AG
 
Sicherer Wegweiser im Internet: DNSSEC im praktischen Einsatz
Sicherer Wegweiser im Internet: DNSSEC im praktischen EinsatzSicherer Wegweiser im Internet: DNSSEC im praktischen Einsatz
Sicherer Wegweiser im Internet: DNSSEC im praktischen EinsatzSpeedPartner GmbH
 

Ähnlich wie IT sec x_2010_höllrigl (20)

Rsyslog deutsche Qualitätsarbeit für Linux Roman Gächter
Rsyslog deutsche Qualitätsarbeit für Linux Roman GächterRsyslog deutsche Qualitätsarbeit für Linux Roman Gächter
Rsyslog deutsche Qualitätsarbeit für Linux Roman Gächter
 
Rsyslog - Deutsche Qualitätsarbeit für Linux
Rsyslog - Deutsche Qualitätsarbeit für LinuxRsyslog - Deutsche Qualitätsarbeit für Linux
Rsyslog - Deutsche Qualitätsarbeit für Linux
 
OSMC 2010 | Netzwerkmonitoring mit Argus by Wolfgang Barth
OSMC 2010 | Netzwerkmonitoring mit Argus by Wolfgang BarthOSMC 2010 | Netzwerkmonitoring mit Argus by Wolfgang Barth
OSMC 2010 | Netzwerkmonitoring mit Argus by Wolfgang Barth
 
OSMC 2016 | Take Care of your Logs by Jan Doberstein
OSMC 2016 | Take Care of your Logs by Jan DobersteinOSMC 2016 | Take Care of your Logs by Jan Doberstein
OSMC 2016 | Take Care of your Logs by Jan Doberstein
 
Ldap sqlnet
Ldap sqlnetLdap sqlnet
Ldap sqlnet
 
RESTful APIs mit Dart
RESTful APIs mit DartRESTful APIs mit Dart
RESTful APIs mit Dart
 
Inside HTTP: Webdebugging mit FIddler
Inside HTTP: Webdebugging mit FIddlerInside HTTP: Webdebugging mit FIddler
Inside HTTP: Webdebugging mit FIddler
 
OSDC 2011 | Automatische Netzwerkdokumentation mit NetDot und RANCID by Jens ...
OSDC 2011 | Automatische Netzwerkdokumentation mit NetDot und RANCID by Jens ...OSDC 2011 | Automatische Netzwerkdokumentation mit NetDot und RANCID by Jens ...
OSDC 2011 | Automatische Netzwerkdokumentation mit NetDot und RANCID by Jens ...
 
Dart (Teil II der Tour de Dart)
Dart (Teil II der Tour de Dart)Dart (Teil II der Tour de Dart)
Dart (Teil II der Tour de Dart)
 
DOAG 2018 / Praktische Erfahrungen mit SPARC S7-2 Server
DOAG 2018 / Praktische Erfahrungen mit SPARC S7-2 ServerDOAG 2018 / Praktische Erfahrungen mit SPARC S7-2 Server
DOAG 2018 / Praktische Erfahrungen mit SPARC S7-2 Server
 
OSDC 2010 | What's new in Apache 2.4? by Rainer Jung
OSDC 2010 | What's new in Apache 2.4? by Rainer JungOSDC 2010 | What's new in Apache 2.4? by Rainer Jung
OSDC 2010 | What's new in Apache 2.4? by Rainer Jung
 
Status of syslog as of 2005
Status of syslog as of 2005Status of syslog as of 2005
Status of syslog as of 2005
 
Evaluation des iSIPS IP Stack für drahtlose Sensornetze
Evaluation des iSIPS IP Stack für drahtlose SensornetzeEvaluation des iSIPS IP Stack für drahtlose Sensornetze
Evaluation des iSIPS IP Stack für drahtlose Sensornetze
 
Go - Googles Sprache für skalierbare Systeme
Go - Googles Sprache für skalierbare SystemeGo - Googles Sprache für skalierbare Systeme
Go - Googles Sprache für skalierbare Systeme
 
Web-Services mit Go
Web-Services mit GoWeb-Services mit Go
Web-Services mit Go
 
Making the internet faster HTTP/3 und QUIC
Making the internet faster HTTP/3 und QUICMaking the internet faster HTTP/3 und QUIC
Making the internet faster HTTP/3 und QUIC
 
Introduction to the command line
Introduction to the command lineIntroduction to the command line
Introduction to the command line
 
Dual-Stack IPv6 Monitoring bei AWK - Member Anlass Swiss IPv6 Council Nov 2013
Dual-Stack IPv6 Monitoring bei AWK - Member Anlass Swiss IPv6 Council Nov 2013Dual-Stack IPv6 Monitoring bei AWK - Member Anlass Swiss IPv6 Council Nov 2013
Dual-Stack IPv6 Monitoring bei AWK - Member Anlass Swiss IPv6 Council Nov 2013
 
Monitoring der DualStack Umgebung der AWK Group
Monitoring der DualStack Umgebung der AWK GroupMonitoring der DualStack Umgebung der AWK Group
Monitoring der DualStack Umgebung der AWK Group
 
Sicherer Wegweiser im Internet: DNSSEC im praktischen Einsatz
Sicherer Wegweiser im Internet: DNSSEC im praktischen EinsatzSicherer Wegweiser im Internet: DNSSEC im praktischen Einsatz
Sicherer Wegweiser im Internet: DNSSEC im praktischen Einsatz
 

IT sec x_2010_höllrigl

  • 1. Analyse eines gehackten Webservers unter Linux 12.11.2010 – IT-SecX 1Dipl.-Ing. (FH) Georg Höllrigl
  • 2. Portrait • Georg Höllrigl • HTL St. Pölten - Elektronik / Technische Informatik • 8 Jahre Erfahrung als Systemadministrator • FH Mittweida – Informationstechnik • GmbH • Technischer Dienstleister, Domainverwaltung, Rechenzentrum in Wien und Amsterdam 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 2
  • 3. Gliederung • Problemerkennung • Alarmierung: rkhunter und chkrootkit • Tools: lsof, strings, strace • Was hat der Hacker alles am Server angestellt • Was ist in den Logfiles zu finden? • Wie wurde der Service wieder hergestellt? • Neuinstallation 12.11.2010 – IT-SecX 3Dipl.-Ing. (FH) Georg Höllrigl
  • 4. Problemerkennung • Wie? • Andauernde CPU Auslastung • Festplatte voll • Apache restart: port already in use • rkhunter oder chkrootkit Alarmierung • Beschwerde von Dritten 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 4
  • 5. 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 5
  • 6. 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 6
  • 7. rkhunter / chkrootkit Found string 'fucknut' in file '/sbin/ttymon'. Possible rootkit: SHV5 Rootkit Found string 'lamersucks' in file '/sbin/ttymon'. Possible rootkit: SHV5 Rootkit Found string 'skillz' in file '/sbin/ttymon'. Possible rootkit: SHV5 Rootkit Found string 'propert of SH' in file '/sbin/ttyload'. Possible rootkit: SHV5 Rootkit Found string 'ttyload' in file '/etc/inittab'. Possible rootkit: Possible SHV5 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 7
  • 8. Problemerkennung • Was genau? rs3418:/var/log # ls ls: unrecognized prefix: do ls: unparsable value for LS_COLORS environment variable # rcapache2 start Starting httpd2 (prefork) (98)Address already in use: make_sock: could not bind to address [::]:80 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 8
  • 9. lsof • Erstellt eine Liste offener Dateien und Ports # lsof -i :80 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME httpd2-pr 892 wwwrun 3u IPv6 10414 TCP *:http (LISTEN) httpd2-pr 893 wwwrun 3u IPv6 10414 TCP *:http (LISTEN) httpd2-pr 894 wwwrun 3u IPv6 10414 TCP *:http (LISTEN) 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 9
  • 10. 255 17105 root 3u IPv6 11133028135 TCP *:80 (LISTEN) 255 17105 root 5u IPv6 11133028140 TCP *:443 (LISTEN) 255 17105 root 255u IPv4 11149127797 TCP *:1989 (LISTEN) 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 10
  • 11. # lsof -p 17105 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME 255 17105 root cwd DIR 8,3 696 2 / 255 17105 root rtd DIR 8,3 696 2 / 255 17105 root txt REG 8,3 652620 14638336 /tmp/sh-CU2F1LKAQWG (deleted) 255 17105 root mem REG 0,0 0 [heap] (stat: No such file or directory) 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 11
  • 12. lsof - Praxistipps • lsof braucht zu lange? • lsof –P –n verwenden • lsof –i :Port • lsof –p PID • lsof | grep Datei 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 12
  • 13. 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 13
  • 14. strings # cat hello.c #include <stdio.h> int main(void) { printf("Hallo Welt"); return(0); } 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 14
  • 16. strace rs3418:/ # strace -p 17107 Process 17107 attached - interrupt to quit [ Process PID=17107 runs in 32 bit mode. ] restart_syscall(<... resuming interrupted call ...>) = 0 read(0, 0xffc8aea0, 1072) = -1 EAGAIN (Resource temporarily unavailable) time(NULL) = 1285327335 nanosleep({858993459200000, 577765979979777072}, NULL) = 0 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 16
  • 17. Was geben die logfiles her? • dmesg • /var/log/messages • Apache access und error log • /var/log/mail • ~/.bash_history 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 17
  • 18. [Wed Sep XX 22:56:28 2010] [notice] mod_fcgid: call /srv/www/vhosts/example.com/httpdocs/jasminesblog/i ndex.php with wrapper /usr/bin/php-cgi5 [Wed Sep XX 22:56:28 2010] [notice] mod_fcgid: server /srv/www/vhosts/example.com/httpdocs/jasminesblog/i ndex.php(20143) started [Wed Sep XX 23:20:10 2010] [error] [client 208.80.XXX.XX] request failed: error reading the headers [Wed Sep XX 23:21:18 2010] [error] [client 208.80.XXX.XX] request failed: error reading the headers Empty input file Empty input file 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 18
  • 19. Ergebnisse aus den Logfiles • nicht immer eindeutig • nicht immer ergiebig • „schuldige“ Domain über Error-Logs • Veraltete Joomla-Installation 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 19
  • 20. Was wurde am Server verändert? • Manipulation der Log-Dateien • Versteckte Unterordner mit Programmteilen • IRC-Server • Spam-Mail-Versand • Backdoor über /etc/inittab 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 20
  • 21. Wenn DEIN Server gehackt wurde, dann ist es nicht mehr DEIN Server! • Sauberes System aufsetzten • Backup einspielen • Neues System besser absichern • Sicherheitsupdates einspielen! 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 21
  • 22. Danke 12.11.2010 – IT-SecX Dipl.-Ing. (FH) Georg Höllrigl 22