tag:blogger.com,1999:blog-46538555519135004902024-03-18T10:58:44.271+08:00Web Security Notes安全的學問。wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.comBlogger68125tag:blogger.com,1999:blog-4653855551913500490.post-12118340078846838872014-01-11T15:42:00.002+08:002014-01-13T16:55:40.979+08:00Kali 工具介紹 Recon-ng<h2>
</h2>
<h3>
<b>用途</b></h3>
利用第三方服務和主動爬行的方式,搜尋人名、帳號、email、被動或主動查詢網站資訊的工具。版本是1.4.1 @ kali 1.0.5。模組區分為三大類,偵察Reconnaissance、發現Discovery與彙報reporting。<br>
1.Recon被動偵查模組<br>
Contact 以姓名拼湊真實資訊<br>
Creds 以帳號或email 搜尋被洩漏的密碼<br>
Hosts以網站名或 ip搜尋系統資訊<br>
Pushpin 以地理資訊蒐集社群資料<br>
2.Discovery 主動掃描模組<br>
Exploitable 掃可利用弱點資訊<br>
Info_disclosure 掃系統資訊揭露<br>
3.Reporting 彙整報告模組<br>
<br>
<h3>
<b>基本指令</b></h3>
在主選單可以使用以下指令來,設定全域變數、查詢模組介紹、搜尋或列出模組清單、下sql指令查詢資料庫<br>
set 全域參數 <br>
set company hinet<br>
set domain www.hinet.net<br>
set proxy [ true | false ]<br>
set proxy_server 127.0.0.1:8080<br>
set socket_timeout 30(預設只有10秒很容易timeout)<br>
set user-agent 瀏覽器標頭<br>
search 關鍵字(找特定模組的全名)<br>
use 模組全名<br>
query <sqlquery>(可以查內建的DB資料表)<br>
show modules (模組) 、options (模組設定)、schema (資料表結構)、table (資料表內容)<br>
<br>
進入模組之後,可以查詢模組介紹、設定模組內的變數、執行模組功能<br>
info 顯示模組介紹和輸入參數 <br>
run 執行模組功能<br>
<br>
<a href="https://likewaylai.blogspot.com/2014/01/kali-recon-ng.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com1tag:blogger.com,1999:blog-4653855551913500490.post-12508789074953049032013-09-10T14:57:00.000+08:002014-01-13T17:04:23.340+08:00Hackthissite Programming 第11關心得題目網址:https://www.hackthissite.org/missions/prog/11/<br>
<br>
本關重點:眼明手快<br>
<br>
題目:Reverse Ascii Shift<br>
<blockquote class="tr_bq">
This string was randomly generated. It will not be recognizable text. You have 3 seconds to take the information from the website, and apply that to your algorithm.<br>
Generated String: <i>82%102%64%75%114%101%91%107%72%90%</i><br>
Shift: <i>29</i></blockquote>
大意是給你一串任意ascii碼,以任意特殊符號分隔。目的是把這一串ascii碼減去某個數字後,再還原成字元輸出。限制3秒鐘內...難就難在3秒鐘內要回答。<br>
<br>
<b>安全限制</b><br>
<br>
原本想要把網頁內嵌在iframe中,當題目載入後,就從外框去抓內框的ascii碼,處理之後再submit。但是會違反<a href="http://en.wikipedia.org/wiki/Same-origin_policy" target="_blank">相同來源政策</a>,瀏覽器不讓我這樣搞。所以只能另外想辦法。<br>
<br>
想到的方法有兩種,一種是用windows shell script登入網站讀取題目和關鍵字,處理完轉碼之後在送出表單,可是我覺得這樣很花時間,而且題目和關鍵字沒有特定的html tag包起來,只能讀取整個頁面,怕效率不好。第二種方法就是人工複製題目,寫一支小程式來轉碼,複製貼上進行轉碼,得到答案後再貼回答案欄。<br>
<br>
<b>用javascript寫小程式的限制</b><br>
<br>
因為我懶惰,所以直接用javascript寫了小程式,這才發現,題目中的ascii碼有時候會超過html可以顯示的字元範圍(譬如:換行字元、刪除字元、esc字元等等)。還好經過多次嘗試之後,總是會有能正常顯示的組合出現,因此我勉強用了兩三個小時解開題目。當我解開時,也決定下次要採用更有效的方法。(想嘗試你的手速可以用這支下面小程式來玩玩)<br>
<a href="https://likewaylai.blogspot.com/2013/09/hackthissite-programming-11.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-59652578018662035442013-04-12T16:00:00.002+08:002013-04-12T16:08:46.523+08:00以 SharpPcap 實作可收聽封包的 C# 程式(winform)上一篇<a href="http://likewaylai.blogspot.tw/2012/03/sharppcap-c.html" target="_blank">文章</a>是介紹如何撰寫簡單的console程式,這篇將分享我實作 SharpPcap winform 程式的心得和遇到的問題。<br>
<br>
<b>winform表單設計</b><br>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8_oki70Hq-74gi-woDx2coTryVstu6XvYM-6YIjeS4I8ZnpIiRvVAR2ci_JBQxWWJotZe5dy-qjaGWXe3thFDXkaYh-8jOuiUrTzt7Ke4xJ7r-J-VXvX-Kxj1krHyz1AbyD9wEQotN1Ai/s1600/sharpcapwinform1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="282" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8_oki70Hq-74gi-woDx2coTryVstu6XvYM-6YIjeS4I8ZnpIiRvVAR2ci_JBQxWWJotZe5dy-qjaGWXe3thFDXkaYh-8jOuiUrTzt7Ke4xJ7r-J-VXvX-Kxj1krHyz1AbyD9wEQotN1Ai/s400/sharpcapwinform1.png" width="400"></a></div>
<span id="goog_1354993817"></span>一個TextBox,作用是輸入過濾封包的filter到TextBox。<br>
一個ListBox,作用是選擇ListBox中的網卡設備。<br>
兩個Button。作用是開始時按下開始監聽按鈕,結束時按下停止監聽。<br>
<br>
<b>form.cs程式碼</b><br>
設定完介面之後,我在 form.cs 引用 SharpPcap 的元件,並在Form class中先宣告網卡設備清單。然後在 Form 的初始函式中獲取網卡清單並在入到 Listbox 中。<br>
<br>
<code class="prettyprint">
using SharpPcap;<br>
using SharpPcap.LibPcap;<br>
using PacketDotNet;<br><br>
namespace webcam_alarm_for_skype<br>
{<br>
public partial class Form1 : Form<br>
{<br>
LibPcapLiveDeviceList devicelist = LibPcapLiveDeviceList.Instance;<br>
public Form1()<br>
{<br>
InitializeComponent();<br>
for (int i = 0; i < devicelist.Count; i++)<br>
{<br>
ListBox.Items.Add(devicelist[i].Description);<br>
}<br>
}<br>
}<br>
}<br>
</code>
<br>
<br>
<a href="https://likewaylai.blogspot.com/2013/04/sharppcap-c-winform.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-42664357609100043622013-03-20T11:28:00.001+08:002013-03-20T12:36:47.639+08:00Hackthissite Programming 第1關心得題目網址:https://www.hackthissite.org/missions/prog/1/<br>
<br>
本關重點:字串處理、搜尋<br>
<br>
題目:Unscramble the words<br>
<br>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTTNbBrTo6OFil2So44FusUyF3AZa30vrpTKHCHMpl4x2AgTCKm5kIFji8OM9z6nFjuY5cRXU8FdafLFXY3ebg854qTZR-iRqifCiNgIoeB1vsfJMC2f7wsTQTT1dWVTROQGbUEl9e2cyW/s1600/hts_pro_lv1.PNG" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTTNbBrTo6OFil2So44FusUyF3AZa30vrpTKHCHMpl4x2AgTCKm5kIFji8OM9z6nFjuY5cRXU8FdafLFXY3ebg854qTZR-iRqifCiNgIoeB1vsfJMC2f7wsTQTT1dWVTROQGbUEl9e2cyW/s320/hts_pro_lv1.PNG" width="100"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">原始單字清單</td></tr>
</tbody></table>
You have to find the original (unscrambled) words, which were randomly taken from a wordlist.
This level is about unscrambling words.
Find the original (unscrambled) words, which were randomly taken from a wordlist.
Send a comma separated list of the original words, in the same order as in the list below.
You have 30 seconds time to send the solution.<br>
List of scrambled words:<br>
<blockquote class="tr_bq">
<div style="text-align: center;">
tsreaeh</div>
<div style="text-align: center;">
erxotp</div>
<div style="text-align: center;">
rtoatrc</div>
<div style="text-align: center;">
pdazoh</div>
<div style="text-align: center;">
abomob</div>
<div style="text-align: center;">
stieccl</div>
<div style="text-align: center;">
ruconyt</div>
<div style="text-align: center;">
sbownr</div>
<div style="text-align: center;">
kmfcue</div>
<div style="text-align: center;">
swleov</div>
<div style="text-align: center;">
(重新排列的十個單字)
</div>
</blockquote>
<br>
題目會先給你一千多個單字的題庫,每個單字之間以換行字元隔開。接著會要求你在30秒之內把重新排列過的其中10個單字(如題)找出來,最後以逗點方式隔開答案。<br>
<br>
<b>整理單字題庫的字元數</b><b>和ASCII碼,</b><br>
<br>
一千多個單字,解題時間卻只有30秒,如果逐個字元比對,平均7個字元長度的10個重新排列單字需要 (1000+500+250+125+62+31+15)*字元比對*7*10,再加上暫存題庫的空間。我想可能不是個有效率的方法。因此我們先將題庫整理一下,列出所有單字的字元數和ascii碼然後以相同順序儲存到暫存陣列。依序進行字元數比對、ascii比對、逐字元比對,我估計計算時間可以減少為 (1000*字元長度比對+200*acii碼比對+5*字元比對*7)*10。<br>
<a href="https://likewaylai.blogspot.com/2013/03/hackthissite-programming-1.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-3241961599936337272013-03-15T16:03:00.000+08:002014-01-11T10:44:29.716+08:0032 bits Windows 8 如何使用 4GB 以上記憶體(windows 8.1更新)原始網頁:<a href="http://wj32.org/wp/2012/12/26/pae-patch-updated-for-windows-8/" target="_blank">PAE patch updated for Windows 8</a> by wj32<br>
<br>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLiBLYyNnKfCO3Fg7SvFODs_INkAeakJhCQcqBJhVx_ARHN8Re-z7McIF8JPdtFO3nTFcwIuiVw5zpeSwiAVF6CE4NRAzBPS2eCpRsTXtscmEK0c1TRNBIjJ97uVpKyfJnucQTMR20Y5Ia/s1600/win+8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLiBLYyNnKfCO3Fg7SvFODs_INkAeakJhCQcqBJhVx_ARHN8Re-z7McIF8JPdtFO3nTFcwIuiVw5zpeSwiAVF6CE4NRAzBPS2eCpRsTXtscmEK0c1TRNBIjJ97uVpKyfJnucQTMR20Y5Ia/s1600/win+8.png"></a></div>
PAE技術出現之後,很多人質疑 32 bits Windows OS 為什麼不能像32 bits linux 使用4 GB以上的記憶體,為什麼 XP sp1 曾經支援過 PAE 後來sp 2、sp 3卻被封印,面對問題微軟只有笑而不答。因此網路上很多解決方案(<a href="http://www.ehow.com/how_6392410_enable-32-bit-windows-xp.html" target="_blank">How to Enable PAE on a 32 Bit Windows XP</a>、<a href="http://www.unawave.de/windows-7-tipps/32-bit-ram-barrier.html?lang=EN" target="_blank">Windows 7 32-bit with full 4 GB or 8 GB RAM support</a>),只為了開啟被微軟封印的 PAE 技術。其中Windows 8 的解決方案卻付之闕如,有些人像我一樣因為透過 <a href="http://www.soft4fun.net/news/439-upgrade-to-windows-8.htm" target="_blank">微軟 Windows 8 促銷</a> 買到經濟實惠的作業系統。但是升級過程卻沒得選擇,只能直接從 32 bit XP 到 32 bit Windows 8。這下可好了,揪竟該如何讀取4 GB以上的記憶體呢?<br>
<br>
<b>32 bit Windows 8 專用Patch</b><br>
<br>
神人 wj32 提出的 <a href="http://wj32.org/wp/2012/12/26/pae-patch-updated-for-windows-8/" target="_blank">Patch </a>正好可以解決這個問題,使用前請先移除所有你曾用過的RAM Patch,並記得先備份系統。<br>
<a href="https://likewaylai.blogspot.com/2013/03/32-bits-windows-8-4gb.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-25566961014049561562013-03-06T16:07:00.001+08:002013-03-20T11:28:36.924+08:00Hackthissite Realistic 第15關心得<b>網址:</b>http://www.hackthissite.org/missions/realistic/15<br>
<br>
<b>本關重點:</b>耐心、zip檔解密、php可變變數、雜湊值還原、Linux指令、C語言緩衝區溢位<br>
<br>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPSJ9O0yS18wjfWA-ZNZbzg39KbS-YcgDxJATDSlWjfnzEmM3IEjbDhVqRvEUwOrLRIsiblOEY571jkb3tq0Nk0wP8ii4MczyvRsnQe1GkKIHKTcTA0dG835SbBhNGQwtsbaxtjroXBxNC/s1600/real+15.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="148" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPSJ9O0yS18wjfWA-ZNZbzg39KbS-YcgDxJATDSlWjfnzEmM3IEjbDhVqRvEUwOrLRIsiblOEY571jkb3tq0Nk0wP8ii4MczyvRsnQe1GkKIHKTcTA0dG835SbBhNGQwtsbaxtjroXBxNC/s640/real+15.PNG" width="640"></a>
</div>
<b>題目:Simple Mail</b><br>
<blockquote class="tr_bq">
Message: Hi, please help me if you are against war like me. Rumours are saying that the seculas Ltd. company is developing an awful new laser aided weapon, and that they already have patents pending. Please try to find out what their latest patents are about. People say you know your shit and that you are an amazingly good hacker. It should not be a prob for someone with your skills. What I know is that seculas Ltd. hired a new programmer who is responsible for the server, and he passworded everything and always with different passwords. I heard about him, he is one the kind who locks the front door twice and leaves the back-door open.<br>
If you think like me please help me and fight those people that make money with war.
</blockquote>
大意就是, 某軍火商正在製造可怕的雷射武器,希望你阻止軍火商申請新的專利,並查出他們的專利內容有哪些。題目透漏一個有用的情報,維護官網的工程師雖然都有將資料加密,但卻是個粗心的人。<br>
<br>
<b>搜尋重要目錄和程式</b><br>
<br>
就跟所有web滲透的題目一樣,先找出重要的目錄、或程式。並且尋找可以注入變數的欄位。<br>
index.php<br>
products.php<br>
questions.php................似乎不能注入<br>
storequestion.php.........似乎不能注入<br>
imprint.php<br>
jobs.php<br>
application_form.php....似乎不能注入
<br>
storeapplication.php......似乎不能注入<br>
images/<br>
沒甚麼用的圖片們
<br>
<a href="https://likewaylai.blogspot.com/2013/03/hackthissite-realistic-15.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-17588128367480321712013-02-01T16:28:00.000+08:002014-01-13T17:03:42.644+08:00Hackthissite Realistic 第6關心得<b>網址:https://www.hackthissite.org/missions/realistic/6/index.html</b><br>
<b><br></b>
<b>本關重點</b>:XEcryption弱點、已知明文攻擊<br>
<b><br></b>
<b>題目</b>:From: ToxiCo_Watch<br>
<blockquote class="tr_bq">
Message: Hello esteemed hacker, I hope you have some decent cryptography skills. I have some text I need decrypted.<br>
I work for this company called ToxiCo Industrial Chemicals, which has recently come under fire because of the toxic chemicals we are dumping into the river nearby. Ecological inspectors have reported no problems, but it is widely speculated that they were paid off by ToxiCo management because the water pollution near the ToxiCo factory has always been a serious and widely publicized issue.<br>
I have done some packet sniffing on my network and I have recovered this email that was sent from the CEO of the company to Chief Ecological Inspector Samuel Smith. However, it is encrypted and I cannot seem to decode it using any of my basic decryption tools. I have narrowed it down to the algorithm used to encrypt it, but it is beyond my scope. I was hoping you can take a look at it.<br>
Please check it out,<br>
more details are on the page. If you can unscramble it and reply to this message with the original text, it would be much appreciated. Thank you.</blockquote>
大意是熱心的環保駭客攔截到化學公司內部的信件,其內容可以幫助社會大眾了解公司真面目。但信件已被加密,於是請你解密(題目有提醒你加密演算法是 XEcryption )。<br>
<br>
<a href="https://likewaylai.blogspot.com/2013/02/hackthissite-realistic-6.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-72816233473354877462012-09-08T16:40:00.000+08:002013-03-07T00:21:50.044+08:00資安JAVA(三六):解決SQL injection來源:<a href="http://www.jtmelton.com/2012/09/07/year-of-security-for-java-week-36-solve-sql-injection/" target="_blank">John Melton's Weblog</a><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 36 – SOLVE SQL INJECTION<br>
作者:John Melton<br>
<br>
<b>What is it and why should I care?</b><br>
<br>
<div>
SQL注入漏洞是因為沒分開處理程式碼和資料而產生。一般而言,開發者善意的設想使用者輸入內容都是資料,但攻擊者自訂輸入內容讓資料庫誤認為命令執行。這裡有些<a href="http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/" target="_blank">SQL注入攻擊事件</a>,造成財務的、政治的或名譽的損失。若你了解C語言exec函數的問題,你應該認同防護SQL注入的重要性。<br>
<br>
</div><a href="https://likewaylai.blogspot.com/2012/09/security-java-no36-solve-sql-injection.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-36273421152711379442012-08-31T16:37:00.000+08:002013-01-17T21:31:14.789+08:00資安JAVA(三五): 一次解決一個問題來源:<a href="http://www.jtmelton.com/2012/08/30/year-of-security-for-java-week-35-solve-security-problems-one-at-a-time/" target="_blank">John Melton's Weblog</a><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 35 – SOLVE SECURITY PROBLEMS ONE AT A TIME<br>
作者:John Melton <br>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS-eJ5OKNOtQW8ZqaA5PBauaYMKB3cnK01lDhhRxMyZjMtvz5jIEFy47xw0I32IAtDQBYu8uS-rglz8p4MkU6hd-3l0zr1sS48XV0craF3Ssk1ZPXYt2pv-j2qFyoAY-5ubqUH2E2irwTJ/s1600/plan-a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="211" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS-eJ5OKNOtQW8ZqaA5PBauaYMKB3cnK01lDhhRxMyZjMtvz5jIEFy47xw0I32IAtDQBYu8uS-rglz8p4MkU6hd-3l0zr1sS48XV0craF3Ssk1ZPXYt2pv-j2qFyoAY-5ubqUH2E2irwTJ/s320/plan-a.jpg" width="320"></a></div>
<br>
<b>What is it and why should I care?</b><br>
<br>
本篇文章與技術沒有太大關係,主要是討論解決資安問題的流程。<br>
<div>
<br>
真實生活中的資安廠商通常跟消防員一樣。一通電話"救命阿,我們的網站被駭了,快幫我們修好!"是一天中最平凡的開場白。我們常常忙於亡羊補牢,而沒有解決問題來源,也沒有減少弱點被人利用的機會。<br>
<br>
所以,問題持續存在。<br>
<br>
要根本解決Web的安全問題,我們不能等到事情發生才關心。我們必須要提早想到可能的問題,並提出解決方案。<a href="https://buildsecurityin.us-cert.gov/">building security in</a> 網站教你從開發階段就該注意的事情,<a href="http://bsimm.com/" target="_blank">bsimm.com</a> 則收集了許多知名軟體公司對於安全所做的努力。<br>
<br>
然而,我們常犯了想要同時解決所有看起來都很嚴重問題的毛病。卻忘了風險優先順序。只有讓所有相關人員來開會,詳細說明安全問題,才能釐清問題順序。<br>
<br>
假設以下兩種跟效能( performance )有關的情境。<br>
1. 當你有一個跑得很慢卻又常常被執行的函式。有天你看不下去了,直接改寫成更有效率的版本,並取代舊版本。系統效能立即提升,減少浪費的時間。<br>
<br>
2.當你有個跑得很慢的跨應用程式查詢句。你可以升級資料庫的硬體、更換資料庫供應商、增加應用程式的快取空間、最佳化查詢句等等。但是這些調整都牽涉到很多軟硬體的設定,你需要計畫,不能說改就改。<br>
<br>
某些資安的問題也是一樣,有些問題可以像1.的情境,直接修改。有些問題(sql injection、xss)則像2.,需要妥善的計畫。<br>
<br>
<br>
</div><a href="https://likewaylai.blogspot.com/2012/08/security-java-no35-solve-security-problems-one-at-a-time.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-13635919656661388872012-08-22T16:34:00.000+08:002013-01-17T19:15:57.241+08:00資安JAVA(三四): 分離管理者功能來源:<a href="http://www.jtmelton.com/2012/08/21/year-of-security-for-java-week-34-separate-admin-functionality/" target="_blank">John Melton's Weblog</a><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 34 – SEPARATE ADMIN FUNCTIONALITY<br>
作者:John Melton<br>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVTZreooSTM9aSpzzNGYxaYmAvvyA0VuoW1LMKZFJ87RYxFWFnQztsugFEmN1MVXB6nL21hh1addInB6oaH2x3DMRY_BF4KhL4amrvAU0txBhv-iGvV1MmRFlfw4B3dl9zpysNR41V8hoU/s1600/irobot.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVTZreooSTM9aSpzzNGYxaYmAvvyA0VuoW1LMKZFJ87RYxFWFnQztsugFEmN1MVXB6nL21hh1addInB6oaH2x3DMRY_BF4KhL4amrvAU0txBhv-iGvV1MmRFlfw4B3dl9zpysNR41V8hoU/s1600/irobot.png"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><br></td></tr>
</tbody></table>
<b>What is it and why should I care?</b><br>
<br>
或許有人會認為將管理者功能從系統中切出來很奇怪。但作者定義的管理者功能是更高的權限(使用者、群組、角色的管理),因為非法提權(privilege escalation)會對應用程式產生很大的影響。作者對於管理功能的想法是:<br>
<ul>
<li>擁有可以管理使用者的重要功能</li>
<li>假設被人以不正方式利用,使用者的權限可以增加或被移除</li>
<li>不管任何狀況,作者並不相信可以完美的保護這些功能</li>
</ul>
你可能不同意作者,尤其是第三點,你也許覺得自己的應用程式超安全。作者的經驗中,大部分應用程式本身都有設計上的漏洞,如果管理者功能被有心人利用,那被公布的系統弱點造成的影響就更大了。<br>
<a href="https://likewaylai.blogspot.com/2012/08/security-java-no34-separate-admin-functionality.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-88802333332127488362012-08-14T16:32:00.000+08:002013-01-17T19:15:10.446+08:00資安JAVA(三三): Access Control (3)來源:<a href="http://www.jtmelton.com/2012/08/14/year-of-security-for-java-week-33-access-control-3/" target="_blank">John Melton's Weblog</a><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 33 – ACCESS CONTROL (3)<br>
作者:John Melton<br>
<b>What is it and why should I care?</b><br>
<br>
<a href="http://likewaylai.blogspot.tw/2012/08/security-java-no31-access-control-1.html" target="_blank">前前一篇</a> 已經提過 Access Control 的定義了。<br>
<br>
<b>What should I do about it?</b><br>
<br>
<a href="http://likewaylai.blogspot.tw/2012/08/security-java-no31-access-control-1.html" target="_blank">part1</a> 我們談到以功能性來限制使用者的行為、<a href="http://likewaylai.blogspot.tw/2012/08/security-java-no32-access-control-2.html" target="_blank">part2</a> 我們將資料存取也列入考量。接下來,我們將討論更多普遍適用於限制使用者的因素。根據資料的不同類型我們可以增加某些情境資訊來限制使用者的行為。我將列出幾點常見的情境,由你來繼續列下去,並套用到你的應用程式環境中。<br>
<br>
<i>Date / Time</i><br>
每天的某些時段可當作是否允許存取應用程式的重要條件。例如,你可以限定員工在星期一到星期五的AM 08:00-PM 18:00 才能進入系統。上班時段以外,員工只能有少許的使用權限。另外一種方式是,限制每24小時只有6小時能執行特殊工作,減少資料被竄改的機會。<br>
<a href="https://likewaylai.blogspot.com/2012/08/security-java-no33-access-control-3.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-79330256279870957002012-08-08T16:30:00.000+08:002013-01-17T19:14:38.315+08:00資安JAVA(三二): Access Control (2)來源:<a href="http://www.jtmelton.com/2012/08/07/year-of-security-for-java-week-32-access-control-2/">John Melton's Weblog</a><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 32 – ACCESS CONTROL (2)<br>
作者:John Melton<br>
<b>What is it and why should I care?</b><br>
<br>
<a href="http://likewaylai.blogspot.tw/2012/08/security-java-no31-access-control-1.html" target="_blank">上一篇</a>已經提過 Access Control 的定義了。<br>
<div>
<br>
<b>What should I do about it?</b></div>
<div>
<br>
前面提到我們可以用功能性來限制使用者的行為。第二種限制使用者行為的做法是,以資料區分─特定使用者只能存取特定資料。舉例:雖然所有登入網路銀行的使用者都能執行查詢餘額的功能,但只能顯示自己的數字。<br>
</div><a href="https://likewaylai.blogspot.com/2012/08/security-java-no32-access-control-2.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-68308944703661337212012-08-03T16:27:00.000+08:002013-01-17T19:13:51.427+08:00資安JAVA(三一): Access Control (1)來源:<a href="http://www.jtmelton.com/2012/08/02/year-of-security-for-java-week-31-access-control-1/">John Melton's Weblog</a><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 31 – ACCESS CONTROL (1)<br>
作者:John Melton<br>
<b>What is it and why should I care?</b><br>
<br>
存取控制(Access control),又稱做使用者授權(Authorization),是身分鑑別成功之後的下一步驟。存取控制的流程是以使用者身分為基礎決定資源的存取權限。假設使用者身分已經被確認,之後才能決定是否讓使用者存取特定資源。<br>
<br>
存取控制是系統中最容易被利用的,通常存取控制的實作都存在一些問題,控制點沒有完全覆蓋應用程式,留下許多漏洞形成資安隱憂。<br>
<br>
存取控制的問題可以用不同的存取控制模型 MAC、DAC、RBAC 來解決。然而,Web應用程式有一些特別的地方,接下來我將介紹不同之處在哪。<br>
<div>
</div><a href="https://likewaylai.blogspot.com/2012/08/security-java-no31-access-control-1.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-67949475055704634412012-07-27T12:33:00.001+08:002013-01-17T19:12:58.874+08:00資安JAVA(三十): Authentication 來源:<a href="http://www.jtmelton.com/2012/07/25/year-of-security-for-java-week-30-authentication/" target="_blank">John Melton's Weblog</a><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 30 – AUTHENTICATION<br>
<span style="background-color: white;">作者:John Melton</span><br>
<b>What is it and why should I care?</b><br>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXil1FOXKGnlZ5AKRjvU8tEuTEasK3k83z7vmhC3iojxv7VQKRk5Bp6XKCruHWqpUNveNx92DVEDpjKGNBPrDu8RZ4NeYZnZAcPPEKIA26cGAViOEHxkomdYll0-VLAxRoUbdEQOSaEZsA/s1600/door-access-systems.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXil1FOXKGnlZ5AKRjvU8tEuTEasK3k83z7vmhC3iojxv7VQKRk5Bp6XKCruHWqpUNveNx92DVEDpjKGNBPrDu8RZ4NeYZnZAcPPEKIA26cGAViOEHxkomdYll0-VLAxRoUbdEQOSaEZsA/s400/door-access-systems.jpg" width="400"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">請靠近點,以便鑑別您的身分。</td></tr>
</tbody></table>
鑑別(Authentication)是一個確認你的身分是否為真的過程。通常使用者會以自己的ID和相關證據以證明身分。實際的情況是,使用者用代號和密碼來通過系統的認證。鑑別是應用程式安全中最重要的部分,因為他是使用者所有行為的起點。許多資安解決方案都是基於使用者身分已通過鑑別的前提,也就是假設使用者身分無誤。然而鑑別身分是有難度的,需要花很多心力來做。<br>
<a href="https://likewaylai.blogspot.com/2012/07/security-java-no30-authentication.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-53547457734867837022012-07-25T14:08:00.002+08:002013-03-21T16:08:08.440+08:00以 MSNPsharp v5 實作間單的 MSN robot(二):互動對答<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkiDInmpPjK3A2H9JWu_iLh2gI8FCwzvAGBfe5YFx3CphYKPIUvLJErSeJJL47JUu3P1U-p2hfYZ9igG-_xWkM5C217eePJA2AU4keLILOjiiqZtHe8XcFVuNFO_a75PXxhhoCQ7QLsKyp/s1600/wall-e-at-work.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="236" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkiDInmpPjK3A2H9JWu_iLh2gI8FCwzvAGBfe5YFx3CphYKPIUvLJErSeJJL47JUu3P1U-p2hfYZ9igG-_xWkM5C217eePJA2AU4keLILOjiiqZtHe8XcFVuNFO_a75PXxhhoCQ7QLsKyp/s400/wall-e-at-work.jpg" width="400"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">A happy robot is doing his job.</td></tr>
</tbody></table>
<span style="background-color: white;">繼續上一篇的 </span><a href="http://likewaylai.blogspot.tw/2012/04/msnpsharp-v5-msn-robot.html" style="background-color: white;" target="_blank">介紹文章</a><span style="background-color: white;"> 後,若是我們想要跟機器人互動該怎麼作?身為一個稱職的MSN機器人,必定要學會互動文字對答,提供特定服務。今天就來試試看如何互動。</span><br>
<br>
<b>怎麼實作?</b><br>
<br>
MSN機器人互動最方便的作法就是文字應答。輸入特定指令後,機器人依據指令進行特定服務(例如:檢查server狀態、檢查聯若人清單、找尋檔案等等)。除了文字應答,另外一個重要的互動功能就是檔案傳輸,依據指令找尋檔案並自動傳輸檔案。<br>
<br>
以下為我的應答流程:<br>
1.傳送指令<br>
2.機器人讀取指令<br>
3.回應結果<br>
<a href="https://likewaylai.blogspot.com/2012/07/msnpsharp-v5-msn-robot-no2-auto-answering.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-28854049291481781672012-07-20T13:10:00.000+08:002013-01-17T19:12:17.175+08:00資安JAVA(二九): Manage Resources來源:<a href="http://www.jtmelton.com/2012/07/17/year-of-security-for-java-week-29-manage-resources/">John Melton's Weblog</a><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 29 – MANAGE RESOURCES<br>
作者:John Melton<br>
<b>What is it and why should I care?</b><br>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhX0tB2oTaZlDKj9hFJsAnR2MjKGK9yq58Ooru8dk65lktlph_d_uxHNALjjDqXWkrMoUaQDgo3owCqwTGn5fAHD_Zzs_Gny3_bPtVrXpeN-ZluBl5R6-dSdCm3BcNfOkqyO8qLqIX-r4dS/s1600/toolbox.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="315" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhX0tB2oTaZlDKj9hFJsAnR2MjKGK9yq58Ooru8dk65lktlph_d_uxHNALjjDqXWkrMoUaQDgo3owCqwTGn5fAHD_Zzs_Gny3_bPtVrXpeN-ZluBl5R6-dSdCm3BcNfOkqyO8qLqIX-r4dS/s400/toolbox.jpg" width="400"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">用完後記得將工具歸位喔。</td></tr>
</tbody></table>
資源管理長久以來都是程式設計中一個重要議題,而且跟資安三大目標CIA中的Availability更是息息相關。資源管理好壞影響著你存取時系統是否順利的回傳,故你不會隨意的釋放相關資源(硬碟空間、記憶體、網路連線等等)。<br>
<br>
雖然不像是因為使用者帳戶和密碼的加密機制過於簡單(像是 <a href="http://zh.wikipedia.org/wiki/ROT13" target="_blank">ROT-13</a>)而被破解一樣受人注目,但是資源洩漏造成的系統當機也頗為尷尬。不良的資源管理機制將導致系統崩潰、不穩定。若你剛好是每天凌晨兩點因為機器崩潰被主管狂 call 的工程師,那你應該懂我的意思。<br>
<a href="https://likewaylai.blogspot.com/2012/07/security-java-no29-manage-resources.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-31501757752015303102012-07-18T11:34:00.004+08:002012-07-19T13:12:06.799+08:00帶來Shell.CMruPidlList和_SHuassist.mtx的郵件<span style="font-weight: bold;">發生什麼事?</span>
<br>
<br>
這些年,收到垃圾郵件、釣魚郵件都見怪不怪,反正hotmail、gmail會幫我過濾那些郵件。但如果是好朋友們的信就無法第一時間過濾掉,因此某些msn的內含惡意聯結的郵件仍持續散佈。<br>
<b><br></b><br>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgVS3zYMk80LnmsEb_ZxVW5__Pbq0vNqn4_AnyzOFNk8_WATqrv1c5J8uTqxZN9Pxm6C9fTpVy63ezdBiej2BIUEw7r2OzW6e9pEcJIuazVLyToZ4AWHmWmjWliH4Ncq0oqCJ099Q2xmqE/s1600/spammail.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="164" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgVS3zYMk80LnmsEb_ZxVW5__Pbq0vNqn4_AnyzOFNk8_WATqrv1c5J8uTqxZN9Pxm6C9fTpVy63ezdBiej2BIUEw7r2OzW6e9pEcJIuazVLyToZ4AWHmWmjWliH4Ncq0oqCJ099Q2xmqE/s640/spammail.png" width="640"></a></div>
<br>
今天我收到的惡意郵件沒有主旨,只有寄件人和收件人,內容只有一行<br>
http://cr.site-sales.biz/blog/不要點喔wp-content/plugins/zaieccpauio/google.html?otv=fgfh.psml&ygu=onnm.hkml&gwyj=tjbm<br>
<a href="https://likewaylai.blogspot.com/2012/07/shellcmrupidllistshuassistmtx.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-63865593734189269402012-07-06T16:26:00.000+08:002012-07-19T13:07:16.180+08:00資安JAVA(二七): Penetration Testing來源:<a href="http://www.jtmelton.com/2012/07/05/year-of-security-for-java-week-27-penetration-testing/" target="_blank">John Melton's Weblog</a><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 27 – PENETRATION TESTING<br>
作者:John Melton<br>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm5d2DuQPUSIX589FGrPjYB-ljwXQGatAV5DaWZy7G2H2MZ_kBbWc1htNkHNl2mCWJSilvBgqaErSjPyMp97LLhmepb-FjEdWnHELKGWrQjvW_DpZDoyx29a2hr85eF_CRYhndml5CMuBu/s1600/shooting+test.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="307" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm5d2DuQPUSIX589FGrPjYB-ljwXQGatAV5DaWZy7G2H2MZ_kBbWc1htNkHNl2mCWJSilvBgqaErSjPyMp97LLhmepb-FjEdWnHELKGWrQjvW_DpZDoyx29a2hr85eF_CRYhndml5CMuBu/s640/shooting+test.jpg" width="640"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Developer: I'm ready, Sir !</td></tr>
</tbody></table>
<b style="background-color: white;">What is it and why should I care?</b><br>
<br>
<span style="background-color: white;">滲透測試( </span><a href="http://en.wikipedia.org/wiki/Penetration_test" style="background-color: white;" target="_blank">Penetration testing</a><span style="background-color: white;"> )是藉由模擬的攻擊行為來評估電腦系統或網路安全性的方法。此方法主動的分析系統所有弱點的可能性,並揭露潛在攻擊者。通常又被稱作 pen testing 或ethical hacking。</span><br>
<br>
滲透測試類似於雇用駭客去探測實際運作的系統,且努力找出安全問題。測試結果很有價值也很有說服力,不僅顯示弱點存在,也可以被利用。根據經驗,誠實的測試結果可以成為開發者和資訊安全之間溝通橋梁,並設定可達成的目標促使開發者修正問題。而該如何處理人人都討厭的誤報(False Positive)結果也是很有趣的議題。<br>
<a href="https://likewaylai.blogspot.com/2012/07/java-penetration-testing.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-1970877799129357792012-06-29T12:04:00.000+08:002012-07-17T17:55:24.392+08:00資安JAVA(二六): Code Review來源:<a href="http://www.jtmelton.com/2012/06/27/year-of-security-for-java-week-26-do-code-reviews/" target="_blank">John Melton's Weblog</a><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 26 – DO CODE REVIEWS<br>
作者:John Melton<br>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9JeVlfi7Vu7QZbWwydqT6VhZA5cji7K6i_FEKw__0rmbLGqQj-T_UP07Ak9JAexQYH_1LvAKyII9iIXTki5k7-4Y_oWKILH_elD_zoPIuXBkgHshX_gwT0sWglqgmwYmn81sYRY1i78ts/s1600/sherlock-holmes3.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="283" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9JeVlfi7Vu7QZbWwydqT6VhZA5cji7K6i_FEKw__0rmbLGqQj-T_UP07Ak9JAexQYH_1LvAKyII9iIXTki5k7-4Y_oWKILH_elD_zoPIuXBkgHshX_gwT0sWglqgmwYmn81sYRY1i78ts/s640/sherlock-holmes3.jpg" width="640"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Holmes: Found any bugs?<br>
Waston: You mean ...besides 5000 compiling errors?</td></tr>
</tbody></table>
<b>What is it and why should I care?</b><br>
<br>
<span style="background-color: white;">原始碼檢查( </span><a href="http://en.wikipedia.org/wiki/Code_review" style="background-color: white;" target="_blank">Code Review</a><span style="background-color: white;"> )源自單純的 Double Check 概念,讓其他人以系統化的方式找出錯誤。雖然步驟簡單,效果卻很好。</span><a href="http://www.cc2e.com/Default.aspx" style="background-color: white;" target="_blank">研究</a><span style="background-color: white;"> 指出透過 Code Review 可以找出程式碼中 25-75%的錯誤,若結合其他品管方法,能達到更完美的程式碼。</span><br>
<br>
雖然 Code Review 是開發者用來找出程式碼中所有錯誤,但本系列文章以資安為主,作者只會討論安全性議題。安全性 Code Review 會忽視無關安全性的錯誤。一般性和安全性議題的差別是檢查目的並非檢查方法。<br>
<a href="https://likewaylai.blogspot.com/2012/06/java-code-review.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-14625903448047123282012-06-22T10:53:00.000+08:002012-07-18T13:56:43.645+08:00資安JAVA(二五): Dynamic Analysis<span style="background-color: white;">來源:<a href="http://www.jtmelton.com/2012/06/20/year-of-security-for-java-week-25-use-dynamic-analysis/" target="_blank">John Melton's Weblog</a></span><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 25 – USE DYNAMIC ANALYSIS<br>
作者:John Melton<br>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyLUunyl6VPmAe6nJNZwW1-JOoEwpD7zxoOIgNG6Jzjux-EKQjcfBA_3kpqxWG2VuKnnT8X85ALf-Wtv3x8VtLT4BQqj3M19dcb0BYe8ceqMmGkkWSl0FdRL8pMXRNSCHapE2xFdudHsEY/s1600/jack-sparrow-japan.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyLUunyl6VPmAe6nJNZwW1-JOoEwpD7zxoOIgNG6Jzjux-EKQjcfBA_3kpqxWG2VuKnnT8X85ALf-Wtv3x8VtLT4BQqj3M19dcb0BYe8ceqMmGkkWSl0FdRL8pMXRNSCHapE2xFdudHsEY/s320/jack-sparrow-japan.jpg" width="248"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Opps !! You killed me.</td></tr>
</tbody></table>
<b>What is it and why should I care?</b><br>
<br>
<a href="http://en.wikipedia.org/wiki/Dynamic_program_analysis" target="_blank">動態分析</a> <span style="background-color: white;">就是</span><span style="background-color: white;">分析執行中的程式</span><span style="background-color: white;">。基本上,動態分析會自動執行應用程式,並進行分析。</span><br>
<br>
動態分析當然不只限於應用程式的安全領域,還包括其他領域,但本篇文章將著重於安全領域。目前市面上的產品又稱為<span style="background-color: white;">Dynamic Application Security Testing (or DAST)。</span><br>
<br>
動態分析工具怎麼辦到的?Web應用程式安全的領域中,動態分析工具會模擬為使用者的瀏覽器,並送出具有攻擊目的 Request 給應用程式。不論攻擊是否成功,都能依據輸出結果,推論<span style="background-color: white;">應用程式</span><span style="background-color: white;">可能的弱點。以下是偵測 XSS 弱點的邏輯:</span><br>
<code class="prettyprint">
第一,瀏覽 Web 應用程式中的表單。<br>
第二,填入javescript alert。<br>
第三,送出表單。<br>
第四,如果得到alert,則表單存在 XSS 弱點。<br>
</code>
<br>
可以從<span style="background-color: white;">這個簡單例子,</span><span style="background-color: white;">看出動態分析工具的執行邏輯,而真正的動態分析工具可以做到更多測試。動態分析和靜態分析相反,他能提供攻擊行為真實可行的證據。做</span><span style="background-color: white;">靜態分析時,</span><span style="background-color: white;">開發者會以「其實我們有安全控制措施來防範 X 弱點,^_^」,然後忽視靜態分析報告。但動態分析是針對已經上線的應用程式進行測試,當你發現營運中網站的弱點,其他人很難忽視實際上被攻擊的可能性。</span><br>
<span style="background-color: white;"><br></span><br>
<a href="https://likewaylai.blogspot.com/2012/06/java-dynamic-analysis.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-23634311171407787282012-06-15T10:52:00.000+08:002012-07-18T13:56:08.057+08:00資安JAVA(二四): Static Analysis來源:<a href="http://www.jtmelton.com/2012/06/13/year-of-security-for-java-week-24-use-static-analysis/" target="_blank">John Melton's Weblog</a><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 24 – USE STATIC ANALYSIS<br>
作者:John Melton<br>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOtUg2sEyNz-wjPTkL0PKEHItUTdrlBFM3C7ieCKpWOIesneitE0WhrxnkmdU9p0a8G_Af1DjzRxr9wNNpgvNTJFF10pC0N63YbA0NgbZX0kvvzPVxuHaeP0INb8MYPQfGm29n1uWIKn9P/s1600/greentree.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOtUg2sEyNz-wjPTkL0PKEHItUTdrlBFM3C7ieCKpWOIesneitE0WhrxnkmdU9p0a8G_Af1DjzRxr9wNNpgvNTJFF10pC0N63YbA0NgbZX0kvvzPVxuHaeP0INb8MYPQfGm29n1uWIKn9P/s320/greentree.gif" width="298"></a></div>
<b>What is it and why should I care?</b><br>
<br>
靜態分析(Static Analysis)是一種分析,能夠自動化檢查程式碼而不需要實際執行程式。靜態分析工具很多,可以達到的複雜度也不同<span style="background-color: white;">。作者大致介紹兩種類: Grep+ 和 資料流/控制流分析。</span><br>
<span style="background-color: white;"><br></span><br>
<i>Grep+</i><br>
Grep 是很棒的內文搜尋工具,但無法成為正式的靜態分析工具。以前人們認為總有一天可以用 Grep 發展出實用的靜態分析工具,但受限於只能搜尋符合某些特徵的程式碼,Grep 終究無法成為稱職工具<span style="background-color: white;">。Grep 能用在許多地方,但今日的靜態分析工具已經超越單純的內文搜尋工具。</span><br>
<br>
<i>資料流 / 控制流分析 Data/Control Flow Analysis</i><br>
進階版的靜態分析工具所使用的技巧就是 <a href="http://en.wikipedia.org/wiki/Data_flow_analysis" target="_blank">資料流分析</a> 和 <a href="http://en.wikipedia.org/wiki/Control_flow_analysis" target="_blank">控制流分析</a>。這種概念是從編譯器理論( <a href="http://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools" target="_blank">Dragon book</a> )而來的,尤其是最佳化技術。雖然這不是新的概念,大家仍花了很多心力才<span style="background-color: white;">應用到靜態分析</span><span style="background-color: white;">。</span><br>
<br>
一般而言,這些工具會建立應用程式的資料結構模型(又稱抽象語法樹 Abstract Syntax Tree),然後以不同方法遍歷抽象語法樹( AST )的結構,找出問題。<br>
<br>
其實開發者最熟悉的 IDE 工具已經再利用上述的概念,當你寫程式時, IDE 會建立靜態的抽象語法樹,並即時顯示<span style="background-color: white;">警告和</span><span style="background-color: white;">錯誤。某些 IDE 工具甚至會從程式外部,檢查 AST 的安全性。</span><br>
<br>
註:雖然靜態分析並不只是針對安全領域,但身為資安專家的作者自然是以安全為主。作者提醒大家,不只資安,靜態分析也可以解決其他問題。而目前資安市場中相關的產品又稱為 Static Application Security Test。<br>
<a href="https://likewaylai.blogspot.com/2012/06/java-static-analysis.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-57697961359470659832012-06-08T10:50:00.000+08:002012-07-18T13:55:35.559+08:00資安JAVA(二三): HTTP Header Injection<span style="background-color: white;">來源:<a href="http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CFQQFjAA&url=http%3A%2F%2Fwww.jtmelton.com%2F2012%2F06%2F06%2Fyear-of-security-for-java-week-23-http-header-injection%2F&ei=pvv0T6v0HZHomAXc-OiwBQ&usg=AFQjCNG-DszlIPy080AQIAbhFlh9cU1Pgg&sig2=fmrcQKeU6bk8Nj2BO4_MAA" target="_blank">John Melton's Weblog</a></span><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 23 – HTTP HEADER INJECTION<br>
作者:John Melton<br>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0CtE7gkAU9imxlyPVR4NT_xwauvfIABdew0g1q2TeRrWj_qZfXHC4fXtbgRE5B3yNg-dk9taxdPS2Z5Eophs3VfyBfIuFFzRNW_saipzIOwSa7EHpivZUSogk-5aoc6190i5zRaH-LU4x/s1600/70b1OOOPIC10.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0CtE7gkAU9imxlyPVR4NT_xwauvfIABdew0g1q2TeRrWj_qZfXHC4fXtbgRE5B3yNg-dk9taxdPS2Z5Eophs3VfyBfIuFFzRNW_saipzIOwSa7EHpivZUSogk-5aoc6190i5zRaH-LU4x/s320/70b1OOOPIC10.jpg" width="235"></a></div>
<b>What is it and why should I care?</b><br>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br>
HTTP Header Injection 是一種影響 HTTP header 的特定注入攻擊方式。攻擊方式是透過操作 header 資料製造問題<span style="background-color: white;">( <a href="http://hi.baidu.com/aullik5/item/05c05efb4250da1de2e3bdc1" target="_blank">response splitting</a>, CRLF injection, cache poisoning, XSS, 等等)。這是個不被關注的問題,也比較少有針對性保護。</span><br>
<br>
其中最常見的一種是 CRLF injection,CR 代表Carriage Return <span style="background-color: white;">[%0d 或 \r] 、LF 代表 Line Feed </span><span style="background-color: white;">[%0a 或 \n],攻擊方式是透過加入 CRLF 到 header 後造成伺服器以不安全的方式解讀response,而讓攻擊者可以控制被切斷的 response 。</span><br>
<a href="https://likewaylai.blogspot.com/2012/06/java-http-header-injection.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-63329169080858762142012-06-01T10:47:00.000+08:002012-07-18T13:54:59.716+08:00資安JAVA(二二): HTTP Parameter Pollution<span style="background-color: white;">來源:<a href="http://www.jtmelton.com/2012/05/31/year-of-security-for-java-week-22-http-parameter-pollution/" target="_blank">John Melton's Weblog</a></span><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 22 – HTTP PARAMETER POLLUTION<br>
作者:John Melton<br>
<br>
<span style="background-color: white;"><b>What is it and why should I care?</b></span><br>
<br>
HTTP 參數汙染是一種自訂字串語句然後複寫 HTTP GET/POST 參數的注入技術。2009年的一篇 <a href="http://blog.mindedsecurity.com/2009/05/http-parameter-pollution-new-web-attack.html" target="_blank">文章</a> 提出這個名詞後,逐漸普及。只要你能發揮創意填補HTTP的參數,多次送出相同的參數,就有機會造成WEB應用程式出乎意料的反應。如果有人利用這個request<br>
<code class="prettyprint">
/mypage.jsp?query=abc&acct=4</code><br>
改成這樣,會發生什麼事呢?<br>
<code class="prettyprint">
/mypage.jsp?query=abc&acct=5&acct=4<br>
</code><br>
<span style="background-color: white;">當你呼叫 request.getParameter("acct") 會得到什麼值?不同的 server 會有不同的反應,還好,這裡有一份 </span><a href="https://www.owasp.org/images/b/ba/AppsecEU09_CarettoniDiPaola_v0.8.pdf" style="background-color: white;" target="_blank">PPT</a><span style="background-color: white;"> 可以讓你參考各家 server 的反應。JAVA 的朋友們,你通常會得到相同參數的第一個值─也就是 </span><span style="background-color: white;">request.getParameter("acct") = "5"。</span><br>
<br>
所以勒?有這麼嚴重嗎?是的,這個弱點會產生複寫參數、修改行為、存取變數、繞過輸入驗證等等的漏洞。<br>
<br>
作者認為這和HTTP <a href="http://www.jtmelton.com/2011/02/02/beware-the-http-path-parameter/" target="_blank">路徑參數問題(Http Path Parameter Issue)</a> 很像,共同點是你可以自訂授權檢查的 URL 後面的參數,然後 request 到不一樣的值。上面的例子進行授權檢查時,"acct" 變數可能得到 "4" ,然後使用者將被認定是 acct=4 的身分。然而,實際上你的資料庫收到的 <span style="background-color: white;">request.getParameter("acct") 卻是帳號 "5" ,所以使用者 "4" 就可以繞過授權檢查存取使用者 "5" 的資料。</span><br>
<a href="https://likewaylai.blogspot.com/2012/06/java-http-parameter-pollution.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-36887843796530712472012-05-25T10:45:00.000+08:002012-07-18T13:54:06.848+08:00資安JAVA(二一): Anti-Caching Header<span style="background-color: white;">來源:<a href="http://www.jtmelton.com/2012/05/23/year-of-security-for-java-week-21-anti-caching-headers/" target="_blank">John Melton's Weblog</a></span><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 21 – ANTI-CACHING HEADERS<br>
作者:John Melton<br>
<span style="background-color: white;"><b>What is it and why should I care?</b></span><br>
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQH9HtNMsD-yXRRzFN8S4MnYQWZ6KkmkUoTyvMj8xTZk5RYUI2jG921VOYcMTiUFAKnzfDpzcCoGP1qKyaffeSHndQbQtlUxoSJsvYVMR7pfmMVF-sf2DjmUoT9FTpqhlEZhnrcCY1NcYg/s1600/key-under-rug.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="291" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQH9HtNMsD-yXRRzFN8S4MnYQWZ6KkmkUoTyvMj8xTZk5RYUI2jG921VOYcMTiUFAKnzfDpzcCoGP1qKyaffeSHndQbQtlUxoSJsvYVMR7pfmMVF-sf2DjmUoT9FTpqhlEZhnrcCY1NcYg/s400/key-under-rug.jpg" width="400"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">It's under the mat, I knew it.</td></tr>
</tbody></table>
<span style="background-color: white;">快取( Caching )是一種技巧,將伺服器上遠地的資料儲存一份副本在本地端,減少重複下載的動作,增加使用效能。只考慮效能的話,快取真是太棒。從資安的角度來看,可能成為很嚴重的問題。</span><span style="background-color: white;">假設現在螢幕上顯示你的個人銀行帳戶或醫療紀錄,下個使用者甚至不需要登入就可以看到剛剛的資料。</span><br>
<br>
幸運的是,我們可以藉由指令啟用或關閉快取。<br>
<a href="https://likewaylai.blogspot.com/2012/05/java-anti-caching-header.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0tag:blogger.com,1999:blog-4653855551913500490.post-77567860663264513152012-05-18T17:06:00.000+08:002012-07-18T13:53:35.890+08:00資安JAVA(二十): 不要相信其他人(Trust Nothing)來源:<a href="http://www.jtmelton.com/2012/05/16/year-of-security-for-java-week-20-trust-nothing/" target="_blank">John Melton's Weblog</a><br>
標題:YEAR OF SECURITY FOR JAVA – WEEK 20 – TRUST NOTHING<br>
作者:John Melton<br>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcclPjrdfd0aR9zP3yFwd2SFyAVlfJXdTYbVwpdnhKiptc6eZ9xMBFVehc2ZrpEHcU-6klC7Km7MToG0kqDb2qs7rK0m5rrpN3_b-NcoacH4BOhrhy3IH6ysS49HDybSBL_WxKmB07CeWM/s1600/trust-me.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="278" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcclPjrdfd0aR9zP3yFwd2SFyAVlfJXdTYbVwpdnhKiptc6eZ9xMBFVehc2ZrpEHcU-6klC7Km7MToG0kqDb2qs7rK0m5rrpN3_b-NcoacH4BOhrhy3IH6ysS49HDybSBL_WxKmB07CeWM/s400/trust-me.png" width="400"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Don't worry ^_^</td></tr>
</tbody></table>
<b style="background-color: white;">What is it and why should I care?</b><br>
<span style="background-color: white;"><br></span><br>
<span style="background-color: white;">信任感是很有趣的議題,我們潛意識中相信人性本善,開發者也是。看看以下這個例子:</span><br>
<br>
<code class="prettyprint">
//bad bad do not use<br>
executeDbQuery("select * from my_table where id = " + request.getParameter("my_id"));<br>
//bad bad do not use<br>
</code>
<br>
<span style="background-color: white;">開發者相信使用者不會竄改 my_id 所以放心的直接帶入 executeDbQuery()。這太天真了,正確作法應該是用 my_id 參數傳入到 Prepare Statement 以防止 SQL Injection 同時檢查 my_id 的內容是否正確。</span><br>
<br>
為何要如此大費周章?因為我們不能隨便相信輸入值,不能相信使用者會依照我們的期望使用系統。我們必須建造好用的、能承受攻擊的、強壯且吃苦耐勞的系統。無論你的系統是甚麼類型,作者建議不要信任( Trust )系統會接觸到的環境。<br>
<br>
「不能信任系統環境」到底代表什麼意涵?是為了避免 XSS 和 SQL injection 嗎?是,但更深一層的意涵是以不同的方式了解應用程式。應用程式其實是規模不同的輸入-處理-輸出的過程,輸入值可能是 request parameters、headers、database input 等等,處理包括身分驗證、邏輯,輸出到資料庫、螢幕、檔案等等。整個應用程式可以當成所有系統元件的輸入值、處理、輸出的結合,並縮放規模到適合的系統和組織。<br>
<br>
所謂的「環境」因人而異,「你不能相信任何人」也是因地制宜。作者的建議是我們應分辨可以相信的和不能相信的,不能相信的資料應視之為已經被汙染的資料。<br>
<br>
威脅模擬( Threat Modeling )中包含許多此類議題,日後的文章作者會介紹。<br>
<a href="https://likewaylai.blogspot.com/2012/05/java-trust-nothing.html#more">更多詳細 »</a>wwhttp://www.blogger.com/profile/04358568706335421551noreply@blogger.com0