Home General Computer Multimedia Business Lounge

Post Reply 
Memahami process info pseudo-filesystem di linux
07-18-2010, 04:14 PM
Post: #1
Memahami process info pseudo-filesystem di linux
Merupakan file system yang dimount di mana isinya misal berupa data 2 tentang suatu pid .
Ok untuk praktek mari kita tes sedikit dari 1 source eksploit yang akan saya run dg suatu pid yang menggunakan syscall execl:
Code:
sh-3.2$ cat exploit.c | grep execl
        execl("/bin/sh", "/bin/sh", "-i", NULL);
sh-3.2$

tes run di background didapatkan pid:21814
Code:
-bash-3.2$ ./exploit &
[1] 21814

Ok mari kita lihat di /proc/21814:
Code:
sh-3.2# cd /proc/21814;ls -la
total 0
dr-xr-xr-x   5 root root 0 Jul  9 00:38 .
dr-xr-xr-x 151 root root 0 Jun  8 15:38 ..
dr-xr-xr-x   2 root root 0 Jul  9 00:40 attr
-r--------   1 root root 0 Jul  9 00:40 auxv
-r--r--r--   1 root root 0 Jul  9 00:38 cmdline
-rw-r--r--   1 root root 0 Jul  9 00:40 coredump_filter
-r--r--r--   1 root root 0 Jul  9 00:40 cpuset
lrwxrwxrwx   1 root root 0 Jul  9 00:40 cwd -> /usr/bin/.../wisdom_private_exploit
-r--------   1 root root 0 Jul  9 00:40 environ
lrwxrwxrwx   1 root root 0 Jul  9 00:38 exe -> /bin/bash
dr-x------   2 root root 0 Jul  9 00:38 fd
-r--------   1 root root 0 Jul  9 00:40 limits
-rw-r--r--   1 root root 0 Jul  9 00:40 loginuid
-r--r--r--   1 root root 0 Jul  9 00:40 maps
-rw-------   1 root root 0 Jul  9 00:40 mem
-r--r--r--   1 root root 0 Jul  9 00:40 mounts
-r--------   1 root root 0 Jul  9 00:40 mountstats
-rw-r--r--   1 root root 0 Jul  9 00:40 oom_adj
-r--r--r--   1 root root 0 Jul  9 00:40 oom_score
lrwxrwxrwx   1 root root 0 Jul  9 00:40 root -> /
-r--r--r--   1 root root 0 Jul  9 00:40 schedstat
-r--------   1 root root 0 Jul  9 00:40 smaps
-r--r--r--   1 root root 0 Jul  9 00:38 stat
-r--r--r--   1 root root 0 Jul  9 00:40 statm
-r--r--r--   1 root root 0 Jul  9 00:38 status
dr-xr-xr-x   3 root root 0 Jul  9 00:40 task
-r--r--r--   1 root root 0 Jul  9 00:40 wchan
sh-3.2#

ok berikut ini keteranganya:
-cmdline
Code:
sh-3.2# cat cmdline
/bin/sh-i
file cmdline merupakan perintah yang mengakibatkan terjadinya pid 21814, di mana tadi eksekusi utama dengan sycall execl dengan argumen -i:
Code:
execl("/bin/sh", "/bin/sh", "-i", NULL);

-cwd
cwd merupakan symlink ke direktori tempat dieksekusinya elf binary kita tadi

- maps
maps berisi info tentang memory mapping dari pid yang menunjukkan alamat 2 vma (virtual memory addressing)
mari kita lihat isi file maps:
Code:
sh-3.2# cat maps
00844000-00845000 r-xp 00844000 00:00 0          [vdso]
009ae000-009c9000 r-xp 00000000 08:01 32932044   /lib/ld-2.5.so
009c9000-009ca000 r-xp 0001a000 08:01 32932044   /lib/ld-2.5.so
009ca000-009cb000 rwxp 0001b000 08:01 32932044   /lib/ld-2.5.so
009cd000-009d0000 r-xp 00000000 08:01 32932704   /lib/libdl-2.5.so
009d0000-009d1000 r-xp 00002000 08:01 32932704   /lib/libdl-2.5.so
009d1000-009d2000 rwxp 00003000 08:01 32932704   /lib/libdl-2.5.so
009d4000-009d7000 r-xp 00000000 08:01 32932113   /lib/libtermcap.so.2.0.8
009d7000-009d8000 rwxp 00002000 08:01 32932113   /lib/libtermcap.so.2.0.8
00a19000-00b6b000 r-xp 00000000 08:01 32932111   /lib/libc-2.5.so
00b6b000-00b6d000 r-xp 00152000 08:01 32932111   /lib/libc-2.5.so
00b6d000-00b6e000 rwxp 00154000 08:01 32932111   /lib/libc-2.5.so
00b6e000-00b71000 rwxp 00b6e000 00:00 0
00f03000-00f0d000 r-xp 00000000 08:01 32932035   /lib/libnss_files-2.5.so
00f0d000-00f0e000 r-xp 00009000 08:01 32932035   /lib/libnss_files-2.5.so
00f0e000-00f0f000 rwxp 0000a000 08:01 32932035   /lib/libnss_files-2.5.so
08047000-080f5000 r-xp 00000000 08:01 33062923   /bin/bash
080f5000-080fa000 rw-p 000ae000 08:01 33062923   /bin/bash
080fa000-080ff000 rw-p 080fa000 00:00 0
090c6000-090e7000 rw-p 090c6000 00:00 0          [heap]
b7cf5000-b7cf6000 r--p 010ca000 08:01 33502887   /usr/lib/locale/locale-archive
b7cf6000-b7cfc000 r--p 01093000 08:01 33502887   /usr/lib/locale/locale-archive
b7cfc000-b7d30000 r--p 0105a000 08:01 33502887   /usr/lib/locale/locale-archive
b7d30000-b7f30000 r--p 00000000 08:01 33502887   /usr/lib/locale/locale-archive
b7f30000-b7f32000 rw-p b7f30000 00:00 0
bfc58000-bfc6d000 rw-p bffea000 00:00 0          [stack]
sh-3.2#
keterangan:
00844000-00845000 r-xp 00844000 00:00 0 [vdso]

0x845000-0x844000=0x1000 = 4096 bytes (4096 bytes= ukuran 1 page)


-alamat memori 00844000 sampai dengan alamat memori 00845000 (dalam hex) merupakan range alamat memori yang dimap untuk ditempati.

-r-xp
ini merupakan hak akses pada alamat memori tersebut, hak akses ini sering dimanfaatkan untuk eksploitasi di page zero dengan mmap
Code:
mmap(NULL, 0x1000, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
di mana hak aksesnya bisa :read/write/executable/private/anonymous

- 00844000
merupakan file offset dari mana map diciptakan,

-00:00
ini pertanda anonymous map

-0 merupakan sign anonymous map

-[vdso] merupakan path file

untuk lebih memahami secara mendalam silahkan anda lihat di fungsi proc_pid_maps_get_line()

-environ
Code:
sh-3.2# cat environ
MANPATH=/usr/lib/courier-imap/man:HOSTNAME=server.localhostTERM=xtermSHELL=/bin/bashHISTSIZE=1000SSH_CLIENT=118.136.169.51 36246 22OLDPWD=/usr/bin/...SSH_TTY=/dev/pts/0USER=mysqlLS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:MAIL=/var/spool/mail/mysqlPATH=/usr/kerberos/bin:/usr/lib/courier-imap/bin:/usr/local/bin:/bin:/usr/binINPUTRC=/etc/inputrcPWD=/usr/bin/.../wisdom_private_exploitLANG=en_GBSHLVL=1HOME=/var/lib/mysqlLOGNAME=mysqlCVS_RSH=sshSSH_CONNECTION=118.136.169.51 36246 95.131.64.82 22LESSOPEN=|/usr/bin/lesspipe.sh %sG_BROKEN_FILENAMES=1_=./exploitsh-3.2#

Berupa informasi environment dari pid yang sedang kita analisis misal:SSH_TTY=/dev/pts/0 artinya saya mengakses server dengan ssh via /dev/pts/0


-status
informasi tentang vma bisa kita lihat via file status di .proc/pid.
VmSize: ukuran virtual memory yang dialokasikan
VmLck: jumlah memory yang dikunci
VmRSS: jumlah memori yang dimap di ram
VmData: ukuran data segment
VmStk: ukuran stack
VmExe: ukuran executable segment
VmLib: ukuran kode library
VmPTE: ukuran page table entry

mari kita lihat untuk pid kita tadi:
Code:
101sh-3.2# cat status | grep Vm
VmPeak:     4856 kB
VmSize:     4824 kB
VmLck:         0 kB
VmHWM:       900 kB
VmRSS:       900 kB
VmData:      176 kB
VmStk:        84 kB
VmExe:       696 kB
VmLib:      1524 kB
VmPTE:        24 kB
sh-3.2#

special message for malaysian skids:
( sorry skids and defacement or ddos or rm -rf is lame for us.. soon I'm gonna show you an attack vector that u'll never be able to implement..it's not defacing,rm -rf nor ddos.. it's a very different attack vector to show u difference between u and me skids something for permanent destruction for u skids using a very special w0rm I'm gonna finish u up for good. gimme time to implement this kinda rare attack skids
Find all posts by this user
Quote this message in a reply
Post Reply 


Topic Tools
Topic Link :
BBCode :
HTML Code :
View a Printable Version Send Thread to a Friend Subscribe to this thread
Submit Google Submit Face book Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Sekilas VFS pada linux kernel 2.4 ev1lut10n 1 229 01-21-2012 09:16 PM
Last Post: ketek
  IOCTL Programming Under Linux Kernel 2.6 ev1lut10n 3 341 11-25-2011 01:01 PM
Last Post: ketek
Heart Mengirim comand CUSD ke modem GSM dengan C (GNU/Linux) melati 4 641 06-05-2011 05:05 PM
Last Post: melati
  TCP Socket Programming dengan Bahasa C (Linux) mywisdom 8 1,479 04-20-2011 01:16 AM
Last Post: mywisdom
  [Tutor] compile dan run c++ d'linux jurank_dankkal 10 2,105 12-29-2010 06:26 PM
Last Post: donkey_code
  Penguji daur hidup linux worm mywisdom 3 886 09-12-2010 11:25 PM
Last Post: mywisdom

Users Browsing
1 Guest(s)


Stop SOPA/PIPA | Discuss !