Rozpoznanie wewnętrzne systemu


----------------------------------------------
topic: Rozpoznanie wewnętrzne systemu...
form: Michał <21h> Kurowski 21h@interia.pl
----------------------------------------------

0x01 Intro

W tym krótkim texcie postaram sie przestawić jak szybko i w miare prosto dowiedzieć sie wielu ciekawych rzeczy o systemie mają w nim zwykłe konto powłokowe. A po co to komu ? Załużmy że zdobyłeś w jakiś sposób shella
z pewnymi uprawnieniami np. apache i chcesz sie dowiedzieć wielu rzeczy o tym systemie: wersie oprogramowania, otware porty, usługi, zalogowani użytkownicy etc. np. w celu późniejszego wyexploitowania i zdobycia roota ;]

0x02 Zbieramy informacje

1. Komędą uname -a możemy wyciągnąc wersje i rodzaj systemu oraz jego architekturę
bash-2.05a$ uname -a
FreeBSD m-net.arbornet.org 4.6.2-RELEASE-p26 FreeBSD 4.6.2-RELEASE-p26 #7: Sun
Oct  5 00:39:40 EDT 2003 styles@m-net.arbornet.org:/source/stable/src/sys/compile/MNET  
i386

2. uptime pozwoli nam określić ile system i od kiedy stoi na necie
bash-2.05a$ uptime
9:54AM  up 7 days,  9:16, 20 users, load averages: 2.03, 2.35, 2.09

3. who wyświetli liste aktualnie zalogowanych userów
bash-2.05a$ who
qisthon          ttyp0   Jul 22 09:21   (202.155.13.228)
trex             ttyp1   Jul 15 13:29   (198.111.176.53)
styles           ttyp2   Jul 22 09:35   (168.100.195.11)
evenfall         ttyp3   Jul 22 08:20   (167.1.158.7)
21h             ttypd   Jul 22 09:52   (mój.adres.ip)

4. whoami powie nam kim my jesteśmy ;)  
bash-2.05a$ whoami
21h

5. bash --version dowiemy sie o wersji powłoki
bash-2.05a$ bash --version
GNU bash, version 2.05a.0(1)-release (i386-portbld-freebsd4.6)
Copyright 2001 Free Software Foundation, Inc.

6. env wyświetli wszystkie zmienne
bash-2.05a$ env
PWD=/home/guest/21h
TZ=EST5EDT
PAGER=more
FTP_PASSIVE_MODE=YES
PW_SCAN_BIG_IDS=1
ENV=/home/guest/21h/.shrc
BLOCKSIZE=K
USER=21h
MAIL=/var/mail/21h
EDITOR=/usr/bin/vi
SSH_CLIENT=mój.adres.ip 1221 22
LOGNAME=21h
SHLVL=1
SHELL=/bin/bash
HOME=/home/guest/21h
TERM=xterm
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/bin:/us  r/X11R6/bin:/home
/guest/21h/bin
SSH_TTY=/dev/ttypd
_=/usr/bin/env

7. z netstat dowiemy sie o aktualnych połączeniach sieciowych
bash-2.05a$ netstat
netstat: kvm not available
Active Internet connections
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp4       0     40  m-net.3969             feynman.zen.co.u.smtp  ESTABLISHED
tcp4       0      0  m-net.3968             blackmail.nildra.smtp  ESTABLISHED

8. inetd.conf powie nam o dostępnych usługach i otwartych portach
bash-2.05a$ cat /etc/inetd.conf |more
# $FreeBSD: src/etc/inetd.conf,v 1.44.2.14 2002/04/26 17:26:29 ume Exp $
#
# Internet server configuration database
#
# Define *both* IPv4 and IPv6 entries for dual-stack support.
# To disable a service, comment it out by prefixing the line with '#'.
# To enable a service, remove the '#' at the beginning of the line.
#
#ftp    stream  tcp     nowait  root    /usr/libexec/ftpd       ftpd -l
ftp     stream  tcp     nowait  root    /usr/local/libexec/proftpd    proftpd
#ftp    stream  tcp6    nowait  root    /usr/libexec/ftpd       ftpd -l
telnet  stream  tcp     nowait  root    /usr/libexec/telnetd    telnetd -u0
#telnet stream  tcp6    nowait  root    /usr/libexec/telnetd    telnetd
#shell  stream  tcp     nowait  root    /usr/libexec/rshd       rshd
#shell  stream  tcp6    nowait  root    /usr/libexec/rshd       rshd
#login  stream  tcp     nowait  root    /usr/libexec/rlogind    rlogind
#login  stream  tcp6    nowait  root    /usr/libexec/rlogind    rlogind
finger  stream  tcp     nowait/3/10 nobody /usr/libexec/fingerd fingerd -l
#finger stream  tcp6    nowait/3/10 nobody /usr/libexec/fingerd fingerd -s
#exec   stream  tcp     nowait  root    /usr/libexec/rexecd     rexecd
#uucpd  stream  tcp     nowait  root    /usr/libexec/uucpd      uucpd
#nntp   stream  tcp     nowait  usenet  /usr/libexec/nntpd      nntpd

9. wyświetlając plik /etc/passwd dowiemy sie ile i jacy są userzy na serwerze.
bash-2.05a$ cat /etc/passwd
21h:*:39375:10:Michal Kurowski:/home/guest/21h:/bin/bash
lnxnubie:*:39376:10:Ashish Disawal:/home/guest/lnxnubie:/bin/bash
dimatha:*:39378:10:Vasia:/home/guest/dimatha:/bin/bash
mates:*:39379:10:m8s:/home/guest/mates:/bin/sh
sorin200:*:39380:10:sorin:/home/guest/sorin200:/bin/bash
pacman:*:36071:10:jose felgueiras:/home/guest/pacman:/bin/sh
knocurek:*:37311:10:knocurek:/home/guest/knocurek:/usr/local/bin  /menu
bhomas:*:37481:10:tom:/home/guest/bhomas:/usr/local/bin/menu
preludiu:*:37900:10:victor:/home/guest/preludiu:/bin/sh
metrox:*:38094:10:metrox:/home/guest/metrox:/usr/local/bin/menu
theskull:*:38548:10:Skull:/home/guest/theskull:/usr/local/bin/me  nu
lololk:*:38592:10:Theis Andreasen:/home/guest/lololk:/bin/bash
i tak dalej....

0x03 End...

W tych 9 krokach pokazałem jak zdobyć troszkę informacji o serwerze, wiemy już jacy są userze i którzy z nich sa teraz zalogowani, znamy wersje i typ systemu operacyjnego i powłoki, wiemy jakie są usługi na serwerze i wiele innych rzeczy a do czego wykorzystamy tą wiedze zależy tylko od was :)