Wednesday, August 13, 2008

Hacking Web Application

Hacking Web Application
พูดถึง "Web" ในวันนี้ ไม่มีใครไม่รู้จัก "World Wide Web" หรือ "www" เพราะการค้นหาข้อมูลในการทำงานโดยเฉพาะคน IT นั้นจะปฏิเสธไม่ได้เลยว่าจำเป็นต้อง "เข้าWeb" เป็นประจำแทบทุกวัน ยกตัวอย่าง ตัวผมเองนั้นเข้า Web ของ "google.com" จนเรียกได้ว่าวันไหนถ้า Web google เข้าไม่ได้ ผมคงต้องรู้สึกหงุดหงิดและมีผลกับการทำงานพอสมควรเลยทีเดียว สำหรับองค์กรในยุค ICT นี้ทุกบริษัทล้วนมี Web Site เป็นของตนเองแทบทั้งสิ้น ส่วนใหญ่เพื่อแสดงข้อมูลที่เปิดเผยได้ต่อสาธารณะ อันได้แก่ ข้อมูลผลิตภัณฑ์สินค้า แผนที่ เบอร์โทรศัพท์ ตลอดจนกิจกรรมต่างๆ ที่ต้องการเผยแพร่ซึ่งองค์กรจำเป็นต้องใช้ "Web Server" ในการจัดทำ "Web Site" โดยปกติทั่วไปแล้ว ข้อมูลจาก http://www.netcraft.com/ ได้รายงานว่า web site ทั่วโลกมีถึงกว่า 40 ล้าน web site ซึ่ง 66.52 % ใช้ Apache (Open Source) เป็น web server และ 24.64 % ใช้ IIS ของ Microsoft เป็น web server (http://news.netcraft.com/archives/2003/06/12/june_2003_web_server_survey.html จาก ข้อมูลใน web site นี้ Hacker สามารถค้นประวัติของ web site เราได้ว่าเคยใช้ web server อะไร และมีการปรับปรุงเปลี่ยนแปลงเช่น Upgrade version หรือลง Patch อะไรบ้าง โดยสามารถ search จาก http://www.netcraft.com/ ได้โดยใส่ชื่อ web site ที่ต้องการค้นข้อมูลลงไป จะได้ผลลัพธ์ในรูปที่ 1

ข้อมูล Version ของ Web Server เช่น Module ต่างๆ ที่เราใช้ จะทำให้ Hacker รู้ข้อมูลที่สามารถนำไปค้นหาช่องโหว่ (Vulnerability) ของโปรแกรมที่เราใช้อยู่ จากนั้น Hacker จะหา "โปรแกรมเจาะช่องโหว่" ที่ในหมู่ Hacker เรียกว่า "Exploit" เพื่อนำมาลองใช้ในการเจาะเข้าสู่ web site ของเรา ปกติแล้ว Hacker มักนิยมไปค้นหาที่ http://packetstormsecurity.nl/ ซึ่งจะมีโปรแกรมจำพวก "Exploit" อยู่มากพอที่ Hacker จะนำไปใช้เจาะระบบ ดูรูปที่ 2

หาก Hacker ไม่สามารถเจาะผ่าน Port 80 (http) หรือ port 443 (https) โดยใช้ Exploit ตรงๆ ได้ hacker ก็จะใช้เทคนิคอื่นในการเจาะ web site ซึ่งได้แก่เทคนิค Cross-Site Scripting (XSS), SQL Injection, Parameter Tampering, Hidden Manipulation, Plain Text Attack หรือ Cookie Poisoning เช่น Parameter Tampering ทำให้เกิด error ขึ้นบนหน้าจอของ Web Browser ในบางที่เราสามารถเห็นถึง Source Code ที่หลุดออกมาจาก error message ที่เกิดขึ้น ทำให้พาไปถึงการ Hack ระบบได้ในที่สุด เทคนิคการเจาะ Web Application นั้น มีอยู่หลายวิธี ส่วนใหญ่แล้ว Hacker จะรู้ว่าเราใช้ Platform ของ Microsoft (Web Server คือ IIS) หรือของค่าย UNIX/ Linux (Web Server คือ Apache httpd) ถ้าหาก Hacker เจาะตัว Web Server ไม่ได้ Hacker จะหาวิธีอื่นในการเจาะ โดยปกติแล้วก็จะดูไปถึงภาษา Script ที่เรานำมาเขียน Code ใช้งาน ซึ่ง Script เหล่านี้ล้วนมีช่องโหว่แทบทั้งสิ้นไม่ว่าจะเป็น ASP, PHP หรือ JSP เราจึงจำเป็นต้องมีการตรวจสอบ Source Code เสียก่อนที่จะนำมาใช้งาน ซึ่งต้องใช้เวลาพอสมควร และ เราควรลองใส่ Parameter แปลกๆ ลงในช่อง URL เพื่อลองดูว่าหากมีการเปลี่ยนแปลงค่า Parameter จะทำให้ระบบมีปัญหาหรือไม่ (Parameter Tampering) เทคนิคที่ Hacker นิยมก็คือการทำ SQL Injection เนื่องจากเมื่อเวลาเราต้องการที่จะ Login (Authentication) เข้าสู่ web site ทาง Web Server จะถาม "Username" และ "Password" ของเรา เมื่อเราใส่ Username และ password แล้ว Browser ก็จะนำข้อมูลไป check กับฐานข้อมูลในลักษณะ select * from table where user_name = "username" จากการที่เราใช้ "where clause" ในการเขียน web application เพื่อการค้นข้อมูลของ user ซึ่งในการเขียนโปรแกรมนี้จะดูง่าย แต่ในทางมุมมองของ Hacker นั้น Hacker จะใช้ วิธีใส่ SQL command แปลกๆ เพิ่มเติมเข้ามาใน SQL Query เพื่อดึงข้อมูลที่ Hacker ต้องการออกมาจาก Web Site ของเรา Hacker สามารถใช้โปรแกรมประเภท Sniffer ในการตรวจจับข้อมูล User name และ password เช่นโปรแกรม Cain จาก Web Site: http://www.oxid.it/ มาดักจับ password เวลาที่ user ทำการ log on เข้าสู่ Web Application ถ้า Web Server ไม่ได้ใช้ SSL (Secure Socket Layer) กับ Web Server ข้อมูลที่ใช้ http ซึ่งเป็น Plain text ที่ไม่ได้รับการเข้ารหัสก็จะถูกโปรแกรม Cain ตรวจจับได้อย่างง่ายดาย (ดูรูปที่ 3)




Wednesday, April 02, 2008

Email trace guide AOL mail

AOL mailAOL Desktop software does not show headers, so you need to connect to email through http://www.aol.com/ via any browser. The View Message Source from context menu allows seeing headers.


You need right-click the message in the message list



then click View Message Source AOL open new window to show headers





Trace IP From Hotmail

HotmailAs described in hotmail help:
To view the e-mail header information:
In the left pane, click Mail.
In the Folders list, click Inbox.
Right-click the message in the message list, and then click View source.

Please note, this does not work on the classic version of Windows Live Hotmail,
you should use full version of Hotmail.



Right-click the message in the message list



then click View source


Hotmail open new tab to show headers


Trace Gmail IP Address

GMailIn Gmail you need to open 'original' email In menu choose 'Show original'


First click for menu



GMail opens original email in new window or tab

How to see email headers on Yahoo, Gmail, Hotmail and AOL Mail

วิธีการดูไอพี จดหมายที่ส่งมาให้เราที่ยาฮู
Yahoo MailOn Yahoo Mail you need to click "Full header" from menu "Compact header" while you see message.
1เลือกดังภาพที่ 1 ดูส่วนหัวจดหมาย แล้วเลือก full header เลย
click Compact header first


Now choose Full header



Headers in Yahoo Mail shown in pop up window




วีธีการอ่านค่า ไอพีเช่นเดียวกันกับวิธีอ่านค่าด้วย outlook Express
ดูที่ Received: from [computer name and/or IP address from sender]
by [server name] (maybe Internet protocol too); date

Sample:
Received: from [67.66.123.205]
by web41013.mail.yahoo.com via HTTP; Sun, 25 Apr 2004 23:13:34 PDT

Briefly this means that the server web41013.mail.yahoo.com received the message from the IP address 67.66.123.205 on the 25th of April 2004, at 11:13:34 pm PDT via the HTTP protocol (i.e. through the web).
หมายถึง เซิฟร์เวอร์ของยาฮู ได้รับอีเมล์จากหมายเลขไอพี 67.66.123.205 ในวันที่ 25...
นำเลขไอพี่นี้ไปตรวจเช็คกับเวบไซต์ด้านล่างได้
http://www.geobytes.com/iplocator.htm?getlocation

http://whatismyipaddress.com/




Tuesday, April 01, 2008

How To Find the Sender's Original IP

วิธีการค้นหา IP จริงของผู้ส่งเมล์ โดยท่านรับเมล์ด้วยบริการของโปรแกรม outlook Express
How To Find the Sender's OriginalIP Address Using Email Message Headers
ผู้ที่ใช้บริการอีเมล์ของ outlook Express อยู่ และต้องการทราบว่าเมล์ฉบับที่ส่งมานั้น ส่งมาจากที่ใด เราสามารถรู้ได้
ด้วยการดู ไอพี และ นำหมายเลขไอพี ไปตรวจเช็คได้ที่เวบไซต์ http://www.geobytes.com/iplocator.htm?getlocation
หรือดูที่ลิงค์ในคอมเมนท์ด้านล่างจะรวบรวมเวบไซต์ที่เช็คไอพีไว้
เราต้องการรู้เบอร์ไอพี ไปทำไม
- เมื่อคุณต้องการรู้ว่าคนที่เราติดต่อด้วยขณะนี้อยู่ทีประเทศใดกันแน่
- เมื่อคุณต้องการบล๊อคการติดต่อ บล๊อคพวกสแปมเมล์ให้บล๊อคด้วยเบอร์ไอพีได้
- ตรวจเช็คได้ว่าขณะนี้เบอร์ไอพีนี้กำลังออนไลน์อยู่หรือไม่
- มีอีกร้อยแปดอย่างที่เราสามารถทำได้ทั้งดีและไม่ดีกับไอพีแอดเดรสเหล่านี้ จำไว้ว่า ไม่มีความลับในโลกนี้ เพียงแต่ยังไม่ได้ค้นหาเท่านั้นเอง ฯลฯ

Theory...
Email messages, as in the case of their non-electronic cousins, have "envelopes" of a sort. In the case of email the envelope is composed of a series of "Headers". These are just a series of lines of characters which precede the actual email message. Email programs such as Outlook do not normally display these Headers when displaying a message. From these Headers however, the email program is able to extract important information about the message, such as the message encoding method, the creation date, the message subject, the sender and receiver, etc.
Moreover, just as a postal envelope contains an address, a return address and the cancellation stamp of the post office of origin, an email message in these "Headers" carries with it a history of its journey to your email inbox. Because of this, it's possible to determine the original IP address of the sender.
Since email programs do not normally display these Headers, we must first learn how to display them. Depending on the program, this is done in a variety of ways. The following sequence details the way to do this using the Windows default email program, "Outlook Express". First, select "Properties" from the "File" Menu, or just press ALT+Enter. Next, select the "Details" tab.

เอาล่ะเปิดโปรแกรม outlook Express ขึ้นมา ดูตามภาพด้านล่าง
1.คลิ๊กที่เมนู file เลือก Properties จะเห็นข้อมูลผู้ส่งทส่วนี่หัวด้านบนของอีเมล์


Open Outlook Express menu to see email headers



Here's how to view the Headers in the Microsoft Office version of Outlook:

Open a message.
On the View menu, click Options.Note:If you do not see the Options command, make sure you click View on the toolbar in an open message window. The View menu on the standard Outlook toolbar does not have the Options command.
The Header information appears under the Delivery options in the Internet Headers box.

วิธีการดูำไอพี
1.เปิดอีเมล์ที่ต้องการดูขึ้นมา จากนั้น
2.คลิ๊กที่เมนู View เลือก Options
3.ก็จะมองเห็นส่วนหัวของจดหมาย ที่นี้ก็มองหาคำว่า Received: from

Headers in MS Office


Header Name
Header Data
Sample
To:
The name and email address of the recipient
To: "John Doe"
From:
The name and email address of the sender
From: "Alice Smith"
Date:
Date the message was created
Date: 1 Nov 2004 22:49:20 -0000
Subject:
The subject of the message which follows the Headers
Subject: How are you?
Return-Path:
The email address for responding to the message
Return-Path:
Received:
Delivery stamp
Received: from [67.66.123.205] by web41013.mail.yahoo.com via HTTP; Sun, 25 Apr 2004 23:13:34 PDT

----------------------ตัวอย่างการอ่านค่าไอพี--------------------

Received: from [computer name and/or IP address from sender]
by [server name] (maybe Internet protocol too); date.

Sample:
Received: from [67.66.123.205]
by web41013.mail.yahoo.com via HTTP; Sun, 25 Apr 2004 23:13:34 PDT

Briefly this means that the server web41013.mail.yahoo.com received the message from the IP address 67.66.123.205 on the 25th of April 2004, at 11:13:34 pm PDT via the HTTP protocol (i.e. through the web).
หมายถึง เซิฟร์เวอร์ของยาฮู ได้รับอีเมล์จากหมายเลขไอพี 67.66.123.205 ในวันที่ 25...
นำเลขไอพี่นี้ไปตรวจเช็คกับเวบไซต์ด้านล่างได้
http://www.geobytes.com/iplocator.htm?getlocation

http://whatismyipaddress.com/

Saturday, August 26, 2006

I am What I am



Work likes you don't need money
Dance likes no one watching !
Love likes you'v never been hurt!
......................................................
Who care about your life.?
More Property , More riches
Finally
you can't take it with you when you die!

comeon!! go with me hang aroung the world and Have Fun