시나리오 1 분석 보고서

작성일 : 2025-08-01

개요

웹 취약점을 노린 피싱 사이트 공격
00 관리자는 00학원 서버 담당자이다. 서버 하드 디스크 문제로 장애가 발생하였고, 복구 이후 시스템은 정상적으로 작동했다. 하지만 공격자는 jeonjucom 계정의 비밀번호를 무차별 대입 공격으로 알아내고, FTP를 이용해 악성 PHP 스크립트를 업로드하였다. 다행히도 00 관리자가 새벽에 공격 흔적을 탐지하고 추적을 시작하게 된다.

1. 최초 공격 시점은 언제인가?

  • 최초 공격 시간: 2025-07-31 09:36:40
auth.log 증거
※ auth.log에 기록된 최초 공격 시점
  • 최초 접근 시간: 2025-04-23 18:57:55
syslog 증거
※ syslog에 기록된 최초 접근 시점
  • jeonjucom 계정 생성 시점: 2025-07-29
    ※ NMS 구축 중 생성된 계정으로, 같은 날 서버도 비정상 종료됨
  • 사설 IP 차단 설정 오류:
    jeonjucom 계정은 이전에 차단된 사설 IP 대역을 우회해 접속했으며,
    기존 서버가 100번이었기 때문에 100번 서버에서만 차단되도록 설정되어 있던 보안 허점을 이용함.

2. dng.php 파일의 해시값과 용도는 무엇인가?

해시값 (MD5): 67876495121561205570ff4150b04ac9

용도: 스팸 메일을 자동으로 대량 발송하는 악성 PHP 스크립트

3. 대응 전략은 무엇인가?

  • /home/계정명/public_html 경로 파일의 해시값 주기적 관리
  • 대응 방안 예시:
    • webshell.php 수정 → 해시 저장 기능 추가
    • 파이썬/셸 스크립트로 해시값 DB 테이블화
  • Tripwire 기반 시스템 무결성 검사 도구 도입
Tripwire 설치 및 설정 예시
apt -y install tripwire
cd /etc/tripwire
nano twcfg.txt
twadmin -m F -c tw.cfg -S site.key twcfg.txt
nano twpolmake.pl 
#!/usr/bin/perl
# Tripwire Policy File customize tool
# ----------------------------------------------------------------
# Copyright (C) 2003 Hiroaki Izumi
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# ----------------------------------------------------------------
# Usage:
#     perl twpolmake.pl {Pol file}
# ----------------------------------------------------------------
#
$POLFILE=$ARGV[0];

open(POL,"$POLFILE") or die "open error: $POLFILE" ;
my($myhost,$thost) ;
my($sharp,$tpath,$cond) ;
my($INRULE) = 0 ;

while () {
    chomp;
    if (($thost) = /^HOSTNAME\s*=\s*(.*)\s*;/) {
        $myhost = `hostname` ; chomp($myhost) ;
        if ($thost ne $myhost) {
            $_="HOSTNAME=\"$myhost\";" ;
        }
    }
    elsif ( /^{/ ) {
        $INRULE=1 ;
    }
    elsif ( /^}/ ) {
        $INRULE=0 ;
    }
    elsif ($INRULE == 1 and ($sharp,$tpath,$cond) = /^(\s*\#?\s*)(\/\S+)\b(\s+->\s+.+)$/) {
        $ret = ($sharp =~ s/\#//g) ;
        if ($tpath eq '/sbin/e2fsadm' ) {
            $cond =~ s/;\s+(tune2fs.*)$/; \#$1/ ;
        }
        if (! -s $tpath) {
            $_ = "$sharp#$tpath$cond" if ($ret == 0) ;
        }
        else {
            $_ = "$sharp$tpath$cond" ;
        }
    }
    print "$_\n" ;
}
close(POL) ;
perl twpolmake.pl twpol.txt > twpol.txt.new
twadmin -m P -c tw.cfg -p tw.pol -S site.key twpol.txt.new
tripwire -m i -s -c tw.cfg
tripwire -m c -s -c /etc/tripwire/tw.cfg
ll /var/lib/tripwire/report 
tripwire -m u -a -s -c /etc/tripwire/tw.cfg \
-r /var/lib/tripwire/report/dlp.srv.world-20181129-140452.twr