Overwatch
Full name: Kravtsov Nikolay Dmitrievich
Educational institution: **** **** *****
Grade: 11
Overwatch
I’ll be honest: AI did part of the work for me. Active Directory is not my strong suit, but the help I needed was with reverse engineering. I asked for commands to analyze overwatch.exe and spent a long time trying to get a working approach for accessing the SQL07 linked server. I also asked it to write a command injection exploit.
1. Initial analysis
nmap -sCV -Pn -p- -n -T4 10.129.244.81
First, I checked SMB for interesting shares. I found a share called software and sighed: it looked as though today’s punishment would be reverse engineering.
Inspecting the software share confirmed that I would have to reverse-engineer a .NET binary.
2. Obtaining the user flag
Using dotnet-tools and ilspycmd, I inspected the decompiled code and found hardcoded MSSQL credentials. In the Program class, CheckEdgeHistory contains this plaintext string:
I also found there Command-Injection in the KillProccess method: just literally put a semicolon and comment out what comes after the payload and you're done. But the web server is deployed on port 8000 - it is closed. Therefore, it will be needed later; most likely, the vulnerability was left for a reason. Afterwards, I went into the database using this data. After doing a little analysis, I found that we have a linked database:
My attempt to connect failed: the database could not resolve my IP address, and I had no DNS entry for it.
All you need to do is take three steps to fix it:
First install krbrelayx and add the server to dns using dnstool.py:
Next, you need to run Responder in the first terminal ( https://github.com/lgandx/Responder.git ), and in the second run the command
EXEC ('SELECT 1') AT SQL07;on the MSSQL server to which access has already been obtained.
- Return to the first terminal to retrieve the credentials:
Having entered them, you can go to C:\Users\sqlmgmt\Desktop and read user.txt.
462c5dafddea3be3e8007f218aafcee6
3. Obtaining the root flag
35246d37fec24ac510775dd2ad0a6170
4. Vulnerability Summary
| Stage/Vulnerability | Type of impact | CVSS score | Possible consequences | Result |
|---|---|---|---|---|
| Access to SMB share software | Information Disclosure | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N 5.3 (MEDIUM) |
Exposed binaries make reverse engineering easier | Received overwatch.exe |
| Hardcoded credentials in the .NET binary | Credential Exposure | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N 9.1 (HIGH) |
Access to MSSQL | Database access |
| Availability of Linked Server (SQL07) | Trust Misconfiguration | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N 8.8 (HIGH) |
Lateral movement in AD | Attempting to access SQL07 |
| NTLM relay via Responder | Credential Theft / Relay | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N 8.8 (HIGH) |
Obtaining credentials | Received credentials sqlmgmt, user flag |
| Command Injection in the KillProcess method | Remote Code Execution | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H 9.8 (CRITICAL) |
Execute arbitrary commands from nt authority\system | Received root flag |
5. Complete chain of compromise
- Port Scan → SMB and MSSQL detection
- Access to SMB share software
- Downloading overwatch.exe
- Reverse-engineering the .NET binary with ilspycmd
- Detection of hardcoded MSSQL credentials
- Connecting to MSSQL
- Linked Server Discovery (SQL07)
- Setting up DNS + krbrelayx
- Launching Responder
- NTLM relay via EXEC ('SELECT 1') AT SQL07
- Getting sqlmgmt credentials
- Reading the user flag
- Exploiting Command Injection in the KillProcess SOAP Method
- Executing a command as SYSTEM
- Getting the root flag
6. Remediation recommendations
Protect source code
Необходимо: 1. Не хранить production-бинарники в общедоступных SMB-шарах (которые можно посмотреть через null-вход) 2. Включить аудит доступа к SMRemove hardcoded data:
Необходимо: 1. Удалить данные из исходного кода и скомпилировать еще раз 2. Использовать окружение или хранилище секретов (например, HashiCorp vault) 3. Провести ротацию всех скомпрометированных паролей.Protect MSSQL:
Необходимо: 1. Ограничить использование linked-сервера 2. Отключить RPC, если не требуется 3. Включить шифрование соединений 4. Ограничить доступ к MSSQL по IP, создать белый список 5. Использовать Kerberos-only аутентификацию.Protect from NTLM-Relay:
Необходимо: 1. Включить SMB Signing 2. Ограничить LLMBR и NetBios 3. Использовать NTLMv2 только когда необходимо.Eliminate Command Injection:
Необходимо: 1. Никогда не использовать Process.Start() с пользовательским вводом напрямую 2. Сделать санитизацию пользовательского ввода 3. Разрешить только определенные символы 4. Экранировать аргументы комманд 5. Запускать веб-сервер с минимальными правами.Fix the Active Directory (AD) structure as a whole:
Необходимо: 1. Минимизировать привилегии сервисных аккаунтов 2. Включить аудит аутентификации 3. Мониторить вход, NTLM, подозрительные SOAP-запросы и т.п. 4. Регулярно проверять безопасность AD (например, анализом конфигурации, исходного кода, следить за версиями и новыми уязвимостями, регулярный пентест)