制作Linux内存镜像+制作对应的volatility_profile
萧禾财 Lv4

2022祥云杯出了一道需要自己构建新版本内核的题。之前都没有遇到过取证Linux内存的题,大多是Windows系统的内存取证。

volatility工具只自带Windows系统 profile ,Linux 需要自己添加。

识别Linux内存映像的内核版本

利用string指令,提取出被dump出来的文件的系统内核的版本是什么。

1
strings 1.mem | grep "Linux version"  
1
2
3
4
5
6
7
8
9
10
Linux version 5.4.0-84-generic (buildd@lcy01-amd64-007) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #94~18.04.1-Ubuntu SMP Thu Aug 26 23:17:46 UTC 2021 (Ubuntu 5.4.0-84.94~18.04.1-generic 5.4.133)
Linux version 5.4.0-84-generic (buildd@lcy01-amd64-007) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #94~18.04.1-Ubuntu SMP Thu Aug 26 23:17:46 UTC 2021 (Ubuntu 5.4.0-84.94~18.04.1-generic 5.4.133)
(however the Linux version lacks some of the features of Windows and Mac version).
(however the Linux version lacks some of the features of Windows and Mac version).
Linux version %d.%d.%d
<p>This is the GNU/Linux version of the popular PasswordSafe password manager, originally designed by the renowned security technologist Bruce Schneier and open sourced in 2002.</p>
<p>This is the GNU/Linux version of the popular PasswordSafe password manager, originally designed by the renowned security technologist Bruce Schneier and open sourced in 2002.</p>
MESSAGE=Linux version 5.4.0-84-generic (buildd@lcy01-amd64-007) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #94~18.04.1-Ubuntu SMP Thu Aug 26 23:17:46 UTC 2021 (Ubuntu 5.4.0-84.94~18.04.1-generic 5.4.133)
Linux version 5.4.0-84-generic (buildd@lcy01-amd64-007) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #94~18.04.1-Ubuntu SMP Thu Aug 26 23:17:46 UTC 2021 (Ubuntu 5.4.0-84.94~18.04.1-generic 5.4.133)

这里可以看到祥云杯附件Linux kernel是5.4.0-84-generic

而这个内核版本只有ubuntu18.04以下的才能下载使用 我之前一直用的是20.04 搞了很久 浪费很多时间

可以使用以下命令查看已经安装的内核镜像

dpkg --get-selections |grep linux-image

1
2
3
4
5
6
xhc@ubuntu:~/Desktop/volatility$ dpkg --get-selections |grep linux-image
linux-image-5.4.0-131-generic install
linux-image-5.4.0-84-generic install
linux-image-5.4.0-84-lowlatency install
linux-image-generic-hwe-18.04 install

此时我是 已经下载好了linux-image-5.4.0-84-generic,正常是没有的

利用下面命令下载需要的内核版本,x根据自己需求替换

1
sudo apt install linux-image-x.x.x-xx-lowlatency linux-headers-x.x.x-xx-lowlatency

替换内核版本

接下来就是替换内核版本,这里说说我的Ubuntu18.04切换切换内核的方法

执行下面的命令可以选择内核版本启动

1
vim /etc/default/grub

image-20221106190656746

设置完成后:

1
2
sudo update-grub
sudo reboot

image-20221106190846684

选择 advanced options

image-20221106191003465

在选择我们需要的内核版本启动

构建过程

安装build-essentialdwarfdump(调试文件导出工具),/boot目录下找到该System.map.xx文件包含系统的符号信息。

1
2
3
4
sudo apt install build-essential dwarfdump
cd volatility/tools/linux
make
sudo zip ./volatility/plugins/overlays/linux/Ubuntu.zip ./tools/linux/module.dwarf /boot/System.map-`uname -r`

执行完make后我们将得到一个module.dwarf文件,该文件包含了我们所需的内核调试信息。

将moudle.dwarf以及system.map文件打包成一个zip文件,放在volatility/plugins/overlays/linux下。

放在volatility/plugins/overlays/linux下之后查看info

1
2
3
4
5
6
7
xhc@ubuntu:~/Desktop/volatility$ python vol.py --info|grep Linux
Volatility Foundation Volatility Framework 2.6.1
LinuxUbuntux64 - A Profile for Linux Ubuntu x64
LinuxAMD64PagedMemory - Linux-specific AMD 64-bit address space.
linux_aslr_shift - Automatically detect the Linux ASLR shift
linux_banner - Prints the Linux banner information
linux_yarascan - A shell in the Linux memory image

LinuxUbuntux64 即是我们新加的profile 此时我们就可以开始利用volatility 写题了

volatility取证Linux命令

vol官方命令文档:https://github.com/volatilityfoundation/volatility/wiki/Linux-Command-Reference

volatility.exe –info|grep linux 可以看到所有命令,具体使用可以翻官方文档

参考文章

(6条消息) 制作Linux内存镜像+制作对应的volatility profile_shu天的博客-CSDN博客_内存镜像

如何基于volatility2构建“新”版本内核的profile - 跳跳糖 (tttang.com)

(6条消息) ubuntu18.04.4更换内核版本_小立爱学习的博客-CSDN博客_ubuntu18.04内核版本

(6条消息) Ubuntu 安装指定内核的方法_dong_shi_bo_的博客-CSDN博客_ubuntu安装内核

  • 本文标题:制作Linux内存镜像+制作对应的volatility_profile
  • 本文作者:萧禾财
  • 创建时间:2022-11-06 18:46:02
  • 本文链接:https://ipartmentxhc.github.io/2022/11/06/制作Linux内存镜像-制作对应的volatility-profile/
  • 版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!