Difficulty: ❄ ❄ ❄ ❄ ❄ Team Wombley is developing snow weapons in preparation for conflict, but they’ve been locked out by their own defenses. Help Piney with regaining access to the weapon operations terminal.
Hints
PowerShell Admin Access - Total Control
From: I overheard some of the other elves talking. Even though the endpoints have been redacted, they are still operational. This means that you can probably elevate your access by communicating with them. I suggest working out the hashing scheme to reproduce the redacted endpoints. Luckily one of them is still active and can be tested against. Try hashing the token with SHA256 and see if you can reliably reproduce the endpoint. This might help, pipe the tokens to Get-FileHash -Algorithm SHA256.
PowerShell Admin Access - Fakeout EDR Threshold
From: They also mentioned this lazy elf who programmed the security settings in the weapons terminal. He created a fakeout protocol that he dubbed Elf Detection and Response “EDR”. The whole system is literally that you set a threshold and after that many attempts, the response is passed through… I can’t believe it. He supposedly implemented it wrong so the threshold cookie is highly likely shared between endpoints!
Silver trophy
There is a file in the current directory called ‘welcome.txt’. Read the contents of this file
1
Get-Content ./welcome.txt
1 2 3 4 5 6 7 8
System Overview The Elf Weaponry Multi-Factor Authentication (MFA) system safeguards access to a classified armory containing elf weapons. This high-security system is equipped with advanced defense mechanisms, including canaries, retinal scanner and keystroke analyzing, to prevent unauthorized access. In the event of suspicious activity, the system automatically initiates a lockdown, restricting all access until manual override by authorized personnel.
Lockdown Protocols When the system enters lockdown mode, all access to the armory is frozen. This includes both entry to and interaction with the weaponry storage. The defense mechanisms become active, deploying logical barriers to prohibit unauthorized access. During this state, users cannot disable the system without the intervention of an authorized administrator. The system logs all access attempts and alerts central command when lockdown is triggered.
Access and System Restoration To restore access to the system, users must follow strict procedures. First, authorized personnel must identify the scrambled endpoint. Next, they must deactivate the defense mechanisms by entering the override code and presenting the required token. After verification, the system will resume standard operation, and access to weaponry is reactivated.
Geez that sounds ominous, I’m sure we can get past the defense mechanisms. We should warm up our PowerShell skills. How many words are there in the file?
1
Get-Content ./welcome.txt | Measure-Object-Word
1 2 3
Lines Words Characters Property ----- ----- ---------- -------- 180
There is a server listening for incoming connections on this machine, that must be the weapons terminal. What port is it listening on?
1
netstat -an
1 2 3 4 5 6 7 8 9 10 11
Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:1225 0.0.0.0:* LISTEN tcp6 0 0 172.17.0.6:42026 52.179.73.57:443 ESTABLISHED Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node Path unix 2 [ ACC ] STREAM LISTENING 228127385 /tmp/dotnet-diagnostic-632-34546516-socket unix 2 [ ACC ] STREAM LISTENING 228126347 /tmp/CoreFxPipe_PSHost.DB3A6E3C.632.None.pwsh unix 2 [ ACC ] STREAM LISTENING 228069183 /tmp/tmux-1050/default unix 3 [ ] STREAM CONNECTED 228069344 unix 3 [ ] STREAM CONNECTED 228070105 /tmp/tmux-1050/default
You should enumerate that webserver. Communicate with the server using HTTP, what status code do you get?
1
iwr http://localhost:1225
1
Invoke-WebRequest: Response status code does not indicate success: 401 (UNAUTHORIZED).
It looks like defensive measures are in place, it is protected by basic authentication. Try authenticating with a standard admin username and password.
---------------------------------------------------- 🪖 Elf MFA webserver🪖 ⚔️ Grab your tokens for access to weaponry ⚔️ ⚔️ Warning! Sensitive information on the server, protect a… RawContent : HTTP/1.1 200 OK Server: Werkzeug/3.0.6 Server: Python/3.10.12 Date: Tue, 19 Nov 2024 10:35:53 GMT Connection: close Content-Type: text/html; charset=utf-8 Content-Length: 3475 <html> <body> <pre> ---… Headers : {[Server, System.String[]], [Date, System.String[]], [Connection, System.S tring[]], [Content-Type, System.String[]]…} Images : {} InputFields : {} Links : {@{outerHTML=<a href="http://localhost:1225/endpoints/1">Endpoint 1</a>; t agName=A; href=http://localhost:1225/endpoints/1}, @{outerHTML=<a href="ht tp://localhost:1225/endpoints/2">Endpoint 2</a>; tagName=A; href=http://lo calhost:1225/endpoints/2}, @{outerHTML=<a href="http://localhost:1225/endp oints/3">Endpoint 3</a>; tagName=A; href=http://localhost:1225/endpoints/3 }, @{outerHTML=<a href="http://localhost:1225/endpoints/4">Endpoint 4</a>; tagName=A; href=http://localhost:1225/endpoints/4}…} RawContentLength : 3475 RelationLink : {}
There are too many endpoints here. Use a loop to download the contents of each page. What page has 138 words? When you find it, communicate with the URL and print the contents to the terminal.
<html><head><title>MFA token scrambler</title></head><body><p>Yuletide cheer fills the air,<br> A season of love, of care.<br> The world is bright, full of light,<br> As we celebrate this special night.<br> The tree is trimmed, the stockings hung,<br> Carols are sung, bells are rung.<br> Families gather, friends unite,<br> In the glow of the fire’s light.<br> The air is filled with joy and peace,<br> As worries and cares find release.<br> Yuletide cheer, a gift so dear,<br> Brings warmth and love to all near.<br> May we carry it in our hearts,<br> As the season ends, as it starts.<br> Yuletide cheer, a time to share,<br> The love, the joy, the care.<br> May it guide us through the year,<br> In every laugh, in every tear.<br> Yuletide cheer, a beacon bright,<br> Guides us through the winter night </p><p> Note to self, remember to remove temp csvfile at http://127.0.0.1:1225/token_overview.csv</p></body></html>
There seems to be a csv file in the comments of that page. That could be valuable, read the contents of that csv-file!
<h1>Cookie 'mfa_code', use it at <ahref='1732013309.8054779'>/mfa_validate/4216B4FAF4391EE4D3E0EC53A372B2F24876ED5D124FE08E227F84D687A7E06C</a></h1>
Sweet we got a MFA token! We might be able to get access to the system. Validate that token at the endpoint! This is the exact moment I had to use ChatGPT to write the code
CorrectToken supplied, you are granted access to the snow cannon terminal. Here is your personal password foraccess:SnowLeopard2ReadyForAction
Hurray! You have thwarted their defenses! Alabaster can now access their weaponry and put a stop to it. Once HHC grants your achievement, you can close this terminal.
Gold trophy
To obtain the gold trophy I followed the hints of PowerShell Admin Access - Total Control and I had to write a lot of code ending up in an unreasonably longpowershell script:
<h1>[*] Setting cookie attempts</h1> <h1>[+] Success, defense mechanisms deactivated.</h1><br>Administrator Token supplied, You are able to control the production and deployment of the snow cannons. May the best elves win: WombleysProductionLineShallPrevail</p> <h1>[+] Success</h1><br><p>Q29ycmVjdCBUb2tlbiBzdXBwbGllZCwgeW91IGFyZSBncmFudGVkIGFjY2VzcyB0byB0aGUgc25vdyBjYW5ub24gdGVybWluYWwuIEhlcmUgaXMgeW91ciBwZXJzb25hbCBwYXNzd29yZCBmb3IgYWNjZXNzOiBTbm93TGVvcGFyZDJSZWFkeUZvckFjdGlvbg==</p> <h1>[!] System currently in lock down</h1><br><h1>[!] Failure, token has expired. [*] Default timeout set to 2s for security reasons</h1>
Just don’t
I will not even discuss how painful it has been to write the code for this challenge.