Tuesday, February 19, 2008

Cross Site Scripting @ XSS

XSS
  • curi cookies
  • 1 teknik yg digunakan oleh attacker utk hantar sebrg script pd web user.
  • berlaku pd aplikasi web
  • script yg biasa digunakan oleh XSS Javascript@VBscript utk mdptkn cookies

  • cth :
  • masukkan script (vbscript) utk buatkan (dokumen.cookies) & dptkn cookies tsbt copy & paste pd website / pc.
  • website rujukan http://www.milw0rm.com

Definisi umum:

Mana2 attacker akan hantar script pd website user yg ada vulnerability, x kira mana2 script php,html script atau lain2 yg digunakan dihantar pd website user / aplikasi web utk bypass @ masuk website tsbt.
* cara utk hack komputer : (ada byk cara )
  1. SQL Injection
  2. Remote Injection
* masukkan
  • guestbook
  • upload file



"What is Cross Site Scripting?"

Cross site scripting (also known as XSS) occurs when a web application gathers malicious data from a user. The data is usually gathered in the form of a hyperlink which contains malicious content within it. The user will most likely click on this link from another website, instant message, or simply just reading a web board or email message. Usually the attacker will encode the malicious portion of the link to the site in HEX (or other encoding methods) so the request is less suspicious looking to the user when clicked on. After the data is collected by the web application, it creates an output page for the user containing the malicious data that was originally sent to it, but in a manner to make it appear as valid content from the website. Many popular guestbook and forum programs allow users to submit posts with html and javascript embedded in them. If for example I was logged in as "john" and read a message by "joe" that contained malicious javascript in it, then it may be possible for "joe" to hijack my session just by reading his bulletin board post. Further details on how attacks like this are accomplished via "cookie theft" are explained in detail below.


Reference : http://www.cgisecurity.com/articles/xss-faq.shtml#whatis

Tuesday, February 12, 2008

SQL Injection

Apa itu SQL Injection ?
  • Vulnerable system / internet website

  • Magic code

  • code string -> 'a or 'a' = a'

  • a' or 't'='t
    Pada username masukkan = admin
    Password “ = `1 or `1`=`1

    Atau

    Pada username masukkan = `1 or `1`=`1
    Password “ = `1 or `1`=`1

    Sistem tidak dapat detect ( ` `@ ` ` ) krn x ada username / password (user/pengguna) yg letak spt itu melainkan string shj spt 1 or 1 = 1, tidak `1 or `1`=`1.

SQL injection is a technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is in fact an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another.


Reference: Wikipedia, the free encyclopedia



Tujuan SQL injection :
  • DOS ( Denial of services)

  • Access / akses

  • Modify


HOW TO PROTECT FROM SQL INJECTION

  • protect di application level

  • server level

  1. if...else statement ( di bhg login )

  2. escape ' 1 ' single code

  3. parameter statement

4. Username -> email


password -> password

(Berikut adalah contoh coding SQL utk paparan interface di atas )


$ SQL = " SELECT nama_penyelia, tahap_penyelia, id_penyelia

FROM penyelia WHERE username = '$name' and

password = '$pass';



* Letakkan coding dibawah utk prevent SQL Injection : ataupun syarat dimana jika ada Hackers yg letakkan Magic Code x' or '1' = '1 maka website telah detect & akses tidak dibenarkan.

* variable name dihantar / dibaca dari belakang ke depan iaitu :

Tujuan if...else statement = utk - > (jika website sendiri)

  1. check $name contain
  2. reject- jika ada single code / reject jika true

* Server + mod security + Apache ( utk prevent injection di server jika melibatkan byk website)

* Setkn single code + SQL code (Magic string) di server utk reject sebarang cubaan hack.


Sniffer

Sniff = hidu @ menghidu data yang dihantar antara pc.

Sniffer = tools untuk hidu.

Network sniffer & Packet Sniffer.

Free useful sniffer software from internet :
  1. Cain

  2. Ethercap
Dimana kedua-duanya menggunakan konsep MITM.

Objektif :
  • untuk sniff apa yang pc orang lain buat (aktiviti)

  • alat / tools untuk hack password, poison network, email
Sniffer
  • plain -> hidu

  • MITM ( Men in the middle)


Skill set : (untuk mahir menggunakan sniffer)
  1. Ip Addressing

  2. Indentify - (target (tahu pc mana yg dikehendaki) & source

  3. Ptotokol - Tcp/Ip

  4. Filtering

htttps = guna port 443

http = port 80

Ms Outlook / email sistem = 25 & 110

Utk sniff ke google, tindakan yg perlu dilakukan :
  • Sniff ke pc D & sniff ke router shj krn laluan yang sama akan dilalui utk sniff & google menghantar semula penghantaran (jwpn)
  • Tetapi apabila aktiviti sniff dilakukan pc A @ lain2 pc tidak dapat sniff / lakukan aktiviti lain kerana kekacauan (sniff) menyebabkan network menjadi slow.

Monday, February 11, 2008

Tools yg telah dipraktikkan cara pengggunaannya.

UTP backbone cable


Serial Cable

Router back


Router back



Console Cable
Cisco router2600





Monday, February 04, 2008