노출된 RDP: 여전히 공격자에게 유리한 잘못된 구성
Detection stack
- AIDR
- Alert
- ETL
- Query
요약
이 기사에서는 노출된 원격 데스크톱 프로토콜 서비스가 여전히 공격자들에게 일반적인 초기 접근 벡터로 작용하고 있다고 설명합니다. 많은 조직이 여전히 RDP 포트를 공용 인터넷에서 접근 가능하게 남겨두어 자동 스캔 및 기회를 노린 침입 시도의 쉬운 표적이 되고 있습니다. 이 포스트는 공격자들이 개방된 RDP 접근 또는 노출된 RDWeb 포털을 악용하여 환경에 진입한 후 수평 이동을 통해 접근을 확장한 실제 사례를 강조합니다.
조사
설명된 사례에는 인터넷에 노출된 RDP 포트를 가진 의료 조직, RDWeb 포털을 통한 침해를 포함한 사건, 취약한 SonicWall VPN 장치를 악용하여 방화벽과 레지스트리 설정을 변경하고 RDP를 활성화한 침입이 포함됩니다. 이러한 시나리오에서 공격자들은 간단한 Windows 명령어, 역 터널링 유틸리티 및 자격 증명 수집 스크립트를 사용하여 접근을 유지하고 네트워크 깊숙이 이동했습니다.
완화
권장되는 방어책은 불필요한 RDP 노출을 제거하고 필요한 RDP 접근을 적절히 구성된 방화벽 뒤에 배치하며, 의심되는 노출 후 자격 증명을 교체하고 방화벽 및 VPN 로그를 SIEM에 입력하여 빠른 탐지를 가능하게 하는 것에 중점을 둡니다. 또한 EDR 적용 및 RDP 서비스를 활성화하거나 재활성화하는 레지스트리 변경감지가 권장됩니다.
반응
의심스러운 RDP 관련 활동이 탐지되면, 대응자는 공격 IP 주소를 차단하고 RDP 서비스를 비활성화하며 악성 레지스트리 변경을 되돌리고 방화벽 규칙이 변경되지 않았는지 확인하고 영향을 받은 자격 증명을 재설정해야 합니다. 반복되는 접근 시도를 감시하고 모든 구성 변경의 유효성을 검사하는 것도 필수적입니다.
graph TB %% Class Definitions classDef technique fill:#ffcc99 classDef action fill:#99ccff classDef tool fill:#cccccc classDef operator fill:#ff9900 %% Nodes – Techniques tech_scanning_ip[“<b>Technique</b> – <b>T1595.001</b><br/><b>Name</b>: Active Scanning: Scanning IP Blocks<br/><b>Description</b>: Adversary probes ranges of IP addresses to locate vulnerable hosts.”] class tech_scanning_ip technique tech_scanning_vuln[“<b>Technique</b> – <b>T1595.002</b><br/><b>Name</b>: Active Scanning: Vulnerability Scanning<br/><b>Description</b>: Uses automated tools to find known vulnerabilities in remote systems.”] class tech_scanning_vuln technique tech_valid_accounts[“<b>Technique</b> – <b>T1078</b><br/><b>Name</b>: Valid Accounts<br/><b>Description</b>: Use of stolen or otherwise compromised credentials to gain access.”] class tech_valid_accounts technique tech_disable_firewall[“<b>Technique</b> – <b>T1562.004</b><br/><b>Name</b>: Disable or Modify System Firewall<br/><b>Description</b>: Alters firewall configuration to allow inbound traffic such as RDP.”] class tech_disable_firewall technique tech_create_modify_process[“<b>Technique</b> – <b>T1543</b><br/><b>Name</b>: Create or Modify System Process<br/><b>Description</b>: Creates or changes system processes via registry or service configuration.”] class tech_create_modify_process technique tech_system_services[“<b>Technique</b> – <b>T1569</b><br/><b>Name</b>: System Services<br/><b>Description</b>: Manipulates services to execute malicious code or maintain persistence.”] class tech_system_services technique tech_discovery_network[“<b>Technique</b> – <b>T1049</b><br/><b>Name</b>: System Network Connections Discovery<br/><b>Description</b>: Enumerates active network connections on the compromised host.”] class tech_discovery_network technique %% Nodes – Tools / Commands tool_shodan[“<b>Tool</b> – <b>Name</b>: Shodan<br/><b>Description</b>: Internet‑wide scanning service used to discover exposed services such as RDP.”] class tool_shodan tool tool_rdp[“<b>Tool</b> – <b>Name</b>: Remote Desktop Protocol (RDP)<br/><b>Description</b>: Windows remote login service leveraged after credential theft.”] class tool_rdp tool tool_netsh[“<b>Tool</b> – <b>Name</b>: netsh<br/><b>Command</b>: netsh advfirewall add rule name=’RDP-Open’ dir=in protocol=TCP localport=3389 action=allow enable=yes”] class tool_netsh tool tool_reg[“<b>Tool</b> – <b>Name</b>: reg.exe<br/><b>Command</b>: reg add “HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server” /v fDenyTSConnections /t REG_DWORD /d 0 /f”] class tool_reg tool tool_netstart[“<b>Tool</b> – <b>Name</b>: net start<br/><b>Command</b>: net start TermService”] class tool_netstart tool tool_adv_ip_scanner[“<b>Tool</b> – <b>Name</b>: Advanced IP Scanner<br/><b>Description</b>: GUI utility used to enumerate devices and network connections.”] class tool_adv_ip_scanner tool %% Connections – Attack Flow tech_scanning_ip –>|uses| tool_shodan tech_scanning_ip –>|leads_to| tech_scanning_vuln tech_scanning_vuln –>|leads_to| tech_valid_accounts tech_valid_accounts –>|uses| tool_rdp tool_rdp –>|enables| tech_disable_firewall tech_disable_firewall –>|uses| tool_netsh tech_disable_firewall –>|leads_to| tech_create_modify_process tech_create_modify_process –>|uses| tool_reg tech_create_modify_process –>|leads_to| tech_system_services tech_system_services –>|uses| tool_netstart tech_valid_accounts –>|reused_for| tech_valid_accounts tech_valid_accounts –>|leads_to| tech_discovery_network tech_discovery_network –>|uses| tool_adv_ip_scanner
공격 흐름
시뮬레이션 실행
전제 조건: 텔레메트리 및 베이스라인 사전 점검이 통과해야 합니다.
이론적 근거: 이 섹션에서는 탐지 규칙을 트리거하기 위해 설계된 적 공격 기술(TTP)의 정확한 실행을 다룹니다. 명령과 내러티브는 식별된 TTP를 직접 반영해야 하며, 탐지 논리가 기대하는 정확한 텔레메트리를 생성하는 것을 목표로 합니다.
-
공격 내러티브 및 명령:
-
정찰 (T1016.001): 적은 목표 서브넷의 포트 3389가 열려 있는 호스트를 식별하기 위해 빠른 스캔을 수행합니다.
반복문에서반복문에서 -
권한 상승 / 방화벽 조작 (T1021.001): 지역 관리자 권한을 획득한 공격자는
netsh.exe를 사용하여 RDP에 대한 허용적인 인바운드 방화벽 규칙을 추가하여 서비스를 인터넷에 노출시킵니다. - 생성 후 확인: 공격자는 새로운 항목이 존재하는지 방화벽 규칙을 나열한 후 RDP 세션을 시작합니다(이 테스트 범위 외부).
-
정찰 (T1016.001): 적은 목표 서브넷의 포트 3389가 열려 있는 호스트를 식별하기 위해 빠른 스캔을 수행합니다.
-
회귀 테스트 스크립트:
#--------------------------------------------------------- # 모의 적 활동 – netsh를 통한 RDP 노출 #--------------------------------------------------------- # 1. 로컬 /24 서브넷에서 열려 있는 RDP 포트를 스캔 (무해한 정찰) $subnet = "10.0.0." 1..254 | ForEach-Object { $ip = "$subnet$_" $result = Test-NetConnection -ComputerName $ip -Port 3389 -WarningAction SilentlyContinue if ($result.TcpTestSucceeded) { Write-Host "[+] RDP open on $ip" } } # 2. 모든 주소에서 들어오는 RDP를 허용하는 방화벽 규칙 추가 $ruleName = "TempAllowRDP_$(Get-Random -Maximum 10000)" $netshCmd = "advfirewall firewall add rule name=`"$ruleName`" dir=in action=allow protocol=TCP localport=3389" Write-Host "`n[+] Creating firewall rule via netsh..." Start-Process -FilePath "$env:SystemRootSystem32netsh.exe" -ArgumentList $netshCmd -Wait -NoNewWindow # 3. 규칙 존재를 확인 (선택 사항, 텔레메트리 확인 도움) netsh advfirewall firewall show rule name=$ruleName # End of simulated attack -
정리 명령:
#--------------------------------------------------------- # 테스트 중 생성된 임시 방화벽 규칙 제거 #--------------------------------------------------------- $rulePrefix = "TempAllowRDP_" $rules = netsh advfirewall firewall show rule name=all | Select-String -Pattern $rulePrefix | ForEach-Object { ($_ -split 's+')[0] } foreach ($r in $rules) { Write-Host "[*] Deleting rule $r" netsh advfirewall firewall delete rule name=$r }