<span id="7ztzv"></span>
<sub id="7ztzv"></sub>

<span id="7ztzv"></span><form id="7ztzv"></form>

<span id="7ztzv"></span>

        <address id="7ztzv"></address>

            原文地址:http://drops.wooyun.org/tips/3603

            0x01 Web


            1.web1-信息獲取

            Url:http://ctf.sobug.com/hack_game/e82b2db876111afd/index.php Point:100

            Description: 獲取信息,提交key

            enter image description here

            Proceess:

            打開題目,title為hex和cookie,下載圖片載入編輯器,找到如下hex

            23696E636C7564652066696C653D22386630306232303465393830303939382E70687022
            

            解碼為include file="8f00b204e9800998.php",訪問該頁面,查看cookie,獲得base64加密的key 如圖

            enter image description here

            enter image description here

            解密即可。

            Key:[email protected]}

            2.web2-慧眼識珠

            Url: http://ctf.sobug.com/hack_game/5220de5ab2a8ce7d/index.html

            Point: 100

            Description: 仔細查看頁面,獲取key

            enter image description here

            Proceess:

            訪問,查看到cookie里有check=0,因而想構造check=1的cookie,構造完畢后繼續訪問發現頁面仍未變化。 繼續查看后發現當前頁面為index.html,里面的一段加密的js代碼解密后就為check=0,再無其他數據。修改cookie后嘗試需訪問其他動態頁面,訪問index.php后響應中返回key,如圖

            enter image description here

            Key: [email protected]}

            3.web3-數據&暗語

            Url:http://ctf.sobug.com/hack_game/f31c5630b00b0131/index.php

            Point:150

            Description: 仔細查看頁面獲取你想要的key

            enter image description here

            Proceess:

            打開后,查看源代碼提示referer&code,圖片中描述去官網看看,確定referer應為官網Referer:http://www.seclover.com( 注意請求頭里若在末尾加了/不會出結果的,Referer:http://www.seclover.com/) 構造referer后,訪問獲得的響應內容如下

            enter image description here

            諾基亞的鍵盤結果如下

            enter image description here

            2abc 3def 4ghi 5jkl 6mno 7pqrs 8tuv 9wxyz 0空格
            

            根據0分割數據

            843 0 539 0 47 0 73256837 0 9352663 0 968
            

            猜出前幾個個為the key is,因而確定為有意義的單詞,無需做詞頻統計之類的。最終獲得的解密字符為the key is seclover welcome you

            Key:{seclover welcome you}

            4.web4-代理和搜索

            Url:http://ctf.sobug.com/hack_game/390532fb5dc7f219/index.php

            Point:150

            Description: 仔細查看頁面,度娘知道答案喲

            enter image description here

            Proceess:

            通過題目中谷歌是檢索不到的,得知存在robots.txt文件,訪問獲得里面的disallow目錄User-agent: * Disallow: /S$cL0ver/ Disallow: /include/

            訪問/S$cL0ver/

            enter image description here

            根據說明,測試代理訪問,本地設置X-Forwarded-For為www.seclover.com訪問,獲得您的ip為www.seclover.com 得知其ip獲取是利用X-Forwarded-For,修改其為www.seclover.com的ip,訪問即可獲得key

            enter image description here

            Key:{S2CloveRWelcomE_Y0u}

            5.web5-編程&腳本

            Url:http://ctf.sobug.com/hack_game/f8495eeedb8e92ee/index.php

            Point:200

            Description: 編程解決問題

            enter image description here

            Proceess:

            Burp抓包可以看到響應頭中有個password字段

            enter image description here

            每次請求都會變化,這樣只要寫個自動化腳本抓取后自動提交就可以了,腳本如下

            enter image description here

            跑起來就可以得到key:

            enter image description here

            Key: {b7mIfekXA5lwLq}

            6.web6-windows密碼

            Url:http://ctf.sobug.com/hack_game/1ffd89ff6c2a0012/index.php

            Point:150

            Description: windows密碼機制

            enter image description here

            Proceess:

            下載得到兩張圖片,進行處理 用stegdetect進行處理,發現利用outguess加密算法,隱藏的數據,根據提示是windows弱口令,試了幾次成功讀取 如圖

            enter image description here

            查看key文件,得到windows的ntml哈希

            ed6c3eb3f56395a1f76ccb47241e3d88:0816f03b51a8ea50bcc7707896c93518
            

            you can guess.what's this? http://www.objectif-securite.ch/ophcrack.php破解得到key wangke1234 Key:{wangke1234}

            7.web7-獲取后臺密碼

            Url:http://ctf.sobug.com/hack_game/76412c649fb21553/index.php

            Point:220

            Description: 獲取后臺密碼

            enter image description here

            Proceess:

            有驗證碼,查看驗證碼是否存在繞過,此處的邏輯漏洞為找回密碼功能,點開忘記密碼,提示四位驗證碼已發送到您手機, 因而暴力猜解驗證碼即可。截取請求包,載入burpsuite intruder,設置payloads為0000-9999進行爆破,爆破后如下

            enter image description here

            登錄框登錄成功后,彈出key

            Key:{4297f44b13955235245b2497399d7a92}

            8.web8-U盤病毒

            Url:http://ctf.sobug.com/hack_game/eaf10b34b5ba8770/index.php

            Point:300

            Description: U盤病毒分析,獲取key

            enter image description here

            Proceess:

            下載U盤鏡像后,解壓1.4M,果斷mount之。得到一個exe和autorun,根據autorun里的信息,放到windows下。 看了下是winrar的自解壓的文件,然后用winrar打開,得到3個文件。如圖

            enter image description here

            運行1.exe解壓出一個隱藏的test.txt文件。內容如下,計算md5提交就是flag

            Key: {隊友玩星際去了,沒要到key,我代寫的}

            9.web9-電報解碼

            Url:http://ctf.sobug.com/hack_game/70e8ff92f2cb2576/index.php

            Point:200

            Description: 仔細查看頁面獲取key

            enter image description here

            Proceess:

            Win7訪問是如上圖的,但是linux訪問直接顯示的如下

            enter image description here

            根據摩斯碼表得到明文:

            xian seclover welcome you we are very happy for  you
            

            發現其是根據UA的系統進行判斷是否返回數據的

            Key:{隊友玩星際去了,沒要到key,我代寫的}

            10.web10-SQL

            Url:http://ctf.sobug.com/hack_game/f9abf127da5264c1/index.php

            Point:350

            Description: 注入繞過

            enter image description here

            Proceess:

            根據題目得知參數為id,訪問獲得如下提示

            enter image description here

            得知sql語句。將其載入sqlmap中可以讀取到database() version()等信息,其利用的是盲注。此處過濾了select等字符, 且大小寫無法繞過。測試發現大致的過濾思路為,檢測到字符串中有= 和select等字符,會提示Holly Shit! Damn it.但union未檢測,多次測試select用%00來繞過

            enter image description here

            2的位置有回顯。接下來就是基本的sql注入了 先看版本version()得知為5.5.1、再看數據庫database()為ctf0web 讀取表index.php?id=-1+union+se%00lect+1,table_name ,3+from+information_schema.tables+where+table_schema='ctf0web'# 獲得表名helloctf 讀取列名

            index.php?id=-1+union+se%00lect+1,column_name,3+from+information_schema.columns+where+table_name='helloctf'#
            

            獲得列名id title flag 讀取flag index.php?id=-1+union+se%00lect+1,flag,3+from+helloctf+where+id=1# 獲得key

            Key:{5e1325ba32f012c77f02c422251c3b7c}

            11.web11-UPLOAD

            Url:http://ctf.sobug.com/hack_game/8e3096620b9a89d1/index.php

            Point:200

            Description: 按題目要求完成

            enter image description here

            Proceess: Burp抓包,傳正常圖片,提示{不會吧,上傳圖片不好吧!至少你也傳個能解析的啊!} 但上傳php文件無論怎么改、截斷都是提示文件類型錯誤,所以猜測其對content-type進行了驗證,看其是否為圖片。 此時上傳圖片改為xx.php提示上傳文件出錯,然后利用文件名為大寫PHP繞過,如圖

            enter image description here

            Key:[email protected]}

            12.web12-SQL

            Url:http://ctf.sobug.com/hack_game/8f0784928387928a/index.php

            Point:500

            Description: 找找看看,有洞喲

            enter image description here

            Proceess:

            得知為一博客系統,大致探測了下目錄結構與文件,收獲如下

            /config.php
            /content.php
            /content/2014060212.txt
            /content/2014061201.txt
            /content/2014060901.txt
            /admin/check.php
            /admin/index.php
            /admin/index.html
            

            Content.php文件通過file參數傳入文件名(不帶后綴),首先想到文件包含漏洞。 訪問 http://ctf.sobug.com/hack_game/8f0784928387928a/content.php?file=2014061201

            enter image description here

            而該文件為

            enter image description here

            因而可以確認其不是文件包含,而是文件讀取。因而想構造參數讀取confi.php里的內容。多次測試發現傳入字符會提示日期錯誤,傳入file=2014061202000000一個超長數據,提示服務器內部500錯誤,說明過了日期檢測函數;傳入file=2014061202000000../提示日期格式不對,傳入file=0xabcdef123提示服務器內部500錯誤。多次測試發現無法繞過其日期檢測函數。

            將注意力放在admin的登錄框里,有驗證碼,輸入帳號錯誤會提示不存在該帳號,測試了多個常用管理帳號后依然提示帳號不存在,由于題目是SQL,因而考慮到是sql注入,測試了多次后,發現注入應該不在登錄框處。

            點開搜索框,url為search.php?word=&tongpeifu=*&sqltongpei=% 顯示結果如下

            enter image description here

            根據url參數命名方式,確定此處應該是注入點了,就是如何構造語句了。 通過搜索

            search.php?word=l&tongpeifu=*&sqltongpei=%
            search.php?word=x&tongpeifu=*&sqltongpei=%
            

            都能返回linux的搜索結果,從而確定sql執行的語句大致為

            Select * from articles where title like ‘%word%’
            

            然后需要弄清楚tongpeifu與sqltongpei以及word三者之間是個怎樣的邏輯關系

            默認三個參數都不傳word=&tongpeifu=&sqltongpei=,返回所有數據 傳入/search.php?word=li?ux&tongpeifu=?&sqltongpei= 發現沒有回顯內容,如圖

            enter image description here

            提交search.php?word=li?ux&tongpeifu=?&sqltongpei=n 獲得回顯

            enter image description here

            因而大致確定程序的邏輯tongpeifu是指word中的,在執行sql語句時候將word中tongpeifu代表位置用sqltongpei替換。 邏輯清晰了,下面就是要構造sql語句進行注入。構造恒成立語句查看

            search.php?word=*&tongpeifu=*&sqltongpei=n%' and 1=1 and '%'='
            

            發現并無返回數據,多次測試仍無果。

            猜測是單引號被轉義了,查看了php版本為5.5默認無gpc,則考慮到可能是對獲取的數據進行了addslashes處理,現在要做的就是如何繞過addslashes,使單引號逃逸出來。 本地測試。

            其實word tongpeifu sqltongpei的處理邏輯,在php中實現就是一個str_replace函數。

            構造本地測試的代碼為 先查看addslashes的處理單引號、雙引號、反斜線、空字符 測試代碼

            <?php
            //addslashes處理的內容有'、\、"、NULL四個字符
            if (isset($_GET['singleq'])) {
                echo "' -----> ".addslashes($_GET['singleq'])."<br/>";
            }
            if (isset($_GET['doubleq'])) {
                echo "\" -----> ".addslashes($_GET['doubleq'])."<br/>";
            }
            if (isset($_GET['backslash'])) {
                echo "\\ -----> ".addslashes($_GET['backslash'])."<br/>";
            }
            if (isset($_GET['null'])) {
                echo "%00 -----> ".addslashes($_GET['null'])."<br/>";
            }
            //sql test
            $word=addslashes($_GET['word']);
            $tongpeifu=addslashes($_GET['tongpeifu']);
            $sqltongpei=addslashes($_GET['sqltongpei']);
            echo $word."<br/>";
            echo $tongpeifu."<br/>";
            echo $sqltongpei."<br/>";
            $result=str_replace($tongpeifu, $sqltongpei, $word);
            echo "sql--query:"."select title from articles where title like '%{$result}%'"."<br/>";
            

            輸出為

            enter image description here

            有沒有很熟悉,echsop之前爆過的一個插件注入也是類似,利用替換,將單引號逃逸出來 仔細想想,該怎樣進行替換,才會使單引號逃逸出來? 首先在word中測試,另外兩個參數為空,查看輸出

            enter image description here

            Word中的\ ‘ %00中的反斜線都是成對出現的,所以要想使得單引號逃逸出來,必須使得其前面的\被轉義, 那通配符該用哪個進行替換呢,使得通配符分別為’或\或%00,時候,其替換的時候也為成對替換,因為其自身也被轉義了。

            enter image description here

            但是將通配符變為\0查看輸出

            enter image description here

            令sqltongpeif=\ 輸出查看,單引號逃逸

            enter image description here

            然后執行常規的查庫、查表、讀取flag。 Order by判斷有4個字段, 查到數據庫為sql_seclover 請求為

            search.php?word=l\%00' union select 1,schema_name,3,4 from information_schema.schemata where 1 %23&tongpeifu=\0&sqltongpei=\
            

            查表有content、admin(里面無數據,因而后臺登錄是虛設?)、secret 請求為

            search.php?word=l\%00' union select 1,table_name,3,4 from information_schema.tables where table_schema=0x73716C5F7365636C6F766572 %23&tongpeifu=\0&sqltongpei=\
            

            查字段sid skey 請求為

            search.php?word=l\%00' union select 1,column_name,3,4 from information_schema.columns where table_name=0x736563726574 %23&tongpeifu=\0&sqltongpei=\
            

            獲得key{Seclover [email protected] ^u0} 請求為

            search.php?word=l\%00' union select 1,skey,3,4 from secret where 1 %23&tongpeifu=\0&sqltongpei=\
            

            Key:{Seclover [email protected] ^u0}

            0x02 Crack


            1.crack1-Crackme1

            Url:http://ctf.sobug.com/crackme/b4dc971ef90cb6ae/index.php

            Point:100

            Proceess:

            拖到ida中,邏輯很簡單。 找到關鍵函數sub_401000,分析。 看了下就是和unk_408030位置的數字進行一系列抑或,而且是簡單的抑或。所以這個不用逆算法就行,直接上od。 轉到0x401000處,在程序結束的地方下斷點,運行程序。成功斷下后,直接在棧上可以看到注冊碼,如圖。

            enter image description here

            enter image description here

            enter image description here

            2.Crack2-Crackme2

            Url:http://ctf.sobug.com/crackme/82a7d5ac894e5bb8/index.php Point:200

            Process:

            一個易語言寫的程序~ OD載入,ALT+M, 在crackme.data段F2下斷,F9運行

            enter image description here

            中斷在krnln庫文件代碼里,F8單步過下面的JMP就到程序領空

            enter image description here

            ,這時找字符串,應該是有2個還是3個失敗,1個不能為空,1個成功,所有中文字符串都下上斷點,分析下

            enter image description here

            首先隨便輸入,如果斷下來

            enter image description here

            判斷密碼是不是32位的 生成正確注冊碼

            enter image description here

            F9重新運行,在上面的那個函數斷下后,看棧里,下面的那個就是正確的注冊碼

            enter image description here

            3.Crack3-Crackme3

            Url:http://ctf.sobug.com/crackme/e26cac7bac3f78c1/index.php

            Point:300

            Process:

            分析個sethc.exe 粘貼鍵后門。 直接看消息處理的地方吧

            enter image description here

            1那個地方是判斷ecx是不是為0x30,這個地方是鼠標的點擊次數,下面會有分析

            2 那個地方是判斷按的是確定還是取消,確定是1,取消是2

            enter image description here

            繼續往下看

            enter image description here

            點擊鼠標左鍵右鍵都會讓ecx+1,左鍵在403070處寫入0x4c,右鍵寫入0x52 到滿足ecx==0x30的時候,會來到00401C40這個地方判斷鼠標點擊的那48下的具體情況; 下面這個循環,將0x4c對應一個0,0x52對應一個1,48下轉化為6字節

            enter image description here

            下面那個比較的地方,那6個字節和“查水表”的HEX值比較

            enter image description here

            enter image description here

            比較一樣就可以啟動“后門”彈出本題的flag:D27789EFCA409B6B6EE297D412334A65 所以把“查水表”的2進制轉化出來,就可以確定鼠標左鍵右鍵點擊的次序,觸發“后門”。

            4.Crack4-Crackme4

            Url:http://ctf.sobug.com/crackme/820af53738bfa68e/index.php Point:400 Process: 提示為:輸入正確的密碼,會釋放出文件。key就在文件中。 tips:第一層密碼為6為純數字,第二層密碼也是6位。 拿到程序后,放入PEID

            enter image description here

            FSG的殼,脫殼后發現里面有文件讓損壞,所以帶殼分動態調試,IDA分析脫殼后的吧。

            enter image description here

            運行到第3行命令那,棧里第4個位置就是程序入口。在棧中里那個位置右鍵數據窗口中跟隨

            enter image description here

            然后下硬件訪問斷點,F9,然后就可以看到真正的代碼了 先看401370函數吧,這個是對結果的處理函數,等下分析的時候需要用到,輸入的參數為數字,然后6種情況

            enter image description here

            然后IDA的F5看

            enter image description here

            為空沒有輸入密碼,不為空進入4013E0處理~ 下面這個函數,當我脫殼后會返回錯誤5,所以帶殼分析了??

            enter image description here

            進去看下,當返回成0的時候為正確,那么就會生成文件,如果返回2,是密碼錯誤。 里面有把你的密碼經過sprintf和“HOWHP”連接在一起,經過401000的2次加密,和一個特定的hash對比。 根據我的那個方法跟一下就OK了,然后需要獲得的hash如下 esi=0018F9F0, (ASCII "09B2F924C20C5CA427EED2C5B98BEFBF")

            enter image description here

            需要加密后的hash為 第一步,我采取的爆破,提示說是第一個密碼是6位純數字,代碼在附件里。如果有附件~~ 爆破出來是564987

            enter image description here

            然后生成了一個一樣的exe,同樣加殼。只是最后生成的文件會不一樣。這個的密碼提示為6位,但是不一定是純數字了,我一開始直接拿第一步寫的程序跑了下純數字,果然不行,然后就去看程序,修改指令,看看會生成什么,結果發現生成了個gif 馬上想到GIF89a 6位,也許可以推算出來key 在401270函數里是寫文件的,調用了40110把你輸入的key和原有資源做運算

            enter image description here

            看看算法

            enter image description here

            異或操作,果然可以! 我使用的密碼是123456 然后使用爆破的方法讓邏輯正確,會生成一個***|||||||.gif的文件 然后你winhex打開生成的gif,比如第一個字節為0x01,然后G的hex值為0x47 使用 chr(0x31^0x01^'0x47') #python 就能得正確key的第一個字母,一次下去,GIF89a,就可以得到正確的key 輸入正確的key,解密出來一個gif,打開就是flag.

            5.Crack5-Crackme5

            Url:http://ctf.sobug.com/crackme/02de861ff6b52930/index.php

            Point:500

            Process:

            1:拿到程序后,首先看了字符串

            enter image description here

            enter image description here

            有反調試,根據那些int3,很明顯是seh反調試,打亂程序的執行流程,導致定位關鍵函數帶來困難行流程。 2:來到跟進異常處理,來到

            enter image description here

            下面的這個地方判斷是不是int3引起的異常,是就往下執行,不是就返回EXCEPTION_CONTINUE_SEARCH

            enter image description here

            這個地方,設置EIP

            enter image description here

            來我們看看edx的值

            enter image description here

            也是int3,帶著疑惑,繼續看~~ 多試幾次后,EDX在不斷增大~ 最后10多次后,發現了不是int3的情況

            enter image description here

            enter image description here

            進一步的跟蹤,發現是用異常處理例程是沒隔10次左右的INT3異常對應一條MSAM語句,所有的語句整合起來,也就是注冊碼的算法了~ 此外UnhandledExceptionFilter在沒有debugger attach的時候才會被調用。所以,跟蹤起來很困難。 選擇設置條件記錄斷點

            enter image description here

            enter image description here

            整理后

            enter image description here

            根據結果就可以分析算法了。最后做出注冊機,提交OK~ 附上源碼和一個可以執行的賬號~ 請注意:注冊機的輸出倒過來才是正確的注冊碼,然后用戶名和注冊碼不能相同,不想改了,注意下就好

            v_dature 536426
            

            enter image description here

            <span id="7ztzv"></span>
            <sub id="7ztzv"></sub>

            <span id="7ztzv"></span><form id="7ztzv"></form>

            <span id="7ztzv"></span>

                  <address id="7ztzv"></address>

                      亚洲欧美在线