19 Nisan 2012 Perşembe

Failed to load the OCI library: no such file to load --oci8

Backtrack üzerindeki Metasploit de oracle ile ilgili bir auxiliary modülünü çalıştırırken “Failed to load the OCI library: no such file to load  --oci8” şeklinde bir hatayla karşılaşıldığında yapılacak işlemler şunlardır:

İlk olarak oracle instant client ile ilgili kurulumlar yapılmalıdır.
*Instant Client Package - Basic
*Instant Client Package - SDK (devel)
*Instant Client Package - SQL*Plus  **not needed for metasploit but useful to have

Tüm uygulamalara oracle sitesi üzerinden erişebilir.
http://www.oracle.com/technetwork/topics/linuxsoft-082809.html

Ardından bu uygulamaları kuracağımız dizin oluşturulur.

Mkdir /opt/oracle

Ardından indirilen tüm dosyalar açılır.

Cd /opt/oracle

/opt/oracle/instantclient_10_2#  Unzip /opt/oracle/ basic-10.2.0.5.0-linux.zip
/opt/oracle/instantclient_10_2#  Unzip /opt/oracle/ sdk-10.2.0.5.0-linux.zip
/opt/oracle/instantclient_10_2#  Unzip /opt/oracle/ sqlplus-10.2.0.5.0-linux.zip

Link oluşturulur.

/opt/oracle/instantclient_10_2# ln -s libclntsh.so.10.1 libclntsh.so

Şimdi gerekli environment(çevresel) değişkenleri ayarlayacağız. Değişkenlerin her açılışta tekrar oluşması için bashrc dosyası içine kaydedeceğiz.

vim /root/.bashrc

Dosyanın en altına şu değişkenler eklenir.

export PATH=$PATH:/opt/oracle/instantclient_10_2
export SQLPATH=/opt/oracle/instantclient_10_2
export TNS_ADMIN=/opt/oracle/instantclient_10_2
export LD_LIBRARY_PATH=/opt/oracle/instantclient_10_2
export ORACLE_HOME=/opt/oracle/instantclient_10_2

Ardından ruby için gerekli oci8 driverını kuracağız.

http://rubyforge.org/frs/download.php/65896/ruby-oci8-2.0.3.tar.gz

Dosyayı indirdikten sonra sırasıyla aşağıdaki komutlar çalıştırılır.

tar xvzf ruby-oci8-2.0.3.tar.gz
cd ruby-oci8-2.0.3/
env
LD_LIBRARY_PATH=/opt/oracle/instantclient_10_2/
export LD_LIBRARY_PATH
env | grep LD_LIBRARY_PATH
make
sudo make install


Ancak henüz hala aynı hatayı almaya devam edeceğiz.

    root@bt:~# irb 
    irb(main):001:0> require 'oci8' 
    LoadError: no such file to load -- oci8lib_191 
        from /usr/local/lib/site_ruby/1.9.2/oci8.rb:40:in `require' 
        from /usr/local/lib/site_ruby/1.9.2/oci8.rb:40:in `<top (required)>' 
        from (irb):1:in `require' 
        from (irb):1 
        from /usr/bin/irb:12:in `<main>' 

Görüldüğü gibi oci8lib_191 kütüphanesi bulunamıyor. Bunun için /usr/local/lib/site_ruby/1.9.2/oci8.rb dosyasında bazı değişiklikler yapacağız. Sorun ruby versiyonun istediği oci driverı ile ilgili. Bizim ruby versiyonumuz 1.9.2 olduğundan ve elimizde oci8lib_192 driverı bulunduğundan bunu açtığımız dosyada belirtmemiz gerekiyor.

Normalde oci8.rb dosyasında içerik aşağıdaki gibi:

Case RUBY_VERSION
When /^1\.9/
 Require ‘oci8lib_191’

Biz burada “oci8lib_191” yerine “oci8lib_192” yazacağız.
Oci8lib_192 kütüphanesinin yeri: /usr/local/lib/site_ruby/1.9.2/i486-linux

Şimdi sırada bu kütüphanenin yerini metasploite tanımlamak var. Metasploit açıldığında environment variables ları aldığı bir dosya bulunmaktadır. Dosya setenv.sh ‘dır.
Setenv.sh yeri: /opt/metasploit/scripts

Vim setenv.sh ile dosya açılır. Dosyanın içindeki RUBYLIB ruby kütüphanelerinin yerlerini göstermektedir. Buraya bizim oci8lib_192 kütüphanesinin bulunduğu pathi vereceğiz.

“:/usr/local/lib/site_ruby/1.9.2/:/usr/local/lib/site_ruby/1.9.2/i486-linux”

Yukarıdaki değerler RUBYLIB alanına eklenir.

Bu işlemlerin ardından artık oracle ile ilgili auxiliaryleri çalıştırabileceğiz.
 

======================================================================

IF YOU LIKE THIS ARTICLE PLEASE CLICK ADVERTISEMENTS

MAKALEYİ BEĞENDİYSENİZ LÜTFEN SİTEDEKİ İLANLARI TIKLAYINIZ.

======================================================================


11 Nisan 2012 Çarşamba

Firefox Password Internals

Firefox till version 3.5 stores the sign-on secrets in signons.txt file located in the Firefox profile directory. With version 3.5 onwards Firefox started storing the sign-on secrets in Sqlite database file named 'signons.sqlite'. The structure of sign-on information stored in the signons.txt file (signons2.txt for version 2 and signons3.txt for version 3) and signons.sqlite for version 3.5 onwards is described below...
 
For Firefox < version 2.0
  • First comes the sign-on file header which is always "#2c"
  • Next comes the reject host list in clear text, one per line and terminated with full stop.
  • After that normal host list is stored in the following format
    • Host URL
      • Name  (username or *password)
      • Value (encrypted)
      • .(full stop)
 
 For Firefox version 2.0
  • First comes the sign-on file header which is always "#2d"
  • Next comes the reject host list in clear text, one per line and ends with full stop.
  • After that normal host list is stored in the following format
    • Host URL
      • Name  (username or *password)
      • Value (encrypted)
      • Subdomain URL
      • .(full stop)
 
 For Firefox version 3.0 and below 3.5
  • First comes the sign-on file header which is always "#2e"
  • Next comes the excluded host list in clear text, one per line and ends with full stop.
  • After that saved host list is stored in the following format
    • Host URL
      • Name  (username or *password)
      • Value (encrypted)
      • Subdomain URL
      • --- (Dashed line denoting the end of host entry)
      • .(full stop)
 
 For Firefox version 3.5 and above
The new signons.sqlite database file has two tables moz_disabledHosts and moz_logins. The moz_disabledHosts table contains list of excluded websites which are exempted from storing passwords by user. The moz_logins table contains all the saved website passwords. Here is more detailed description of each tables...
  • table - moz_disabledHosts
    • id - index of each entry
    • hostname - blacklisted website URL

  • table - moz_logins
    • id - index of each entry
    • hostname - base website URL
    • httpRealm -
    • formSubmitURL - Actual website hosting URL for which secrets are saved.
    • usernameField - name of username element of form field
    • passwordField - name of password element of form field
    • encryptedUsername - encrypted username
    • encryptedPassword - encrypted password
    • guid - unique GUID for each entry
    • encType - value 1 indicates encrypted

Here each Host entry can have multiple username/password pairs. Starting from Firefox version 2.0, sub domain URL is also included along with username/password entry. If it is the password field then it begins with '*'. This is the key in distinguishing between username and password entry.

Now once the username and password values are extracted, next task is to decrypt them. Information required to decrypt these values is stored in key3.db file. If the master password is set, then you must provide the master password to proceed with decryption. If you have forgotten the master password, then you can use Firemaster tool to recover the master password. If the master password is set and if you have not provided it, then FirePasswordViewer will prompt you to enter the master password.

Firefox 11 Şifrelerini Ele Geçirme

Aslında yeni bir yöntem anlatmayacağım eski versiyonda olan yöntemi güncellenmiş halde veriyorum.

eski versiyonlarda omni.jar olarak bilinen yeni versiyonda omni.ja olarak adı değiştirilen jar dosyası içinde nsLoginManagerPrompter.js adlı dosyada biraz değişiklik yaparak kullanıcı adı ve parola ile girişlerinizin size sormadan otomatik olarak sqlite veritabanına kaydedilmesini sağlıyoruz ve daha FirefoxPasswordViewer programıyla kaydedilmiş bilgileri öğrenebiliyoruz (bu program yerine kendi kodumu geliştiriyorum)

bu dosya içerisinde
canRememberLogin değerini false yapan bütün kısımları iptal edersen tüm parolalar veritabanına kaydedilir.

ayrıca _showSaveLoginNotification parametresini kapatarak da kaydedip kaydetmeyeceği uyarısını engelleyebilirsin ama bence bu uyarı çıksın adam kaydetme dese bile sen arka planda canRememberLogin i değiştirdiğin için kaydedecektir (test etme fırsatım olmadı) 

 Firefox ta kaydedilen şifreleri korumak için master password oluşturabilirsiniz fakat default olarak bu kapalıdır. Varsayalım ki kurban master password koymuş bu durumda 

http://securityxploded.com/firemaster.php

adresinden indirebileceğiniz firemaster uygulaması ile dictionary,bruteforce gibi ataklarla bu şifreyi kırabilirsiniz. 

Firemaster uygulamasının source kodu açık olduğu için oradaki kodları kullanarak kendinizde dictionary hybrid (akıllı dictionarı yani varolan kelimeleri birleştirerek), brute force saldırı yapabilen bir tool yazabilirsiniz