웹 취약점을 노린 피싱 사이트 공격
00 관리자는 00학원 서버 담당자이다. 서버 하드 디스크 문제로 장애가 발생하였고, 복구 이후 시스템은 정상적으로 작동했다.
하지만 공격자는 jeonjucom 계정의 비밀번호를 무차별 대입 공격으로 알아내고,
FTP를 이용해 악성 PHP 스크립트를 업로드하였다. 다행히도 00 관리자가 새벽에 공격 흔적을 탐지하고 추적을 시작하게 된다.
100번이었기 때문에 100번 서버에서만 차단되도록 설정되어 있던 보안 허점을 이용함.
해시값 (MD5): 67876495121561205570ff4150b04ac9
용도: 스팸 메일을 자동으로 대량 발송하는 악성 PHP 스크립트
/home/계정명/public_html 경로 파일의 해시값 주기적 관리webshell.php 수정 → 해시 저장 기능 추가
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